[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59309] trunk/blender/source/blender: Minor optimization for paint systems, initialize the paint curve before

Antony Riakiotakis kalast at gmail.com
Mon Aug 19 21:04:39 CEST 2013


Revision: 59309
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59309
Author:   psy-fi
Date:     2013-08-19 19:04:39 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
Minor optimization for paint systems, initialize the paint curve before
the stroke and skip checking for initialization each time we request the
curve value.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/brush.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c

Modified: trunk/blender/source/blender/blenkernel/intern/brush.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/brush.c	2013-08-19 18:37:00 UTC (rev 59308)
+++ trunk/blender/source/blender/blenkernel/intern/brush.c	2013-08-19 19:04:39 UTC (rev 59309)
@@ -951,7 +951,6 @@
 	if (p >= len) return 0;
 	else p = p / len;
 
-	curvemapping_initialize(br->curve);
 	strength = curvemapping_evaluateF(br->curve, 0, p);
 
 	CLAMP(strength, 0.0f, 1.0f);
@@ -967,7 +966,6 @@
 	else
 		p = p / len;
 
-	curvemapping_initialize(br->curve);
 	return curvemapping_evaluateF(br->curve, 0, p);
 }
 

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-08-19 18:37:00 UTC (rev 59308)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image_proj.c	2013-08-19 19:04:39 UTC (rev 59309)
@@ -4279,9 +4279,6 @@
 		return ps;
 	}
 
-	/* needed so multiple threads don't try to initialize the brush at once (can leak memory) */
-	curvemapping_initialize(ps->brush->curve);
-
 	paint_brush_init_tex(ps->brush);
 
 	ps->source = PROJ_SRC_VIEW;

Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-08-19 18:37:00 UTC (rev 59308)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c	2013-08-19 19:04:39 UTC (rev 59309)
@@ -46,6 +46,7 @@
 #include "BKE_context.h"
 #include "BKE_paint.h"
 #include "BKE_brush.h"
+#include "BKE_colortools.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -477,6 +478,9 @@
 	stroke->redraw = redraw;
 	stroke->done = done;
 	stroke->event_type = event_type; /* for modal, return event */
+
+	/* initialize here to avoid initialization conflict with threaded strokes */
+	curvemapping_initialize(br->curve);
 	
 	BKE_paint_set_overlay_override(br->overlay_flags);
 




More information about the Bf-blender-cvs mailing list