[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30860] trunk/blender/source/blender/ editors/sculpt_paint: Fixed some potential memory corruption

Nicholas Bishop nicholasbishop at gmail.com
Thu Jul 29 04:29:33 CEST 2010


Revision: 30860
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30860
Author:   nicholasbishop
Date:     2010-07-29 04:29:32 +0200 (Thu, 29 Jul 2010)

Log Message:
-----------
Fixed some potential memory corruption

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2010-07-29 01:45:32 UTC (rev 30859)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2010-07-29 02:29:32 UTC (rev 30860)
@@ -789,7 +789,7 @@
 	Paint *paint = paint_get_active(CTX_data_scene(C)); // XXX
 	Brush *brush = paint_brush(paint); // XXX
 
-	float mouse[2];
+	float mouse[3];
 
 	PointerRNA itemptr;
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2010-07-29 01:45:32 UTC (rev 30859)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2010-07-29 02:29:32 UTC (rev 30860)
@@ -3073,20 +3073,15 @@
 		cache->special_rotation = atan2(dx, dy) + M_PI;
 
 		if (brush->flag & BRUSH_EDGE_TO_EDGE) {
-			float d[3];
-			float halfway[3];
+			float halfway[2];
 			float out[3];
 
-			d[0] = dx;
-			d[1] = dy;
-			d[2] = 0;
+			halfway[0] = dx*0.5 + cache->initial_mouse[0];
+			halfway[1] = dy*0.5 + cache->initial_mouse[1];
 
-			mul_v3_v3fl(halfway, d, 0.5f);
-			add_v3_v3(halfway, cache->initial_mouse);
-
 			if (sculpt_stroke_get_location(C, stroke, out, halfway)) {
 				copy_v3_v3(sd->anchored_location, out);
-				copy_v3_v3(sd->anchored_initial_mouse, halfway);
+				copy_v2_v2(sd->anchored_initial_mouse, halfway);
 				copy_v2_v2(cache->tex_mouse, halfway);
 				copy_v3_v3(cache->true_location, sd->anchored_location);
 				sd->anchored_size /= 2.0f;
@@ -3114,7 +3109,7 @@
 		const float dy = cache->last_rake[1] - cache->mouse[1];
 
 		if (cache->first_time) {
-			copy_v3_v3(cache->last_rake, cache->mouse);
+			copy_v2_v2(cache->last_rake, cache->mouse);
 		}
 		else if (dx*dx + dy*dy >= r*r) {
 			cache->special_rotation = atan2(dx, dy);





More information about the Bf-blender-cvs mailing list