Revision: 47965
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=47965
Author:   campbellbarton
Date:     2012-06-15 15:04:56 +0000 (Fri, 15 Jun 2012)
Log Message:
-----------
style cleanup

Modified Paths:
--------------
    trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
    
trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_dilate.c

Modified: trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp       
2012-06-15 15:01:32 UTC (rev 47964)
+++ trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp       
2012-06-15 15:04:56 UTC (rev 47965)
@@ -27,11 +27,11 @@
 #include "COM_AntiAliasOperation.h"
 #include "BLI_math.h"
 
-DilateErodeNode::DilateErodeNode(bNode *editorNode): Node(editorNode)
+DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode)
 {
 }
 
-void DilateErodeNode::convertToOperations(ExecutionSystem *graph, 
CompositorContext * context)
+void DilateErodeNode::convertToOperations(ExecutionSystem *graph, 
CompositorContext *context)
 {
        
        bNode *editorNode = this->getbNode();
@@ -43,7 +43,7 @@
                
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, 
graph);
        
                if (editorNode->custom3 < 2.0f) {
-                       AntiAliasOperation * antiAlias = new 
AntiAliasOperation();
+                       AntiAliasOperation *antiAlias = new 
AntiAliasOperation();
                        addLink(graph, operation->getOutputSocket(), 
antiAlias->getInputSocket(0));
                        
this->getOutputSocket(0)->relinkConnections(antiAlias->getOutputSocket(0));
                        graph->addOperation(antiAlias);
@@ -55,14 +55,14 @@
        }
        else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) {
                if (editorNode->custom2 > 0) {
-                       DilateDistanceOperation * operation = new 
DilateDistanceOperation();
+                       DilateDistanceOperation *operation = new 
DilateDistanceOperation();
                        operation->setDistance(editorNode->custom2);
                        
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, 
graph);
                        
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
                        graph->addOperation(operation);
                }
                else {
-                       ErodeDistanceOperation * operation = new 
ErodeDistanceOperation();
+                       ErodeDistanceOperation *operation = new 
ErodeDistanceOperation();
                        operation->setDistance(-editorNode->custom2);
                        
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, 
graph);
                        
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
@@ -71,14 +71,14 @@
        }
        else {
                if (editorNode->custom2 > 0) {
-                       DilateStepOperation * operation = new 
DilateStepOperation();
+                       DilateStepOperation *operation = new 
DilateStepOperation();
                        operation->setIterations(editorNode->custom2);
                        
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, 
graph);
                        
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
                        graph->addOperation(operation);
                }
                else {
-                       ErodeStepOperation * operation = new 
ErodeStepOperation();
+                       ErodeStepOperation *operation = new 
ErodeStepOperation();
                        operation->setIterations(-editorNode->custom2);
                        
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, 
graph);
                        
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));

Modified: 
trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp
===================================================================
--- 
trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp 
    2012-06-15 15:01:32 UTC (rev 47964)
+++ 
trunk/blender/source/blender/compositor/operations/COM_DilateErodeOperation.cpp 
    2012-06-15 15:04:56 UTC (rev 47965)
@@ -24,7 +24,7 @@
 #include "BLI_math.h"
 
 // DilateErode Distance Threshold
