Commit: 3a10f8e1b135205f67f7168737ad46ec280f9ad0
Author: Campbell Barton
Date:   Sat Apr 14 22:26:12 2018 +0200
Branches: master
https://developer.blender.org/rB3a10f8e1b135205f67f7168737ad46ec280f9ad0

Cleanup: style

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

M       source/blender/compositor/operations/COM_VectorBlurOperation.cpp

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

diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp 
b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
index bccfe025089..9c04e74a7da 100644
--- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
+++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp
@@ -24,20 +24,20 @@
 #include "MEM_guardedalloc.h"
 #include "BLI_math.h"
 extern "C" {
-       #include "BLI_jitter_2d.h"
+#include "BLI_jitter_2d.h"
 }
 #include "COM_VectorBlurOperation.h"
 
 
 /* Defined */
-#define PASS_VECTOR_MAX        10000.0f
+#define PASS_VECTOR_MAX 10000.0f
 
 /* Forward declarations */
 struct ZSpan;
 struct DrawBufPixel;
 void zbuf_accumulate_vecblur(
-               NodeBlurData *nbd, int xsize, int ysize, float *newrect,
-               const float *imgrect, float *vecbufrect, const float *zbufrect);
+        NodeBlurData *nbd, int xsize, int ysize, float *newrect,
+        const float *imgrect, float *vecbufrect, const float *zbufrect);
 void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, float clipcrop);
 void zbuf_free_span(ZSpan *zspan);
 void antialias_tagbuf(int xsize, int ysize, char *rectmove);
@@ -70,7 +70,7 @@ void VectorBlurOperation::initExecution()
 
 void VectorBlurOperation::executePixel(float output[4], int x, int y, void 
*data)
 {
-       float *buffer = (float *) data;
+       float *buffer = (float *)data;
        int index = (y * this->getWidth() + x) * COM_NUM_CHANNELS_COLOR;
        copy_v4_v4(output, &buffer[index]);
 }
@@ -148,7 +148,7 @@ typedef struct ZSpan {
        float zmulx, zmuly, zofsx, zofsy;
 
        int *rectz;
-       DrawBufPixel* rectdraw;
+       DrawBufPixel *rectdraw;
        float clipcrop;
 
 } ZSpan;
@@ -158,13 +158,13 @@ void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty, 
float clipcrop)
 {
        memset(zspan, 0, sizeof(ZSpan));
 
-       zspan->rectx= rectx;
-       zspan->recty= recty;
+       zspan->rectx = rectx;
+       zspan->recty = recty;
 
-       zspan->span1= (float*)MEM_mallocN(recty*sizeof(float), "zspan");
-       zspan->span2= (float*)MEM_mallocN(recty*sizeof(float), "zspan");
+       zspan->span1 = (float *)MEM_mallocN(recty * sizeof(float), "zspan");
+       zspan->span2 = (float *)MEM_mallocN(recty * sizeof(float), "zspan");
 
-       zspan->clipcrop= clipcrop;
+       zspan->clipcrop = clipcrop;
 }
 
 void zbuf_free_span(ZSpan *zspan)
@@ -172,16 +172,16 @@ void zbuf_free_span(ZSpan *zspan)
        if (zspan) {
                if (zspan->span1) MEM_freeN(zspan->span1);
                if (zspan->span2) MEM_freeN(zspan->span2);
-               zspan->span1= zspan->span2= NULL;
+               zspan->span1 = zspan->span2 = NULL;
        }
 }
 
 /* reset range for clipping */
 static void zbuf_init_span(ZSpan *zspan)
 {
-       zspan->miny1= zspan->miny2= zspan->recty+1;
-       zspan->maxy1= zspan->maxy2= -1;
-       zspan->minp1= zspan->maxp1= zspan->minp2= zspan->maxp2= NULL;
+       zspan->miny1 = zspan->miny2 = zspan->recty + 1;
+       zspan->maxy1 = zspan->maxy2 = -1;
+       zspan->minp1 = zspan->maxp1 = zspan->minp2 = zspan->maxp2 = NULL;
 }
 
 static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float 
