aboutsummaryrefslogtreecommitdiff
path: root/generic/Text.c
diff options
context:
space:
mode:
authorlecoanet2003-10-02 09:19:01 +0000
committerlecoanet2003-10-02 09:19:01 +0000
commit8b6252353d5cea13f28da5ffd99958d5852899e4 (patch)
tree2e3665d8787dde64f7b44338bfd3e868389ef7f2 /generic/Text.c
parent290833f95e9a84da788cede6a5ce1ef603e084dd (diff)
downloadtkzinc-8b6252353d5cea13f28da5ffd99958d5852899e4.zip
tkzinc-8b6252353d5cea13f28da5ffd99958d5852899e4.tar.gz
tkzinc-8b6252353d5cea13f28da5ffd99958d5852899e4.tar.bz2
tkzinc-8b6252353d5cea13f28da5ffd99958d5852899e4.tar.xz
Now patterns are automatically updated if
their images changed. Changed the ZnConfigureAttributes api. The texture font allocation is postponed until need for drawing. At that time the GL engine is guaranteed in the right state.
Diffstat (limited to 'generic/Text.c')
-rw-r--r--generic/Text.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/generic/Text.c b/generic/Text.c
index e2b83f2..f662467 100644
--- a/generic/Text.c
+++ b/generic/Text.c
@@ -196,9 +196,6 @@ Init(ZnItem item,
text->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(wi->font));
#ifdef GL
text->tfi = NULL;
- if (wi->render) {
- text->tfi = ZnGetTexFont(wi, text->font);
- }
#endif
text->width = 0;
text->spacing = 0;
@@ -230,14 +227,12 @@ Clone(ZnItem item)
text->text = str;
}
if (text->fill_pattern != ZnUnspecifiedImage) {
- text->fill_pattern = ZnGetImageByValue(text->fill_pattern);
+ text->fill_pattern = ZnGetImageByValue(text->fill_pattern, NULL, NULL);
}
text->color = ZnGetGradientByValue(text->color);
text->font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(text->font));
#ifdef GL
- if (wi->render) {
- text->tfi = ZnGetTexFont(wi, text->font);
- }
+ text->tfi = NULL;
#endif
/*
@@ -267,7 +262,7 @@ Destroy(ZnItem item)
ZnFree(text->text);
}
if (text->fill_pattern != ZnUnspecifiedImage) {
- ZnFreeImage(text->fill_pattern);
+ ZnFreeImage(text->fill_pattern, NULL, NULL);
text->fill_pattern = ZnUnspecifiedImage;
}
ZnFreeGradient(text->color);
@@ -304,7 +299,7 @@ Configure(ZnItem item,
Tk_Font old_font = text->font;
#endif
- if (ZnConfigureAttributes(item->wi, item, text_attrs,
+ if (ZnConfigureAttributes(item->wi, item, item, text_attrs,
argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -313,12 +308,7 @@ Configure(ZnItem item,
if (old_font != text->font) {
if (text->tfi) {
ZnFreeTexFont(text->tfi);
- }
- if (item->wi->render) {
- text->tfi = ZnGetTexFont(item->wi, text->font);
- if (!text->tfi) {
- return TCL_ERROR;
- }
+ text->tfi = NULL;
}
}
#endif
@@ -876,10 +866,16 @@ Render(ZnItem item)
int sel_first_line=-1, sel_last_line=-1, cursor_line=-1;
int sel_start_offset=0, sel_stop_offset=0, cursor_offset=0;
- if (!text->text_info || !text->tfi) {
+ if (!text->text_info) {
return;
}
+ if (!text->tfi) {
+ if (! (text->tfi = ZnGetTexFont(wi, text->font))) {
+ return;
+ }
+ }
+
#ifdef GL_LIST
if (!item->gl_list) {
item->gl_list = glGenLists(1);