-DilateErodeThresholdOperation::DilateErodeThresholdOperation(): NodeOperation()
+DilateErodeThresholdOperation::DilateErodeThresholdOperation() : 
NodeOperation()
 {
        this->addInputSocket(COM_DT_VALUE);
        this->addOutputSocket(COM_DT_VALUE);
@@ -38,11 +38,11 @@
 {
        this->inputProgram = this->getInputSocketReader(0);
        if (this->distance < 0.0f) {
-               this->scope = - this->distance + this->inset;
+               this->scope = -this->distance + this->inset;
        }
        else {
-               if (this->inset*2 > this->distance) {
-                       this->scope = max(this->inset*2 - this->distance, 
this->distance);
+               if (this->inset * 2 > this->distance) {
+                       this->scope = max(this->inset * 2 - this->distance, 
this->distance);
                }
                else {
                        this->scope = distance;
@@ -67,45 +67,45 @@
        float pixelvalue;
        const float rd = scope * scope;
        const float inset = this->inset;
-       float mindist = rd*2;
+       float mindist = rd * 2;
 
-       MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+       MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
        float *buffer = inputBuffer->getBuffer();
        rcti *rect = inputBuffer->getRect();
        const int minx = max(x - scope, rect->xmin);
        const int miny = max(y - scope, rect->ymin);
        const int maxx = min(x + scope, rect->xmax);
        const int maxy = min(y + scope, rect->ymax);
-       const int bufferWidth = rect->xmax-rect->xmin;
+       const int bufferWidth = rect->xmax - rect->xmin;
        int offset;
 
        this->inputProgram->read(inputValue, x, y, inputBuffers, NULL);
-       if (inputValue[0]>sw) {
-               for (int yi = miny ; yi<maxy;yi++) {
-                       offset = 
((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
-                       for (int xi = minx ; xi<maxx;xi++) {
-                               if (buffer[offset]<sw) {
-                                       const float dx = xi-x;
-                                       const float dy = yi-y;
-                                       const float dis = dx*dx+dy*dy;
+       if (inputValue[0] > sw) {
+               for (int yi = miny; yi < maxy; yi++) {
+                       offset = ((yi - rect->ymin) * bufferWidth + (minx - 
rect->xmin)) * 4;
+                       for (int xi = minx; xi < maxx; xi++) {
+                               if (buffer[offset] < sw) {
+                                       const float dx = xi - x;
+                                       const float dy = yi - y;
+                                       const float dis = dx * dx + dy * dy;
                                        mindist = min(mindist, dis);
                                }
-                               offset +=4;
+                               offset += 4;
                        }
                }
                pixelvalue = -sqrtf(mindist);
        }
        else {
-               for (int yi = miny ; yi<maxy;yi++) {
-                       offset = 
((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
-                       for (int xi = minx ; xi<maxx;xi++) {
-                               if (buffer[offset]>sw) {
-                                       const float dx = xi-x;
-                                       const float dy = yi-y;
-                                       const float dis = dx*dx+dy*dy;
+               for (int yi = miny; yi < maxy; yi++) {
+                       offset = ((yi - rect->ymin) * bufferWidth + (minx - 
rect->xmin)) * 4;
+                       for (int xi = minx; xi < maxx; xi++) {
+                               if (buffer[offset] > sw) {
+                                       const float dx = xi - x;
+                                       const float dy = yi - y;
+                                       const float dis = dx * dx + dy * dy;
                                        mindist = min(mindist, dis);
                                }
-                               offset +=4;
+                               offset += 4;
 
                        }
                }
@@ -119,7 +119,7 @@
                                color[0] = 1.0f;
                        }
                        else {
-                               color[0] = delta/inset;
+                               color[0] = delta / inset;
                        }
                }
                else {
@@ -127,13 +127,13 @@
                }
        }
        else {
-               const float delta = -distance+pixelvalue;
+               const float delta = -distance + pixelvalue;
                if (delta < 0.0f) {
                        if (delta < -inset) {
                                color[0] = 1.0f;
                        }
                        else {
-                               color[0] = (-delta)/inset;
+                               color[0] = (-delta) / inset;
                        }
                }
                else {
@@ -160,7 +160,7 @@
 }
 
 // Dilate Distance
-DilateDistanceOperation::DilateDistanceOperation(): NodeOperation()
+DilateDistanceOperation::DilateDistanceOperation() : NodeOperation()
 {
        this->addInputSocket(COM_DT_VALUE);
        this->addOutputSocket(COM_DT_VALUE);
@@ -189,28 +189,28 @@
        const float distance = this->distance;
        float mindist = distance * distance;
 
-       MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+       MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
        float *buffer = inputBuffer->getBuffer();
        rcti *rect = inputBuffer->getRect();
        const int minx = max(x - scope, rect->xmin);
        const int miny = max(y - scope, rect->ymin);
        const int maxx = min(x + scope, rect->xmax);
        const int maxy = min(y + scope, rect->ymax);
-       const int bufferWidth = rect->xmax-rect->xmin;
+       const int bufferWidth = rect->xmax - rect->xmin;
        int offset;
        
        float value = 0.0f;
 
-       for (int yi = miny ; yi<maxy;yi++) {
-               offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
-               for (int xi = minx ; xi<maxx;xi++) {
-                       const float dx = xi-x;
-                       const float dy = yi-y;
-                       const float dis = dx*dx+dy*dy;
+       for (int yi = miny; yi < maxy; yi++) {
+               offset = ((yi - rect->ymin) * bufferWidth + (minx - 
rect->xmin)) * 4;
+               for (int xi = minx; xi < maxx; xi++) {
+                       const float dx = xi - x;
+                       const float dy = yi - y;
+                       const float dis = dx * dx + dy * dy;
                        if (dis <= mindist) {
                                value = max(buffer[offset], value);
                        }
-                       offset +=4;
+                       offset += 4;
                }
        }
        color[0] = value;
@@ -235,14 +235,14 @@
 
 static cl_kernel dilateKernel = 0;
 void DilateDistanceOperation::executeOpenCL(cl_context context, cl_program 
program, cl_command_queue queue, 
-                                       MemoryBuffer *outputMemoryBuffer, 
cl_mem clOutputBuffer, 
-                                       MemoryBuffer **inputMemoryBuffers, 
list<cl_mem> *clMemToCleanUp, 
-                                       list<cl_kernel> *clKernelsToCleanUp) 
+                                            MemoryBuffer *outputMemoryBuffer, 
cl_mem clOutputBuffer,
+                                            MemoryBuffer **inputMemoryBuffers, 
list<cl_mem> *clMemToCleanUp,
+                                            list<cl_kernel> 
*clKernelsToCleanUp)
 {
        if (!dilateKernel) {
                dilateKernel = COM_clCreateKernel(program, "dilateKernel", 
NULL);
        }
-       cl_int distanceSquared = this->distance*this->distance;
+       cl_int distanceSquared = this->distance * this->distance;
        cl_int scope = this->scope;
        
        COM_clAttachMemoryBufferToKernelParameter(context, dilateKernel, 0,  2, 
clMemToCleanUp, inputMemoryBuffers, this->inputProgram);
@@ -264,28 +264,28 @@
        const float distance = this->distance;
        float mindist = distance * distance;
 
-       MemoryBuffer *inputBuffer = (MemoryBuffer*)data;
+       MemoryBuffer *inputBuffer = (MemoryBuffer *)data;
        float *buffer = inputBuffer->getBuffer();
        rcti *rect = inputBuffer->getRect();
        const int minx = max(x - scope, rect->xmin);
        const int miny = max(y - scope, rect->ymin);
        const int maxx = min(x + scope, rect->xmax);
        const int maxy = min(y + scope, rect->ymax);
-       const int bufferWidth = rect->xmax-rect->xmin;
+       const int bufferWidth = rect->xmax - rect->xmin;
        int offset;
        
        float value = 1.0f;
 
-       for (int yi = miny ; yi<maxy;yi++) {
-               offset = ((yi-rect->ymin)*bufferWidth+(minx-rect->xmin))*4;
-               for (int xi = minx ; xi<maxx;xi++) {
-                       const float dx = xi-x;
-                       const float dy = yi-y;
-                       const float dis = dx*dx+dy*dy;
+       for (int yi = miny; yi < maxy; yi++) {
+               offset = ((yi - rect->ymin) * bufferWidth + (minx - 
rect->xmin)) * 4;
+               for (int xi = minx; xi < maxx; xi++) {
+                       const float dx = xi - x;
+                       const float dy = yi - y;

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to