diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-06 02:24:05 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-06 02:24:05 +0400 |
commit | feccbaabbd39c18b2f552964ebd8dfab4eeaed89 (patch) | |
tree | 0069f654883a7a02dd320649ce61bd7933748111 /source/blender/blenfont | |
parent | a22096e8019c461128a0907e4026859996ec1b5c (diff) | |
parent | 37ba969c74840142682cf22f34610f3b65b86cf4 (diff) |
Merged changes in the trunk up to revision 53584.
Conflicts resolved:
release/scripts/startup/bl_ui/properties_render.py
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/interface_templates.c
source/blender/makesrna/RNA_enum_types.h
Also made additional code updates for:
r53355 UIList - Python-extendable list of UI items
r53460 Alpha premul pipeline cleanup
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/intern/blf_glyph.c | 17 | ||||
-rw-r--r-- | source/blender/blenfont/intern/blf_lang.c | 8 |
2 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 91ecded88be..9c7623f3757 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -383,7 +383,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) if (gc->cur_tex == -1) { blf_glyph_cache_texture(font, gc); gc->x_offs = gc->pad; - gc->y_offs = gc->pad; + gc->y_offs = 0; } if (gc->x_offs > (gc->p2_width - gc->max_glyph_width)) { @@ -391,7 +391,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) gc->y_offs += gc->max_glyph_height; if (gc->y_offs > (gc->p2_height - gc->max_glyph_height)) { - gc->y_offs = gc->pad; + gc->y_offs = 0; blf_glyph_cache_texture(font, gc); } } @@ -400,6 +400,19 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) g->xoff = gc->x_offs; g->yoff = gc->y_offs; + /* prevent glTexSubImage2D from failing if the character + * asks for pixels out of bounds, this tends only to happen + * with very small sizes (5px high or less) */ + if (UNLIKELY((g->xoff + g->width) > gc->p2_width)) { + g->width -= (g->xoff + g->width) - gc->p2_width; + BLI_assert(g->width > 0); + } + if (UNLIKELY((g->yoff + g->height) > gc->p2_height)) { + g->height -= (g->yoff + g->height) - gc->p2_height; + BLI_assert(g->height > 0); + } + + glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); diff --git a/source/blender/blenfont/intern/blf_lang.c b/source/blender/blenfont/intern/blf_lang.c index 4d066ea8740..9086799f984 100644 --- a/source/blender/blenfont/intern/blf_lang.c +++ b/source/blender/blenfont/intern/blf_lang.c @@ -100,7 +100,7 @@ static void fill_locales(void) /* First loop to find highest locale ID */ while (line) { int t; - str = (char*) line->link; + str = (char *)line->link; if (str[0] == '#' || str[0] == '\0') { line = line->next; continue; /* Comment or void... */ @@ -118,12 +118,12 @@ static void fill_locales(void) line = lines; /* Do not allocate locales with zero-sized mem, as LOCALE macro uses NULL locales as invalid marker! */ if (num_locales > 0) { - locales = MEM_callocN(num_locales * sizeof(char*), __func__); + locales = MEM_callocN(num_locales * sizeof(char *), __func__); while (line) { int id; char *loc, *sep1, *sep2, *sep3; - str = (char*) line->link; + str = (char *)line->link; if (str[0] == '#' || str[0] == '\0') { line = line->next; continue; @@ -230,7 +230,7 @@ void BLF_lang_set(const char *str) bl_locale_set(short_locale_utf8); if (short_locale[0]) { - MEM_freeN((void*)short_locale_utf8); + MEM_freeN((void *)short_locale_utf8); } } |