From a780e7f3f09ffec99600a518a17b219b5aaee2c6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 17 Jan 2014 03:04:46 +1100 Subject: BLF: Fix for changing the DPI storing many fonts (300+) Each dpi value stores its own set of font sizes, so while dragging the dpi value would collect many sizes and never free. Also change how BLF_cache_clear works, it was freeing memory but not the OpenGL textures. Now just free all the cache and GL textures and let drawing allocate them again as needed. --- source/blender/blenfont/intern/blf_glyph.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'source/blender/blenfont/intern/blf_glyph.c') diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 637f534563f..248c645edc0 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -121,17 +121,9 @@ GlyphCacheBLF *blf_glyph_cache_new(FontBLF *font) void blf_glyph_cache_clear(FontBLF *font) { GlyphCacheBLF *gc; - GlyphBLF *g; - int i; - - for (gc = font->cache.first; gc; gc = gc->next) { - for (i = 0; i < 257; i++) { - while ((g = BLI_pophead(&gc->bucket[i]))) { - blf_glyph_free(g); - } - } - memset(gc->glyph_ascii_table, 0, sizeof(gc->glyph_ascii_table)); + while ((gc = BLI_pophead(&font->cache))) { + blf_glyph_cache_free(gc); } } -- cgit v1.2.3