diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-02 07:59:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-02 07:59:31 +0300 |
commit | c67abff7f034b33ba7a0916d994c3f5aba100617 (patch) | |
tree | c7f5cfe528f2901d6552a5f82dc8fbd59dba046f /source/blender/blenfont | |
parent | abc4a3d455f8fe91cd32b0cba8dda7f65ee2b77c (diff) |
Fix drawing text on >2gig buffers (stamp for eg)
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 8f8ee445ef9..2057b0f6bbf 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -286,10 +286,9 @@ void blf_font_buffer(FontBLF *font, const char *str) (unsigned char)(buf_info->col[2] * 255), (unsigned char)(buf_info->col[3] * 255)}; - unsigned char *cbuf; int chx, chy; int y, x; - float a, *fbuf; + float a; BLF_KERNING_VARS(font, has_kerning, kern_mode); @@ -349,8 +348,12 @@ void blf_font_buffer(FontBLF *font, const char *str) a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f; if (a > 0.0f) { + const size_t buf_ofs = ( + ((size_t)(chx + x) + ((size_t)(pen_y + y) * (size_t)buf_info->w)) * + (size_t)buf_info->ch); + float *fbuf = buf_info->fbuf + buf_ofs; float alphatest; - fbuf = buf_info->fbuf + buf_info->ch * ((chx + x) + ((pen_y + y) * buf_info->w)); + if (a >= 1.0f) { fbuf[0] = b_col_float[0]; fbuf[1] = b_col_float[1]; @@ -380,8 +383,12 @@ void blf_font_buffer(FontBLF *font, const char *str) a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f; if (a > 0.0f) { + const size_t buf_ofs = ( + ((size_t)(chx + x) + ((size_t)(pen_y + y) * (size_t)buf_info->w)) * + (size_t)buf_info->ch); + unsigned char *cbuf = buf_info->cbuf + buf_ofs; int alphatest; - cbuf = buf_info->cbuf + buf_info->ch * ((chx + x) + ((pen_y + y) * buf_info->w)); + if (a >= 1.0f) { cbuf[0] = b_col_char[0]; cbuf[1] = b_col_char[1]; |