v2[2])
@@ -191,30 +191,30 @@ static void zbuf_add_to_span(ZSpan *zspan, const float 
v1[2], const float v2[2])
        float xx1, dx0, xs0;
        int y, my0, my2;
 
-       if (v1[1]<v2[1]) {
-               minv= v1; maxv= v2;
+       if (v1[1] < v2[1]) {
+               minv = v1; maxv = v2;
        }
        else {
-               minv= v2; maxv= v1;
+               minv = v2; maxv = v1;
        }
 
-       my0= ceil(minv[1]);
-       my2= floor(maxv[1]);
+       my0 = ceil(minv[1]);
+       my2 = floor(maxv[1]);
 
-       if (my2<0 || my0>= zspan->recty) return;
+       if (my2 < 0 || my0 >= zspan->recty) return;
 
        /* clip top */
-       if (my2>=zspan->recty) my2= zspan->recty-1;
+       if (my2 >= zspan->recty) my2 = zspan->recty - 1;
        /* clip bottom */
-       if (my0<0) my0= 0;
+       if (my0 < 0) my0 = 0;
 
-       if (my0>my2) return;
+       if (my0 > my2) return;
        /* if (my0>my2) should still fill in, that way we get spans that skip 
nicely */
 
-       xx1= maxv[1]-minv[1];
-       if (xx1>FLT_EPSILON) {
-               dx0= (minv[0]-maxv[0])/xx1;
-               xs0= dx0*(minv[1]-my2) + minv[0];
+       xx1 = maxv[1] - minv[1];
+       if (xx1 > FLT_EPSILON) {
+               dx0 = (minv[0] - maxv[0]) / xx1;
+               xs0 = dx0 * (minv[1] - my2) + minv[0];
        }
        else {
                dx0 = 0.0f;
@@ -223,43 +223,43 @@ static void zbuf_add_to_span(ZSpan *zspan, const float 
v1[2], const float v2[2])
 
        /* empty span */
        if (zspan->maxp1 == NULL) {
-               span= zspan->span1;
+               span = zspan->span1;
        }
-       else {  /* does it complete left span? */
-               if ( maxv == zspan->minp1 || minv==zspan->maxp1) {
-                       span= zspan->span1;
+       else {  /* does it complete left span? */
+               if (maxv == zspan->minp1 || minv == zspan->maxp1) {
+                       span = zspan->span1;
                }
                else {
-                       span= zspan->span2;
+                       span = zspan->span2;
                }
        }
 
-       if (span==zspan->span1) {
+       if (span == zspan->span1) {
 //             printf("left span my0 %d my2 %d\n", my0, my2);
-               if (zspan->minp1==NULL || zspan->minp1[1] > minv[1] ) {
-                       zspan->minp1= minv;
+               if (zspan->minp1 == NULL || zspan->minp1[1] > minv[1]) {
+                       zspan->minp1 = minv;
                }
-               if (zspan->maxp1==NULL || zspan->maxp1[1] < maxv[1] ) {
-                       zspan->maxp1= maxv;
+               if (zspan->maxp1 == NULL || zspan->maxp1[1] < maxv[1]) {
+                       zspan->maxp1 = maxv;
                }
-               if (my0<zspan->miny1) zspan->miny1= my0;
-               if (my2>zspan->maxy1) zspan->maxy1= my2;
+               if (my0 < zspan->miny1) zspan->miny1 = my0;
+               if (my2 > zspan->maxy1) zspan->maxy1 = my2;
        }
        else {
 //             printf("right span my0 %d my2 %d\n", my0, my2);
-               if (zspan->minp2==NULL || zspan->minp2[1] > minv[1] ) {
-                       zspan->minp2= minv;
+               if (zspan->minp2 == NULL || zspan->minp2[1] > minv[1]) {
+                       zspan->minp2 = minv;
                }
-               if (zspan->maxp2==NULL || zspan->maxp2[1] < maxv[1] ) {
-                       zspan->maxp2= maxv;
+               if (zspan->maxp2 == NULL || zspan->maxp2[1] < maxv[1]) {
+                       zspan->maxp2 = maxv;
                }
-               if (my0<zspan->miny2) zspan->miny2= my0;
-               if (my2>zspan->maxy2) zspan->maxy2= my2;
+               if (my0 < zspan->miny2) zspan->miny2 = my0;
+               if (my2 > zspan->maxy2) zspan->maxy2 = my2;
        }
 
-       for (y=my2; y>=my0; y--, xs0+= dx0) {
+       for (y = my2; y >= my0; y--, xs0 += dx0) {
                /* xs0 is the xcoord! */
-               span[y]= xs0;
+               span[y] = xs0;
        }
 }
 
@@ -292,79 +292,79 @@ static void zbuf_fill_in_rgba(ZSpan *zspan, DrawBufPixel 
*col, float *v1, float
        zbuf_add_to_span(zspan, v4, v1);
 
        /* clipped */
-       if (zspan->minp2==NULL || zspan->maxp2==NULL) return;
+       if (zspan->minp2 == NULL || zspan->maxp2 == NULL) return;
 
        my0 = max_ii(zspan->miny1, zspan->miny2);
        my2 = min_ii(zspan->maxy1, zspan->maxy2);
 
        //      printf("my %d %d\n", my0, my2);
-       if (my2<my0) return;
+       if (my2 < my0) return;
 
        /* ZBUF DX DY, in floats still */
-       x1= v1[0]- v2[0];
-       x2= v2[0]- v3[0];
-       y1= v1[1]- v2[1];
-       y2= v2[1]- v3[1];
-       z1= v1[2]- v2[2];
-       z2= v2[2]- v3[2];
-       x0= y1*z2-z1*y2;
-       y0= z1*x2-x1*z2;
-       z0= x1*y2-y1*x2;
+       x1 = v1[0] - v2[0];
+       x2 = v2[0] - v3[0];
+       y1 = v1[1] - v2[1];
+       y2 = v2[1] - v3[1];
+       z1 = v1[2] - v2[2];
+       z2 = v2[2] - v3[2];
+       x0 = y1 * z2 - z1 * y2;
+       y0 = z1 * x2 - x1 * z2;
+       z0 = x1 * y2 - y1 * x2;
 
-       if (z0==0.0f) return;
+       if (z0 == 0.0f) return;
 
-       xx1= (x0*v1[0] + y0*v1[1])/z0 + v1[2];
+       xx1 = (x0 * v1[0] + y0 * v1[1]) / z0 + v1[2];
 
-       zxd= -(double)x0/(double)z0;
-       zyd= -(double)y0/(double)z0;
-       zy0= ((double)my2)*zyd + (double)xx1;
+       zxd = -(double)x0 / (double)z0;
+       zyd = -(double)y0 / (double)z0;
+       zy0 = ((double)my2) * zyd + (double)xx1;
 
        /* start-offset in rect */
-       rectx= zspan->rectx;
-       rectzofs= (float *)(zspan->rectz + rectx*my2);
-       rectpofs= ((DrawBufPixel *)zspan->rectdraw) + rectx*my2;
+       rectx = zspan->rectx;
+       rectzofs = (float *)(zspan->rectz + rectx * my2);
+       rectpofs = ((DrawBufPixel *)zspan->rectdraw) + rectx * my2;
 
        /* correct span */
-       sn1= (my0 + my2)/2;
+       sn1 = (my0 + my2) / 2;
        if (zspan->span1[sn1] < zspan->span2[sn1]) {
-               span1= zspan->span1+my2;
-               span2= zspan->span2+my2;
+               span1 = zspan->span1 + my2;
+               span2 = zspan->span2 + my2;
        }
        else {
-               span1= zspan->span2+my2;
-               span2= zspan->span1+my2;
+               span1 = zspan->span2 + my2;
+               span2 = zspan->span1 + my2;
        }
 
-       for (y=my2; y>=my0; y--, span1--, span2--) {
+       for (y = my2; y >= my0; y--, span1--, span2--) {
 
-               sn1= floor(*span1);
-               sn2= floor(*span2);
+               sn1 = floor(*span1);
+               sn2 = floor(*span2);
                sn1++;
 
-               if (sn2>=rectx) sn2= rectx-1;
-               if (sn1<0) sn1= 0;
+               if (sn2 >= rectx) sn2 = rectx - 1;
+               if (sn1 < 0) sn1 = 0;
 
-               if (sn2>=sn1) {
-                       zverg= (double)sn1*zxd + zy0;
-                       rz= rectzofs+sn1;
-                       rp= rectpofs+sn1;
-                       x= sn2-sn1;
+               if (sn2 >= sn1) {
+                       zverg = (double)sn1 * zxd + zy0;
+                       rz = rectzofs + sn1;
+                       rp = rectpofs + sn1;
+                       x = sn2 - sn1;
 
-                       while (x>=0) {
+                       while (x >= 0) {
                                if (zverg < (double)*rz) {
-                                       *rz= zverg;
-                                       *rp= *col;
+                                       *rz = zverg;
+                                       *rp = *col;
                                }
-                               zverg+= zxd;
+                               zverg += zxd;
                                rz++;
                                rp++;
                                x--;
                        }
                }
 
-               zy0-=zyd;
-               rectzofs-= rectx;
-               rectpofs-= rectx;
+               zy0 -= zyd;
+               rectzofs -= rectx;
+               rectpofs -= rectx;
        }
 }
 
@@ -377,43 +377,43 @@ void antialias_tagbuf(int xsize, int ysize, char 
*rectmove)
        int a, x, y, step;
 
        /* 1: tag pixels to be candidate for AA */
-       for (y=2; y<ysize; y++) {
+       for (y = 2; y < ysize; y++) {
                /* setup rows */
-               row1= rectmove + (y-2)*xsize;
-               row2= row1 + xsize;
-               row3= row2 + xsize;
-               for (x=2; x<xsize; x++, row1++, row2++, row3++) {
+               row1 = rectmove + (y - 2) * xsize;
+               row2 = row1 + xsize;
+               row3 = row2 + xsize;
+               for (x = 2; x < xsize; x++, row1++, row2++, row3++) {
                        if (row2[1]) {
-                               if (row2[0]==0 || row2[2]==0 || row1[1]==0 || 
row3[1]==0)
-                                       row2[1]= 128;
+                               if (row2[0] == 0 || row2[2] == 0 || row1[1] == 
0 || row3[1] == 0)
+                                       row2[1] = 128;
                        }
                }
        }
 
        /* 2: evaluate horizontal scanlines and calculate alphas */
-       row1= rectmove;
-       for (y=0; y<ysize; y++) {
+       row1 = rectmove;
+       for (y = 0; y < ysize; y++) {
                row1++;
-               for (x=1; x<xsize; x++, row1++) {
-                       if (row1[0]==128 && row1[1]==128) {
+               for (x = 1; x < xsize; x++, row1++) {
+                       if (row1[0] == 128 && row1[1] == 128) {
                                /* find previous color and next color and 
amount of steps to blend */
-                               prev= row1[-1];
-                               step= 1;
-                               while (x+step<xsize && row1[step]==128)
+                               prev = row1[-1];
+                               step = 1;
+                               while (x + step < xsize && row1[step] == 128)
                                        step++;
 
-                               if (x+step!=xsize) {
+                               if (x + step != xsize) {
                                        /* now we can blend values */
-                                       next= row1[step];
+                                       next = row1[step];
 
                                        /

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to