diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-04-30 12:54:06 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-04-30 12:54:06 +0400 |
commit | 03c362f1ab75dcf647b14a4de0ad636ece05ca82 (patch) | |
tree | 86e68a063230b4a05f272f6f12801de7aab0973c /source/blender/blenfont/intern/blf_font.c | |
parent | ed76b3cb77279b2be246b54e0f45c5eaabc04bb6 (diff) |
fix [#27221] stamp text bug in lower lines
Diffstat (limited to 'source/blender/blenfont/intern/blf_font.c')
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 80d0a48954a..708b3708ab7 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -218,7 +218,7 @@ void blf_font_buffer(FontBLF *font, const char *str) FT_Vector delta; FT_UInt glyph_index; float a, *fbuf; - int pen_x, y, x, yb; + int pen_x, y, x; int i, has_kerning, st, chx, chy; if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf)) @@ -276,13 +276,20 @@ void blf_font_buffer(FontBLF *font, const char *str) /* dont draw beyond the buffer bounds */ int width_clip= g->width; int height_clip= g->height; + int yb_start= g->pitch < 0 ? 0 : g->height-1; if (width_clip + chx > font->bw) width_clip -= chx + width_clip - font->bw; if (height_clip + pen_y > font->bh) height_clip -= pen_y + height_clip - font->bh; - - yb= g->pitch < 0 ? 0 : g->height-1; + /* drawing below the image? */ + if(pen_y < 0) { + yb_start += (g->pitch < 0) ? -pen_y : pen_y; + height_clip += pen_y; + pen_y= 0; + } + if (font->b_fbuf) { + int yb= yb_start; for (y=(chy >= 0 ? 0:-chy); y < height_clip; y++) { for (x=(chx >= 0 ? 0:-chx); x < width_clip; x++) { @@ -311,6 +318,7 @@ void blf_font_buffer(FontBLF *font, const char *str) } if (font->b_cbuf) { + int yb= yb_start; for (y= 0; y < height_clip; y++) { for (x= 0; x < width_clip; x++) { a= *(g->bitmap + x + (yb * g->pitch)) / 255.0f; |