From 51e2f65c0dfc2c5c8d726e9e91c5c650b83c1f6e Mon Sep 17 00:00:00 2001 From: lecoanet Date: Thu, 2 Oct 2003 12:03:43 +0000 Subject: The patterns and icons are updated when images change. The font texture is loaded when doing the first drawing. Changed the api of ZnConfigureAttributes. --- generic/Map.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'generic/Map.c') 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); -- cgit v1.1