aboutsummaryrefslogtreecommitdiff
path: root/generic/Map.c
diff options
context:
space:
mode:
authorlecoanet2003-10-02 12:03:43 +0000
committerlecoanet2003-10-02 12:03:43 +0000
commit51e2f65c0dfc2c5c8d726e9e91c5c650b83c1f6e (patch)
tree4fe0d18b3d266b2bb9e458ab2e9fcca7fef1d6da /generic/Map.c
parent403cb9c8ccbd08c4e5b0ffa24aa5849b02404c82 (diff)
downloadtkzinc-51e2f65c0dfc2c5c8d726e9e91c5c650b83c1f6e.zip
tkzinc-51e2f65c0dfc2c5c8d726e9e91c5c650b83c1f6e.tar.gz
tkzinc-51e2f65c0dfc2c5c8d726e9e91c5c650b83c1f6e.tar.bz2
tkzinc-51e2f65c0dfc2c5c8d726e9e91c5c650b83c1f6e.tar.xz
The patterns and icons are updated when images change.
The font texture is loaded when doing the first drawing. Changed the api of ZnConfigureAttributes.
Diffstat (limited to 'generic/Map.c')
-rw-r--r--generic/Map.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/generic/Map.c b/generic/Map.c
index 5cdaa78..da36243 100644
--- a/generic/Map.c
+++ b/generic/Map.c
@@ -216,9 +216,6 @@ Init(ZnItem item,
Tk_NameOfFont(wi->map_text_font));
#ifdef GL
map->tfi = NULL;
- if (wi->render) {
- map->tfi = ZnGetTexFont(wi, map->text_font);
- }
#endif
map->map_info_name = NULL;
@@ -304,10 +301,10 @@ Clone(ZnItem item)
map->color = ZnGetGradientByValue(map->color);
map->text_font = Tk_GetFont(wi->interp, wi->win, Tk_NameOfFont(map->text_font));
#ifdef GL
- map->tfi = ZnGetTexFont(wi, map->text_font);
+ map->tfi = NULL;
#endif
if (map->fill_pattern != ZnUnspecifiedImage) {
- map->fill_pattern = ZnGetImageByValue(map->fill_pattern);
+ map->fill_pattern = ZnGetImageByValue(map->fill_pattern, NULL, NULL);
}
if (map->symbol_patterns) {
ZnImage *pats, *new_pats;
@@ -318,7 +315,7 @@ Clone(ZnItem item)
map->symbol_patterns = ZnListNew(num_pats, sizeof(ZnImage));
new_pats = ZnListArray(map->symbol_patterns);
for (i = 0; i < num_pats; i++) {
- new_pats[i] = ZnGetImageByValue(pats[i]);
+ new_pats[i] = ZnGetImageByValue(pats[i], NULL, NULL);
}
}
}
@@ -346,7 +343,7 @@ Destroy(ZnItem item)
}
#endif
if (map->fill_pattern != ZnUnspecifiedImage) {
- ZnFreeImage(map->fill_pattern);
+ ZnFreeImage(map->fill_pattern, NULL, NULL);
map->fill_pattern = ZnUnspecifiedImage;
}
if (map->symbol_patterns) {
@@ -357,7 +354,7 @@ Destroy(ZnItem item)
num_pats = ZnListSize(map->symbol_patterns);
for (i = 0; i < num_pats; i++) {
if (pats[i] != ZnUnspecifiedImage) {
- ZnFreeImage(pats[i]);
+ ZnFreeImage(pats[i], NULL, NULL);
}
}
ZnListFree(map->symbol_patterns);
@@ -390,7 +387,7 @@ Configure(ZnItem item,
Tk_Font old_font = map->text_font;
#endif
- if (ZnConfigureAttributes(wi, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
+ if (ZnConfigureAttributes(wi, item, item, map_attrs, argc, argv, flags) == TCL_ERROR) {
return TCL_ERROR;
}
@@ -398,10 +395,7 @@ Configure(ZnItem item,
if (old_font != map->text_font) {
if (map->tfi) {
ZnFreeTexFont(map->tfi);
- }
- map->tfi = ZnGetTexFont(wi, map->text_font);
- if (!map->tfi) {
- return TCL_ERROR;
+ map->tfi = NULL;
}
}
#endif
@@ -1463,6 +1457,9 @@ Render(ZnItem item)
glDisable(GL_LINE_STIPPLE);
}
+ if (! map->tfi) {
+ map->tfi = ZnGetTexFont(wi, map->text_font);
+ }
if (ZnListSize(map->texts) && map->tfi) {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_TEXTURE_2D);