[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39281] branches/soc-2011-onion/source/ blender/editors/sculpt_paint/paint_uv.c: mini optimization to avoid conditional in the loop

Antony Riakiotakis kalast at gmail.com
Thu Aug 11 01:28:26 CEST 2011


Revision: 39281
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39281
Author:   psy-fi
Date:     2011-08-10 23:28:26 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
mini optimization to avoid conditional in the loop

Modified Paths:
--------------
    branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c

Modified: branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c
===================================================================
--- branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c	2011-08-10 23:23:36 UTC (rev 39280)
+++ branches/soc-2011-onion/source/blender/editors/sculpt_paint/paint_uv.c	2011-08-10 23:28:26 UTC (rev 39281)
@@ -347,11 +347,11 @@
 	EditFace *efa;
 	SmoothBrushData *smoothbrushdata = (SmoothBrushData *)op->customdata;
 	SpaceImage *sima;
-	char invert;
+	int invert;
 	int width, height;
 	float aspectRatio;
 	Brush *brush = paint_brush(smoothbrushdata->uvpaint);
-	invert = RNA_boolean_get(op->ptr, "invert");
+	invert = RNA_boolean_get(op->ptr, "invert")? -1 : 1;
 
 	UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &co[0], &co[1]);
 
@@ -375,13 +375,8 @@
 				float strength;
 				strength = brush_alpha(brush)*brush_curve_strength(brush, dist, radius);
 				normalize_v2(diff);
-				if(invert){
-					mt->uv[i][0] += strength*diff[0]*0.001;
-					mt->uv[i][1] += strength*diff[1]*0.001;
-				}else{
-					mt->uv[i][0] -= strength*diff[0]*0.001;
-					mt->uv[i][1] -= strength*diff[1]*0.001;
-				}
+				mt->uv[i][0] -= invert*strength*diff[0]*0.001;
+				mt->uv[i][1] -= invert*strength*diff[1]*0.001;
 			}
 		}
 	}




More information about the Bf-blender-cvs mailing list