diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-16 19:16:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-16 19:16:22 +0400 |
commit | 7c6d52eb07c4bd8142a95eca1dbdc794063859b8 (patch) | |
tree | e373df9d8e94d2fa0234314446e074b5940c0199 /source | |
parent | 6b283f1168295cf3b88fd29aa09f88feb10c1137 (diff) |
BLF: avoid allocating empty array in blf_glyph_cache_texture
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 8a734f95db2..637f534563f 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -154,8 +154,7 @@ void blf_glyph_cache_free(GlyphCacheBLF *gc) static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc) { - int tot_mem, i; - unsigned char *buf; + int i; /* move the index. */ gc->cur_tex++; @@ -175,9 +174,6 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc) if (gc->p2_height > font->max_tex_size) gc->p2_height = font->max_tex_size; - tot_mem = gc->p2_width * gc->p2_height; - buf = (unsigned char *)MEM_callocN((size_t)tot_mem, __func__); - glGenTextures(1, &gc->textures[gc->cur_tex]); glBindTexture(GL_TEXTURE_2D, (font->tex_bind_state = gc->textures[gc->cur_tex])); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); @@ -185,8 +181,7 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, gc->p2_width, gc->p2_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, buf); - MEM_freeN((void *)buf); + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, gc->p2_width, gc->p2_height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, NULL); } GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c) |