[Bf-blender-cvs] [fea07c1] master: Cleanup: unnecessary comma use

Campbell Barton noreply at git.blender.org
Fri Mar 4 23:26:58 CET 2016


Commit: fea07c1a63fdfe3bf25d77d862e83bdf024347b8
Author: Campbell Barton
Date:   Sat Mar 5 09:13:16 2016 +1100
Branches: master
https://developer.blender.org/rBfea07c1a63fdfe3bf25d77d862e83bdf024347b8

Cleanup: unnecessary comma use

Also use SWAP macro

===================================================================

M	source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
M	source/blender/compositor/operations/COM_GlareGhostOperation.cpp
M	source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
M	source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
M	source/blender/compositor/operations/COM_TrackPositionOperation.h

===================================================================

diff --git a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
index d452a74..fe28644 100644
--- a/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
@@ -126,7 +126,6 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
                   unsigned int nzp, unsigned int inverse)
 {
 	unsigned int i, j, Nx, Ny, maxy;
-	fREAL t;
 
 	Nx = 1 << Mx;
 	Ny = 1 << My;
@@ -141,7 +140,7 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
 		for (j = 0; j < Ny; ++j)
 			for (i = j + 1; i < Nx; ++i) {
 				unsigned int op = i + (j << Mx), np = j + (i << My);
-				t = data[op], data[op] = data[np], data[np] = t;
+				SWAP(fREAL, data[op], data[np]);
 			}
 	}
 	else {  // rectangular
@@ -151,15 +150,15 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
 			for (j = PRED(i); j > i; j = PRED(j)) ;
 			if (j < i) continue;
 			for (k = i, j = PRED(i); j != i; k = j, j = PRED(j), stm--) {
-				t = data[j], data[j] = data[k], data[k] = t;
+				SWAP(fREAL, data[j], data[k]);
 			}
 #undef PRED
 			stm--;
 		}
 	}
-	// swap Mx/My & Nx/Ny
-	i = Nx, Nx = Ny, Ny = i;
-	i = Mx, Mx = My, My = i;
+
+	SWAP(unsigned int, Nx, Ny);
+	SWAP(unsigned int, Mx, My);
 
 	// now columns == transposed rows
 	for (j = 0; j < Ny; ++j)
@@ -391,7 +390,9 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
 			u = 2.0f * (x / (float)sz) - 1.0f;
 			r = (u * u + v * v) * scale;
 			d = -sqrtf(sqrtf(sqrtf(r))) * 9.0f;
-			fcol[0] = expf(d * cs_r), fcol[1] = expf(d * cs_g), fcol[2] = expf(d * cs_b);
+			fcol[0] = expf(d * cs_r);
+			fcol[1] = expf(d * cs_g);
+			fcol[2] = expf(d * cs_b);
 			// linear window good enough here, visual result counts, not scientific analysis
 			//w = (1.0f-fabs(u))*(1.0f-fabs(v));
 			// actually, Hanning window is ok, cos^2 for some reason is slower
diff --git a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
index 9bef5ac..1c515f8 100644
--- a/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareGhostOperation.cpp
@@ -82,11 +82,13 @@ void GlareGhostOperation::generateGlare(float *data, MemoryBuffer *inputTile, No
 		v = ((float)y + 0.5f) / (float)gbuf->getHeight();
 		for (x = 0; x < gbuf->getWidth(); x++) {
 			u = ((float)x + 0.5f) / (float)gbuf->getWidth();
-			s = (u - 0.5f) * sc + 0.5f, t = (v - 0.5f) * sc + 0.5f;
+			s = (u - 0.5f) * sc + 0.5f;
+			t = (v - 0.5f) * sc + 0.5f;
 			tbuf1->readBilinear(c, s * gbuf->getWidth(), t * gbuf->getHeight());
 			sm = smoothMask(s, t);
 			mul_v3_fl(c, sm);
-			s = (u - 0.5f) * isc + 0.5f, t = (v - 0.5f) * isc + 0.5f;
+			s = (u - 0.5f) * isc + 0.5f;
+			t = (v - 0.5f) * isc + 0.5f;
 			tbuf2->readBilinear(tc, s * gbuf->getWidth() - 0.5f, t * gbuf->getHeight() - 0.5f);
 			sm = smoothMask(s, t);
 			madd_v3_v3fl(c, tc, sm);
diff --git a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
index d2bd7cb..f54e75a 100644
--- a/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
+++ b/source/blender/compositor/operations/COM_GlareThresholdOperation.cpp
@@ -52,7 +52,10 @@ void GlareThresholdOperation::executePixelSampled(float output[4], float x, floa
 	
 	this->m_inputProgram->readSampled(output, x, y, sampler);
 	if (IMB_colormanagement_get_luminance(output) >= threshold) {
-		output[0] -= threshold, output[1] -= threshold, output[2] -= threshold;
+		output[0] -= threshold;
+		output[1] -= threshold;
+		output[2] -= threshold;
+
 		output[0] = max(output[0], 0.0f);
 		output[1] = max(output[1], 0.0f);
 		output[2] = max(output[2], 0.0f);
diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
index acd76fa..e0e5e92 100644
--- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
+++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp
@@ -149,9 +149,10 @@ void ScreenLensDistortionOperation::accumulate(MemoryBuffer *buffer,
 		distort_uv(uv, t, xy);
 		buffer->readBilinear(color, xy[0], xy[1]);
 		
-		sum[a] += (1.0f - tz) * color[a], sum[b] += tz * color[b];
-		++count[a];
-		++count[b];
+		sum[a] += (1.0f - tz) * color[a];
+		sum[b] += (tz       ) * color[b];
+		count[a]++;
+		count[b]++;
 	}
 }
 
diff --git a/source/blender/compositor/operations/COM_TrackPositionOperation.h b/source/blender/compositor/operations/COM_TrackPositionOperation.h
index a5a58ad..87bb062 100644
--- a/source/blender/compositor/operations/COM_TrackPositionOperation.h
+++ b/source/blender/compositor/operations/COM_TrackPositionOperation.h
@@ -68,7 +68,7 @@ public:
 	void setAxis(int value) {this->m_axis = value;}
 	void setPosition(int value) {this->m_position = value;}
 	void setRelativeFrame(int value) {this->m_relativeFrame = value;}
-	void setSpeedOutput(bool speed_output) {this->m_speed_output = speed_output;};
+	void setSpeedOutput(bool speed_output) {this->m_speed_output = speed_output;}
 
 	void initExecution();




More information about the Bf-blender-cvs mailing list