[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [47835] trunk/blender/source/blender/ compositor/operations: style cleanup

Campbell Barton ideasman42 at gmail.com
Wed Jun 13 16:33:51 CEST 2012


Revision: 47835
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47835
Author:   campbellbarton
Date:     2012-06-13 14:33:50 +0000 (Wed, 13 Jun 2012)
Log Message:
-----------
style cleanup

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.h
    trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.h
    trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h
    trunk/blender/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GlareStreaksOperation.h
    trunk/blender/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_GlareThresholdOperation.h

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.cpp	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.cpp	2012-06-13 14:33:50 UTC (rev 47835)
@@ -23,7 +23,7 @@
 #include "COM_GlareBaseOperation.h"
 #include "BLI_math.h"
 
-GlareBaseOperation::GlareBaseOperation(): SingleThreadedNodeOperation()
+GlareBaseOperation::GlareBaseOperation() : SingleThreadedNodeOperation()
 {
 	this->addInputSocket(COM_DT_COLOR);
 	this->addOutputSocket(COM_DT_COLOR);
@@ -43,7 +43,7 @@
 
 MemoryBuffer *GlareBaseOperation::createMemoryBuffer(rcti *rect2, MemoryBuffer **memoryBuffers)
 {
-	MemoryBuffer *tile = (MemoryBuffer*)inputProgram->initializeTileData(rect2, memoryBuffers);
+	MemoryBuffer *tile = (MemoryBuffer *)inputProgram->initializeTileData(rect2, memoryBuffers);
 	rcti rect;
 	rect.xmin = 0;
 	rect.ymin = 0;

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.h	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareBaseOperation.h	2012-06-13 14:33:50 UTC (rev 47835)
@@ -15,8 +15,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor: 
- *		Jeroen Bakker 
+ * Contributor:
+ *		Jeroen Bakker
  *		Monique Dewanchand
  */
 
@@ -59,34 +59,36 @@
 class GlareBaseOperation : public SingleThreadedNodeOperation {
 private:
 	/**
-	  * @brief Cached reference to the inputProgram
-	  */
-	SocketReader * inputProgram;
-	
+	 * @brief Cached reference to the inputProgram
+	 */
+	SocketReader *inputProgram;
+
 	/**
-	  * @brief settings of the glare node.
-	  */
-	NodeGlare * settings;
+	 * @brief settings of the glare node.
+	 */
+	NodeGlare *settings;
 public:
 	/**
-	  * Initialize the execution
-	  */
+	 * Initialize the execution
+	 */
 	void initExecution();
-	
+
 	/**
-	  * Deinitialize the execution
-	  */
+	 * Deinitialize the execution
+	 */
 	void deinitExecution();
 
-	void setGlareSettings(NodeGlare * settings) {this->settings = settings;}
+	void setGlareSettings(NodeGlare *settings) {
+		this->settings = settings;
+	}
 	bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
-	
+
 protected:
 	GlareBaseOperation();
-	
+
 	virtual void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings) = 0;
-	
+
 	MemoryBuffer *createMemoryBuffer(rcti *rect, MemoryBuffer **memoryBuffers);
-	
+
 };
 #endif

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.cpp	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.cpp	2012-06-13 14:33:50 UTC (rev 47835)
@@ -15,8 +15,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor: 
- *		Jeroen Bakker 
+ * Contributor:
+ *		Jeroen Bakker
  *		Monique Dewanchand
  */
 
@@ -27,12 +27,16 @@
 static float smoothMask(float x, float y)
 {
 	float t;
-	x = 2.f * x - 1.f, y = 2.f * y - 1.f;
-	if ((t = 1.f - sqrtf(x * x + y * y)) <= 0.f) return 0.f;
-	return t;
+	x = 2.0f * x - 1.0f;
+	y = 2.0f * y - 1.0f;
+	if ((t = 1.0f - sqrtf(x * x + y * y)) > 0.0f) {
+		return t;
+	}
+	else {
+		return 0.0f;
+	}
 }
 
-
 void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)
 {
 	const int qt = 1 << settings->quality;

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.h	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareGhostOperation.h	2012-06-13 14:33:50 UTC (rev 47835)
@@ -15,8 +15,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor: 
- *		Jeroen Bakker 
+ * Contributor:
+ *		Jeroen Bakker
  *		Monique Dewanchand
  */
 
@@ -28,7 +28,8 @@
 
 class GlareGhostOperation : public GlareBaseOperation {
 public:
-	GlareGhostOperation() : GlareBaseOperation() {}
+	GlareGhostOperation() : GlareBaseOperation() {
+	}
 protected:
 	void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings);
 };

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.cpp	2012-06-13 14:33:50 UTC (rev 47835)
@@ -15,8 +15,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor: 
- *		Jeroen Bakker 
+ * Contributor:
+ *		Jeroen Bakker
  *		Monique Dewanchand
  */
 
@@ -25,21 +25,21 @@
 void GlareSimpleStarOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)
 {
 	int i, x, y, ym, yp, xm, xp;
-	float c[4] = {0,0,0,0}, tc[4] = {0,0,0,0};
-	const float f1 = 1.f - settings->fade, f2 = (1.f - f1)*0.5f;
+	float c[4] = {0, 0, 0, 0}, tc[4] = {0, 0, 0, 0};
+	const float f1 = 1.0f - settings->fade;
+	const float f2 = (1.0f - f1) * 0.5f;
 
-
 	MemoryBuffer *tbuf1 = inputTile->duplicate();
 	MemoryBuffer *tbuf2 = inputTile->duplicate();
 
 	bool breaked = false;
-	for (i=0; i<settings->iter && (!breaked); i++) {
+	for (i = 0; i < settings->iter && (!breaked); i++) {
 //		// (x || x-1, y-1) to (x || x+1, y+1)
 //		// F
-		for (y=0; y<this->getHeight() && (!breaked); y++) {
+		for (y = 0; y < this->getHeight() && (!breaked); y++) {
 			ym = y - i;
 			yp = y + i;
-			for (x=0; x<this->getWidth(); x++) {
+			for (x = 0; x < this->getWidth(); x++) {
 				xm = x - i;
 				xp = x + i;
 				tbuf1->read(c, x, y);
@@ -65,10 +65,10 @@
 			}
 		}
 //		// B
-		for (y=tbuf1->getHeight()-1 && (!breaked); y>=0; y--) {
+		for (y = tbuf1->getHeight() - 1 && (!breaked); y >= 0; y--) {
 			ym = y - i;
 			yp = y + i;
-			for (x=tbuf1->getWidth()-1; x>=0; x--) {
+			for (x = tbuf1->getWidth() - 1; x >= 0; x--) {
 				xm = x - i;
 				xp = x + i;
 				tbuf1->read(c, x, y);
@@ -95,7 +95,7 @@
 		}
 	}
 
-	for (i = 0 ; i < this->getWidth()*this->getHeight()*4 ; i++) {
+	for (i = 0; i < this->getWidth() * this->getHeight() * 4; i++) {
 		data[i] = tbuf1->getBuffer()[i] + tbuf2->getBuffer()[i];
 	}
 

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareSimpleStarOperation.h	2012-06-13 14:33:50 UTC (rev 47835)
@@ -15,8 +15,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor: 
- *		Jeroen Bakker 
+ * Contributor:
+ *		Jeroen Bakker
  *		Monique Dewanchand
  */
 
@@ -28,7 +28,8 @@
 
 class GlareSimpleStarOperation : public GlareBaseOperation {
 public:
-	GlareSimpleStarOperation() : GlareBaseOperation() {}
+	GlareSimpleStarOperation() : GlareBaseOperation() {
+	}
 protected:
 	void generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings);
 };

Modified: trunk/blender/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp	2012-06-13 14:27:56 UTC (rev 47834)
+++ trunk/blender/source/blender/compositor/operations/COM_GlareStreaksOperation.cpp	2012-06-13 14:33:50 UTC (rev 47835)
@@ -15,8 +15,8 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Contributor: 
- *		Jeroen Bakker 
+ * Contributor:
+ *		Jeroen Bakker
  *		Monique Dewanchand
  */
 
@@ -26,73 +26,73 @@
 void GlareStreaksOperation::generateGlare(float *data, MemoryBuffer *inputTile, NodeGlare *settings)
 {
 	int x, y, n;
-	unsigned int nump=0;
+	unsigned int nump = 0;
 	float c1[4], c2[4], c3[4], c4[4];
-	float a, ang = DEG2RADF(360.0f)/(float)settings->angle;
-	
-	int size = inputTile->getWidth()*inputTile->getHeight();
-	int size4 = size*4;
+	float a, ang = DEG2RADF(360.0f) / (float)settings->angle;
 
+	int size = inputTile->getWidth() * inputTile->getHeight();
+	int size4 = size * 4;
+
 	bool breaked = false;
-	
+
 	MemoryBuffer *tsrc = inputTile->duplicate();
 	MemoryBuffer *tdst = new MemoryBuffer(NULL, inputTile->getRect());
 	tdst->clear();
-	memset(data, 0, size4*sizeof(float));
-	
-	for (a=0.f; a<DEG2RADF(360.0f) && (!breaked); a+=ang) {
+	memset(data, 0, size4 * sizeof(float));
+
+	for (a = 0.f; a < DEG2RADF(360.0f) && (!breaked); a += ang) {
 		const float an = a + settings->angle_ofs;
 		const float vx = cos((double)an), vy = sin((double)an);
-		for (n=0; n<settings->iter && (!breaked); ++n) {
+		for (n = 0; n < settings->iter && (!breaked); ++n) {
 			const float p4 = pow(4.0, (double)n);
-			const float vxp = vx*p4, vyp = vy*p4;
+			const float vxp = vx * p4, vyp = vy * p4;
 			const float wt = pow((double)settings->fade, (double)p4);
-			const float cmo = 1.f - (float)pow((double)settings->colmod, (double)n+1);	// colormodulation amount relative to current pass
+			const float cmo = 1.f - (float)pow((double)settings->colmod, (double)n + 1);  // colormodulation amount relative to current pass
 			float *tdstcol = tdst->getBuffer();
-			for (y=0; y<tsrc->getHeight() && (!breaked); ++y) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list