Fix drawing text on >2gig buffers (stamp for eg)

This commit is contained in:
Campbell Barton 2015-06-02 14:59:31 +10:00
parent abc4a3d455
commit c67abff7f0
1 changed files with 11 additions and 4 deletions

View File

@ -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];