[Bf-blender-cvs] [a57b898] master: BLF: Fix clamping drawing into byte buffer

Campbell Barton noreply at git.blender.org
Wed Apr 8 02:39:22 CEST 2015


Commit: a57b898d1760ade693983d1fd080399ab5e3367f
Author: Campbell Barton
Date:   Wed Apr 8 09:45:41 2015 +1000
Branches: master
https://developer.blender.org/rBa57b898d1760ade693983d1fd080399ab5e3367f

BLF: Fix clamping drawing into byte buffer

===================================================================

M	source/blender/blenfont/intern/blf_font.c

===================================================================

diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 087c7c73..1391e18 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -375,8 +375,8 @@ void blf_font_buffer(FontBLF *font, const char *str)
 
 			if (buf_info->cbuf) {
 				int yb = yb_start;
-				for (y = 0; y < height_clip; y++) {
-					for (x = 0; x < width_clip; x++) {
+				for (y = ((chy >= 0) ? 0 : -chy); y < height_clip; y++) {
+					for (x = ((chx >= 0) ? 0 : -chx); x < width_clip; x++) {
 						a = *(g->bitmap + x + (yb * g->pitch)) / 255.0f;
 
 						if (a > 0.0f) {




More information about the Bf-blender-cvs mailing list