diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-02-27 16:55:07 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-02-27 16:55:07 +0300 |
commit | 41dbb06b765acbf44a45f20fc29b232dafac20ca (patch) | |
tree | 639112f6046468f8eddea72bd246689aa85b7d90 /source/blender/blenfont | |
parent | 0a3b4d4c64f15e0a39121d7bacb8e6096aa2130d (diff) |
Fix T74228, T74246: Strange Characters
The glyph can come from a different cache.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 10 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_internal_types.h | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 8e88bda37a5..3ab6814c531 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -461,7 +461,7 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl return; } - if (!g->cached) { + if (g->glyph_cache == NULL) { if (font->tex_size_max == -1) { font->tex_size_max = GPU_max_texture_size(); } @@ -492,7 +492,7 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl gc->bitmap_len = bitmap_len; gc->glyphs_len_free--; - g->cached = true; + g->glyph_cache = gc; } if (font->flags & BLF_CLIPPING) { @@ -505,8 +505,10 @@ void blf_glyph_render(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, float x, fl } } - g_batch.glyph_cache = gc; - BLI_assert(g->offset < gc->bitmap_len); + if (g_batch.glyph_cache != g->glyph_cache) { + blf_batch_draw(); + g_batch.glyph_cache = g->glyph_cache; + } if (font->flags & BLF_SHADOW) { rctf rect_ofs; diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index bb1697d7860..6ea1702200f 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -131,7 +131,7 @@ typedef struct GlyphBLF { float pos_x; float pos_y; - bool cached; + struct GlyphCacheBLF *glyph_cache; } GlyphBLF; typedef struct FontBufInfoBLF { |