From afbb207a994d09750efab29dc56cfe4c2548a709 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 14 Sep 2011 02:45:44 +0000 Subject: minor edits to ascii draw function, unused var warning. --- source/blender/blenfont/intern/blf_font.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source/blender/blenfont') diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 8a71c3de86b..3bec7dd2626 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -99,9 +99,10 @@ void blf_font_size(FontBLF *font, int size, int dpi) static void blf_font_ensure_ascii_table(FontBLF *font) { + GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; + /* build ascii on demand */ - if(font->glyph_cache->glyph_ascii_table['0']==NULL) { - GlyphBLF **glyph_ascii_table= font->glyph_cache->glyph_ascii_table; + if(glyph_ascii_table['0']==NULL) { GlyphBLF *g; unsigned int i; for(i=0; i<256; i++) { @@ -125,7 +126,7 @@ static void blf_font_ensure_ascii_table(FontBLF *font) #define BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table) \ if(((c)= (str)[i]) < 0x80) { \ - g= glyph_ascii_table[c]; \ + g= (glyph_ascii_table)[c]; \ i++; \ } \ else if ((c= blf_utf8_next((unsigned char *)(str), &(i)))) { \ @@ -212,7 +213,7 @@ void blf_font_draw_ascii(FontBLF *font, const char *str, unsigned int len) blf_font_ensure_ascii_table(font); while ((c= *(str++)) && len--) { - g= font->glyph_cache->glyph_ascii_table[c]; + g= glyph_ascii_table[c]; /* if we don't found a glyph, skip it. */ if (!g) @@ -401,7 +402,6 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) if (!font->glyph_cache) return; - glyph_ascii_table= font->glyph_cache->glyph_ascii_table; box->xmin= 32000.0f; box->xmax= -32000.0f; @@ -415,6 +415,7 @@ void blf_font_boundbox(FontBLF *font, const char *str, rctf *box) g_prev= NULL; blf_font_ensure_ascii_table(font); + glyph_ascii_table= font->glyph_cache->glyph_ascii_table; while (str[i]) { -- cgit v1.2.3