[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47295] branches/soc-2011-tomato/intern/ raskter/raskter.c: speedup normalized buffer space pixel position calculations...

Peter Larabell xgl.asyliax at gmail.com
Thu May 31 21:53:35 CEST 2012


Revision: 47295
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47295
Author:   xglasyliax
Date:     2012-05-31 19:53:35 +0000 (Thu, 31 May 2012)
Log Message:
-----------
speedup normalized buffer space pixel position calculations... now incremental adds rather than full per pixel evaluation.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/raskter/raskter.c

Modified: branches/soc-2011-tomato/intern/raskter/raskter.c
===================================================================
--- branches/soc-2011-tomato/intern/raskter/raskter.c	2012-05-31 19:17:17 UTC (rev 47294)
+++ branches/soc-2011-tomato/intern/raskter/raskter.c	2012-05-31 19:53:35 UTC (rev 47295)
@@ -464,8 +464,9 @@
 	float idist;                    // idist = current inner edge distance
 	float dx;                         // dx = X-delta (used for distance proportion calculation)
 	float dy;                         // dy = Y-delta (used for distance proportion calculation)
+	float xpxw;
+	float ypxh;
 
-
 	/*
 	 * If the number of verts specified to render as a polygon is less than 3,
 	 * return immediately. Obviously we cant render a poly with sides < 3. The
@@ -587,17 +588,21 @@
 			mpxl = spxl + MIN2(e_curr->x, ctx->rb.sizex) - 1;
 
 			if ((y_curr >= 0) && (y_curr < ctx->rb.sizey)) {
+				xpxw = (1.0f / (float)(ctx->rb.sizex));
+				ypxh = (1.0f / (float)(ctx->rb.sizey));
+				t = ((float)((cpxl - spxl) % ctx->rb.sizex) + 0.5f) * xpxw;
+				fsz = ((float)(y_curr) + 0.5f) * ypxh;
 				/* draw the pixels. */
-				for (; cpxl <= mpxl; cpxl++) {
+				for (; cpxl <= mpxl; cpxl++, t += xpxw) {
 					//do feather check
 					// first check that pixel isn't already full, and only operate if it is not
 					if (*cpxl < 0.9999f) {
 /*
  * Begin modified code from double edge mask compo node...
  */
-						t = ((float)((cpxl - spxl) % ctx->rb.sizex) + 0.5f) * (1.0f / (float)(ctx->rb.sizex));      // calculate column of pixel
+						//t = ((float)((cpxl - spxl) % ctx->rb.sizex) + 0.5f) * (1.0f / (float)(ctx->rb.sizex));      // calculate column of pixel
 
-						fsz = ((float)(y_curr) + 0.5) * (1.0f / (float)(ctx->rb.sizey)); // calculate row of pixel
+						//fsz = ((float)(y_curr) + 0.5) * (1.0f / (float)(ctx->rb.sizey)); // calculate row of pixel
 
 
 						dmin = 2.0f;                        // reset min distance to edge pixel




More information about the Bf-blender-cvs mailing list