From 979f6bab9c1aba27b8d018d1481987d841f68ee1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 May 2012 13:44:15 +0000 Subject: style cleanup: braces, compositor --- .../compositor/intern/COM_CompositorContext.cpp | 6 +- source/blender/compositor/intern/COM_Converter.cpp | 20 +- .../compositor/intern/COM_ExecutionGroup.cpp | 20 +- .../compositor/intern/COM_ExecutionSystem.cpp | 23 +- .../intern/COM_ExecutionSystemHelper.cpp | 34 +- .../blender/compositor/intern/COM_InputSocket.cpp | 29 +- .../blender/compositor/intern/COM_MemoryBuffer.cpp | 2 +- .../compositor/intern/COM_MemoryManager.cpp | 2 +- .../compositor/intern/COM_MemoryManagerState.cpp | 9 +- source/blender/compositor/intern/COM_Node.cpp | 2 +- source/blender/compositor/intern/COM_NodeBase.cpp | 5 +- .../compositor/intern/COM_NodeOperation.cpp | 3 +- .../blender/compositor/intern/COM_OpenCLDevice.cpp | 8 +- .../blender/compositor/intern/COM_OutputSocket.cpp | 3 +- .../compositor/intern/COM_SocketConnection.cpp | 8 +- .../compositor/intern/COM_WorkScheduler.cpp | 15 +- .../blender/compositor/nodes/COM_AlphaOverNode.cpp | 12 +- source/blender/compositor/nodes/COM_BlurNode.cpp | 6 +- .../blender/compositor/nodes/COM_BokehBlurNode.cpp | 3 +- .../compositor/nodes/COM_ChannelMatteNode.cpp | 2 +- .../compositor/nodes/COM_ColorBalanceNode.cpp | 3 +- .../compositor/nodes/COM_ColorSpillNode.cpp | 3 +- .../compositor/nodes/COM_CombineRGBANode.cpp | 9 +- .../compositor/nodes/COM_ConvertAlphaNode.cpp | 2 +- source/blender/compositor/nodes/COM_CropNode.cpp | 7 +- .../blender/compositor/nodes/COM_DefocusNode.cpp | 6 +- source/blender/compositor/nodes/COM_FilterNode.cpp | 2 +- source/blender/compositor/nodes/COM_GroupNode.cpp | 3 +- source/blender/compositor/nodes/COM_IDMaskNode.cpp | 3 +- source/blender/compositor/nodes/COM_ImageNode.cpp | 7 +- .../compositor/nodes/COM_LensDistortionNode.cpp | 3 +- source/blender/compositor/nodes/COM_MathNode.cpp | 2 +- .../blender/compositor/nodes/COM_MovieClipNode.cpp | 5 +- .../compositor/nodes/COM_RenderLayersNode.cpp | 6 +- source/blender/compositor/nodes/COM_SwitchNode.cpp | 3 +- source/blender/compositor/nodes/COM_TimeNode.cpp | 6 +- .../compositor/nodes/COM_ViewLevelsNode.cpp | 3 +- .../blender/compositor/nodes/COM_ZCombineNode.cpp | 6 +- .../operations/COM_AlphaOverKeyOperation.cpp | 4 +- .../operations/COM_AlphaOverMixedOperation.cpp | 4 +- .../COM_AlphaOverPremultiplyOperation.cpp | 4 +- .../operations/COM_AntiAliasOperation.cpp | 6 +- .../operations/COM_BilateralBlurOperation.cpp | 3 +- .../operations/COM_BlurBaseOperation.cpp | 6 +- .../operations/COM_BokehBlurOperation.cpp | 6 +- .../operations/COM_BokehImageOperation.cpp | 9 +- .../compositor/operations/COM_BoxMaskOperation.cpp | 15 +- .../operations/COM_BrightnessOperation.cpp | 6 +- .../operations/COM_CalculateMeanOperation.cpp | 2 +- .../COM_CalculateStandardDeviationOperation.cpp | 2 +- .../operations/COM_ChangeHSVOperation.cpp | 2 +- .../operations/COM_ChannelMatteOperation.cpp | 4 +- .../operations/COM_ChromaMatteOperation.cpp | 4 +- .../operations/COM_ColorCorrectionOperation.cpp | 21 +- .../operations/COM_ColorCurveOperation.cpp | 4 +- .../operations/COM_ColorMatteOperation.cpp | 2 +- .../operations/COM_ColorSpillOperation.cpp | 8 +- .../operations/COM_CompositorOperation.cpp | 4 +- .../COM_ConvertDepthToRadiusOperation.cpp | 3 +- .../operations/COM_ConvertPremulToKeyOperation.cpp | 2 +- .../operations/COM_ConvertRGBToYCCOperation.cpp | 2 +- .../operations/COM_ConvertYCCToRGBOperation.cpp | 2 +- .../compositor/operations/COM_CropOperation.cpp | 25 +- .../operations/COM_DifferenceMatteOperation.cpp | 6 +- .../operations/COM_DilateErodeOperation.cpp | 24 +- .../operations/COM_DirectionalBlurOperation.cpp | 2 +- .../operations/COM_DistanceMatteOperation.cpp | 6 +- .../operations/COM_DoubleEdgeMaskOperation.cpp | 536 ++++++++++++--------- .../operations/COM_EllipseMaskOperation.cpp | 15 +- .../operations/COM_FastGaussianBlurOperation.cpp | 16 +- .../compositor/operations/COM_FlipOperation.cpp | 6 +- .../operations/COM_GaussianBokehBlurOperation.cpp | 22 +- .../operations/COM_GaussianXBlurOperation.cpp | 8 +- .../operations/COM_GaussianYBlurOperation.cpp | 8 +- .../compositor/operations/COM_ImageOperation.cpp | 11 +- .../compositor/operations/COM_InvertOperation.cpp | 7 +- .../operations/COM_LensGhostOperation.cpp | 41 +- .../operations/COM_LuminanceMatteOperation.cpp | 4 +- .../compositor/operations/COM_MapUVOperation.cpp | 2 +- .../operations/COM_MapValueOperation.cpp | 8 +- .../operations/COM_MathBaseOperation.cpp | 16 +- .../compositor/operations/COM_MixBaseOperation.cpp | 12 +- .../operations/COM_MixColorOperation.cpp | 2 +- .../operations/COM_MixDarkenOperation.cpp | 6 +- .../operations/COM_MixDivideOperation.cpp | 6 +- .../compositor/operations/COM_MixHueOperation.cpp | 2 +- .../operations/COM_MixLightenOperation.cpp | 6 +- .../operations/COM_MixOverlayOperation.cpp | 15 +- .../operations/COM_MixSaturationOperation.cpp | 2 +- .../operations/COM_MovieClipOperation.cpp | 3 +- .../operations/COM_MovieDistortionOperation.cpp | 3 +- .../operations/COM_MultilayerImageOperation.cpp | 14 +- .../compositor/operations/COM_OpenCLKernels.cl.cpp | 2 +- .../compositor/operations/COM_PreviewOperation.cpp | 8 +- .../operations/COM_ReadBufferOperation.cpp | 3 +- .../operations/COM_RenderLayersAlphaProg.cpp | 3 +- .../operations/COM_RenderLayersBaseProg.cpp | 27 +- .../compositor/operations/COM_RotateOperation.cpp | 3 +- .../COM_ScreenLensDistortionOperation.cpp | 3 +- .../operations/COM_SetVectorOperation.cpp | 3 +- .../operations/COM_SplitViewerOperation.cpp | 11 +- .../compositor/operations/COM_TextureOperation.cpp | 7 +- .../COM_VariableSizeBokehBlurOperation.cpp | 4 +- .../operations/COM_VectorBlurOperation.cpp | 3 +- .../operations/COM_ViewerBaseOperation.cpp | 3 +- .../compositor/operations/COM_ViewerOperation.cpp | 8 +- .../operations/COM_WriteBufferOperation.cpp | 3 +- .../operations/COM_ZCombineOperation.cpp | 6 +- 108 files changed, 802 insertions(+), 545 deletions(-) (limited to 'source') diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index dbb05d4f493..abab4edfc3f 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -33,7 +33,8 @@ CompositorContext::CompositorContext() { const int CompositorContext::getFramenumber() const { if (this->scene) { return this->scene->r.cfra; - } else { + } + else { return -1; /* this should never happen */ } } @@ -41,7 +42,8 @@ const int CompositorContext::getFramenumber() const { const int CompositorContext::isColorManaged() const { if (this->scene) { return this->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT; - } else { + } + else { return 0; /* this should never happen */ } } diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index 56b1da97df8..ac57bf1cadc 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -361,15 +361,20 @@ void Converter::convertDataType(SocketConnection* connection, ExecutionSystem *s NodeOperation * converter = NULL; if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) { converter = new ConvertValueToColourProg(); - } else if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_VECTOR) { + } + else if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_VECTOR) { converter = new ConvertValueToVectorOperation(); - } else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VALUE) { + } + else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VALUE) { converter = new ConvertColourToValueProg(); - } else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VECTOR) { + } + else if (fromDatatype == COM_DT_COLOR && toDatatype == COM_DT_VECTOR) { converter = new ConvertColorToVectorOperation(); - } else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_VALUE) { + } + else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_VALUE) { converter = new ConvertVectorToValueOperation(); - } else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_COLOR) { + } + else if (fromDatatype == COM_DT_VECTOR && toDatatype == COM_DT_COLOR) { converter = new ConvertVectorToColorOperation(); } if (converter != NULL) { @@ -418,7 +423,8 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem scaleY = toHeight/fromHeight; if (scaleX < scaleY) { scaleX = scaleY; - } else { + } + else { scaleY = scaleX; } break; @@ -435,7 +441,7 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem NodeOperation *first = NULL; SocketConnection *c; ScaleOperation * scaleOperation = NULL; - if(doScale) { + if (doScale) { scaleOperation = new ScaleOperation(); first = scaleOperation; SetValueOperation * sxop = new SetValueOperation(); diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index 22d4366a1a8..bce31658a8d 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -83,7 +83,8 @@ bool ExecutionGroup::canContainOperation(NodeOperation* operation) { if (!this->isComplex()) { return (!operation->isComplex()); - } else { + } + else { return false; } } @@ -101,7 +102,8 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat ReadBufferOperation* readOperation = (ReadBufferOperation*)operation; WriteBufferOperation* writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation(); this->addOperation(system, writeOperation); - } else { + } + else { unsigned int index; for (index = 0 ; index < operation->getNumberOfInputSockets(); index ++) { InputSocket * inputSocket = operation->getInputSocket(index); @@ -111,7 +113,8 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat } } } - } else { + } + else { if (operation->isWriteBufferOperation()) { WriteBufferOperation * writeoperation = (WriteBufferOperation*)operation; if (writeoperation->getMemoryProxy()->getExecutor() == NULL) { @@ -124,7 +127,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat } } -NodeOperation* ExecutionGroup::getOutputNodeOperation() const{ +NodeOperation* ExecutionGroup::getOutputNodeOperation() const { return this->operations[0]; // the first operation of the group is always the output operation. } @@ -328,11 +331,13 @@ void ExecutionGroup::execute(ExecutionSystem* graph) { finished=false; startEvaluated = true; numberEvaluated++; - } else if (state == COM_ES_SCHEDULED) { + } + else if (state == COM_ES_SCHEDULED) { finished=false; startEvaluated = true; numberEvaluated++; - } else if (state == COM_ES_EXECUTED && !startEvaluated) { + } + else if (state == COM_ES_EXECUTED && !startEvaluated) { startIndex = index+1; } } @@ -533,7 +538,8 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu if (!group->scheduleAreaWhenPossible(graph, &area)) { canBeExecuted = false; } - } else { + } + else { throw "ERROR"; } } diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index d82d725d234..b66a6a036b5 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -46,7 +46,8 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) { /* initialize the CompositorContext */ if (rendering) { context.setQuality((CompositorQuality)editingtree->render_quality); - } else { + } + else { context.setQuality((CompositorQuality)editingtree->edit_quality); } context.setRendering(rendering); @@ -77,22 +78,22 @@ ExecutionSystem::ExecutionSystem(bNodeTree* editingtree, bool rendering) { ExecutionSystem::~ExecutionSystem() { unsigned int index; - for(index = 0; index < this->connections.size(); index++) { + for (index = 0; index < this->connections.size(); index++) { SocketConnection* connection = this->connections[index]; delete connection; } this->connections.clear(); - for(index = 0; index < this->nodes.size(); index++) { + for (index = 0; index < this->nodes.size(); index++) { Node* node = this->nodes[index]; delete node; } this->nodes.clear(); - for(index = 0; index < this->operations.size(); index++) { + for (index = 0; index < this->operations.size(); index++) { NodeOperation* operation = this->operations[index]; delete operation; } this->operations.clear(); - for(index = 0; index < this->groups.size(); index++) { + for (index = 0; index < this->groups.size(); index++) { ExecutionGroup* group = this->groups[index]; delete group; } @@ -101,7 +102,7 @@ ExecutionSystem::~ExecutionSystem() { void ExecutionSystem::execute() { unsigned int order = 0; - for( vector::iterator iter = this->operations.begin(); iter != operations.end(); ++iter ) { + for ( vector::iterator iter = this->operations.begin(); iter != operations.end(); ++iter ) { NodeBase* node = *iter; NodeOperation *operation = (NodeOperation*) node; if (operation->isReadBufferOperation()) { @@ -214,7 +215,7 @@ void ExecutionSystem::convertToOperations() { unsigned int index; // first determine data types of the nodes, this can be used by the node to convert to a different operation system this->determineActualSocketDataTypes((vector&)this->nodes); - for(index = 0; index < this->nodes.size(); index++) { + for (index = 0; index < this->nodes.size(); index++) { Node* node = (Node*)this->nodes[index]; node->convertToOperations(this, &this->context); } @@ -258,14 +259,14 @@ void ExecutionSystem::groupOperations() { NodeOperation * operation; unsigned int index; // surround complex operations with ReadBufferOperation and WriteBufferOperation - for(index = 0; index < this->operations.size(); index++) { + for (index = 0; index < this->operations.size(); index++) { operation = this->operations[index]; if (operation->isComplex()) { this->addReadWriteBufferOperations(operation); } } ExecutionSystemHelper::findOutputNodeOperations(&outputOperations, this->getOperations(), this->context.isRendering()); - for( vector::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter ) { + for ( vector::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter ) { operation = *iter; ExecutionGroup *group = new ExecutionGroup(); group->addOperation(this, operation); @@ -283,7 +284,7 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection) void ExecutionSystem::determineActualSocketDataTypes(vector &nodes) { unsigned int index; /* first do all input nodes */ - for(index = 0; index < nodes.size(); index++) { + for (index = 0; index < nodes.size(); index++) { NodeBase* node = nodes[index]; if (node->isInputNode()) { node->determineActualSocketDataTypes(); @@ -291,7 +292,7 @@ void ExecutionSystem::determineActualSocketDataTypes(vector &nodes) { } /* then all other nodes */ - for(index = 0; index < nodes.size(); index++) { + for (index = 0; index < nodes.size(); index++) { NodeBase* node = nodes[index]; if (!node->isInputNode()) { node->determineActualSocketDataTypes(); diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index d6b03b41105..4a739ba6a9d 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -107,13 +107,14 @@ void ExecutionSystemHelper::findOutputNodeOperations(vector* res static InputSocket* find_input(NodeRange &node_range, bNode *bnode, bNodeSocket* bsocket) { if (bnode != NULL) { - for(NodeIterator it=node_range.first; it!=node_range.second; ++it) { + for (NodeIterator it=node_range.first; it!=node_range.second; ++it) { Node* node = *it; if (node->getbNode() == bnode) return node->findInputSocketBybNodeSocket(bsocket); } - } else { - for(NodeIterator it=node_range.first; it!=node_range.second; ++it) { + } + else { + for (NodeIterator it=node_range.first; it!=node_range.second; ++it) { Node* node = *it; if (node->isProxyNode()) { InputSocket *proxySocket = node->getInputSocket(0); @@ -126,13 +127,14 @@ static InputSocket* find_input(NodeRange &node_range, bNode *bnode, bNodeSocket* } static OutputSocket* find_output(NodeRange &node_range, bNode *bnode, bNodeSocket* bsocket) { if (bnode != NULL) { - for(NodeIterator it=node_range.first; it!=node_range.second; ++it) { + for (NodeIterator it=node_range.first; it!=node_range.second; ++it) { Node* node = *it; if (node->getbNode() == bnode) return node->findOutputSocketBybNodeSocket(bsocket); } - } else { - for(NodeIterator it=node_range.first; it!=node_range.second; ++it) { + } + else { + for (NodeIterator it=node_range.first; it!=node_range.second; ++it) { Node* node = *it; if (node->isProxyNode()) { OutputSocket *proxySocket = node->getOutputSocket(0); @@ -146,7 +148,7 @@ static OutputSocket* find_output(NodeRange &node_range, bNode *bnode, bNodeSocke SocketConnection* ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector& links, bNodeLink *bNodeLink) { /// @note: cyclic lines will be ignored. This has been copied from node.c if (bNodeLink->tonode != 0 && bNodeLink->fromnode != 0) { - if(!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level!=0xFFF)) { // only add non cyclic lines! so execution will procede + if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level!=0xFFF)) { // only add non cyclic lines! so execution will procede return NULL; } } @@ -221,15 +223,20 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem* system) { } if (operation->isViewerOperation()) { printf("Viewer"); - } else if (operation->isOutputOperation(system->getContext().isRendering())) { + } + else if (operation->isOutputOperation(system->getContext().isRendering())) { printf("Output"); - } else if (operation->isSetOperation()) { + } + else if (operation->isSetOperation()) { printf("Set"); - } else if (operation->isReadBufferOperation()) { + } + else if (operation->isReadBufferOperation()) { printf("ReadBuffer"); - } else if (operation->isWriteBufferOperation()) { + } + else if (operation->isWriteBufferOperation()) { printf("WriteBuffer"); - } else { + } + else { printf("O_%p", operation); } tot2 = operation->getNumberOfOutputSockets(); @@ -287,7 +294,8 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem* system) { printf("\t\"O_%p\":\"OUT_%p\" -> \"O_%p\":\"IN_%p\"", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket()); if (!connection->isValid()) { printf(" [color=red]"); - } else { + } + else { switch (connection->getFromSocket()->getActualDataType()) { case COM_DT_VALUE: printf(" [color=grey]"); diff --git a/source/blender/compositor/intern/COM_InputSocket.cpp b/source/blender/compositor/intern/COM_InputSocket.cpp index 9596d5b73b0..8428544cbc2 100644 --- a/source/blender/compositor/intern/COM_InputSocket.cpp +++ b/source/blender/compositor/intern/COM_InputSocket.cpp @@ -48,9 +48,10 @@ void InputSocket::setConnection(SocketConnection *connection) { SocketConnection* InputSocket::getConnection() {return this->connection;} void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[]) { - if (this->isConnected()){ + if (this->isConnected()) { this->connection->getFromSocket()->determineResolution(resolution, preferredResolution); - } else { + } + else { return; } } @@ -67,19 +68,24 @@ DataType InputSocket::convertToSupportedDataType(DataType datatype) { if (datatype == COM_DT_VALUE) { if (candoColor) { return COM_DT_COLOR; - } else if (candoVector) { + } + else if (candoVector) { return COM_DT_VECTOR; } - } else if (datatype == COM_DT_VECTOR) { + } + else if (datatype == COM_DT_VECTOR) { if (candoColor) { return COM_DT_COLOR; - } else if (candoValue) { + } + else if (candoValue) { return COM_DT_VALUE; } - } else if (datatype == COM_DT_COLOR) { + } + else if (datatype == COM_DT_COLOR) { if (candoVector) { return COM_DT_VECTOR; - } else if (candoValue) { + } + else if (candoValue) { return COM_DT_VALUE; } } @@ -115,7 +121,8 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket) { void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnect, int editorNodeInputSocketIndex, bool duplicate, ExecutionSystem* graph) { if (!duplicate) { this->relinkConnections(relinkToSocket, autoconnect, editorNodeInputSocketIndex, graph); - } else { + } + else { if (!this->isConnected() && autoconnect) { Node* node = (Node*)this->getNode(); switch (this->getActualDataType()) { @@ -170,7 +177,8 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, bool autoconnec const ChannelInfo* InputSocket::getChannelInfo(const int channelnumber) { if (this->isConnected() && this->connection->getFromSocket()) { return this->connection->getFromSocket()->getChannelInfo(channelnumber); - } else { + } + else { return NULL; } } @@ -191,7 +199,8 @@ SocketReader* InputSocket::getReader() { NodeOperation* InputSocket::getOperation() const { if (isConnected()) { return (NodeOperation*)this->connection->getFromSocket()->getNode(); - } else { + } + else { return NULL; } } diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 53357b8ec50..bfa20656277 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -247,7 +247,7 @@ static void imp2radangle(float A, float B, float C, float F, float* a, float* b, } } -float clipuv(float x, float limit){ +float clipuv(float x, float limit) { x = (x < 0) ? 0 : ((x >= limit) ? (limit - 1) : x); return x; } diff --git a/source/blender/compositor/intern/COM_MemoryManager.cpp b/source/blender/compositor/intern/COM_MemoryManager.cpp index fa587e8c7d6..661afb20d53 100644 --- a/source/blender/compositor/intern/COM_MemoryManager.cpp +++ b/source/blender/compositor/intern/COM_MemoryManager.cpp @@ -46,7 +46,7 @@ void MemoryManager::addMemoryProxy(MemoryProxy *memoryProxy) { memoryProxy->setState(state); } } -MemoryBuffer* MemoryManager::getMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber){ +MemoryBuffer* MemoryManager::getMemoryBuffer(MemoryProxy *id, unsigned int chunkNumber) { MemoryManagerState * state = MemoryManager::getState(id); if (!state) { return NULL; diff --git a/source/blender/compositor/intern/COM_MemoryManagerState.cpp b/source/blender/compositor/intern/COM_MemoryManagerState.cpp index 56946c3f0f2..620092b2825 100644 --- a/source/blender/compositor/intern/COM_MemoryManagerState.cpp +++ b/source/blender/compositor/intern/COM_MemoryManagerState.cpp @@ -36,7 +36,7 @@ MemoryProxy * MemoryManagerState::getMemoryProxy() { MemoryManagerState::~MemoryManagerState() { this->memoryProxy = NULL; unsigned int index; - for (index = 0 ; index < this->currentSize; index ++){ + for (index = 0 ; index < this->currentSize; index ++) { MemoryBuffer* buffer = this->chunkBuffers[index]; if (buffer) { delete buffer; @@ -69,7 +69,8 @@ void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer) { if (this->chunkBuffers[chunkNumber] == NULL) { this->chunkBuffers[chunkNumber] = buffer; - } else { + } + else { throw "ALREADY ALLOCATED!"; } BLI_mutex_unlock(&this->mutex); @@ -77,7 +78,7 @@ void MemoryManagerState::addMemoryBuffer(MemoryBuffer *buffer) { MemoryBuffer* MemoryManagerState::getMemoryBuffer(unsigned int chunkNumber) { MemoryBuffer* result = NULL; - if (chunkNumber< this->currentSize){ + if (chunkNumber< this->currentSize) { result = this->chunkBuffers[chunkNumber]; if (result) { return result; @@ -85,7 +86,7 @@ MemoryBuffer* MemoryManagerState::getMemoryBuffer(unsigned int chunkNumber) { } BLI_mutex_lock(&this->mutex); - if (chunkNumber< this->currentSize){ + if (chunkNumber< this->currentSize) { result = this->chunkBuffers[chunkNumber]; } diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 2587eaa5195..4e127c61d4e 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -52,7 +52,7 @@ Node::Node(bNode* editorNode, bool create_sockets) { input = (bNodeSocket*)input->next; } bNodeSocket *output = (bNodeSocket*)editorNode->outputs.first; - while(output != NULL) { + while (output != NULL) { DataType dt = COM_DT_VALUE; if (output->type == SOCK_RGBA) dt = COM_DT_COLOR; if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR; diff --git a/source/blender/compositor/intern/COM_NodeBase.cpp b/source/blender/compositor/intern/COM_NodeBase.cpp index 6e6be889572..b6990ec0d79 100644 --- a/source/blender/compositor/intern/COM_NodeBase.cpp +++ b/source/blender/compositor/intern/COM_NodeBase.cpp @@ -33,7 +33,7 @@ NodeBase::NodeBase() { } -NodeBase::~NodeBase(){ +NodeBase::~NodeBase() { while (!this->outputsockets.empty()) { delete (this->outputsockets.back()); this->outputsockets.pop_back(); @@ -101,7 +101,8 @@ DataType NodeBase::determineActualDataType(OutputSocket *outputsocket) { const int inputIndex = outputsocket->getInputSocketDataTypeDeterminatorIndex(); if (inputIndex != -1) { return this->getInputSocket(inputIndex)->getActualDataType(); - } else { + } + else { return outputsocket->getDataType(); } } diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp index b02bcb6676e..71aaceb1b48 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cpp +++ b/source/blender/compositor/intern/COM_NodeOperation.cpp @@ -95,7 +95,8 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe if (this->isInputNode()) { BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax); return false; - } else { + } + else { unsigned int index; vector &inputsockets = this->getInputSockets(); diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp index acf3bf3789d..b986865ecf3 100644 --- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp +++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp @@ -24,21 +24,21 @@ #include "COM_WorkScheduler.h" -OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program){ +OpenCLDevice::OpenCLDevice(cl_context context, cl_device_id device, cl_program program) { this->device = device; this->context = context; this->program = program; this->queue = NULL; } -bool OpenCLDevice::initialize(){ +bool OpenCLDevice::initialize() { cl_int error; queue = clCreateCommandQueue(context, device, 0, &error); return false; } -void OpenCLDevice::deinitialize(){ - if(queue){ +void OpenCLDevice::deinitialize() { + if (queue) { clReleaseCommandQueue(queue); } } diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp index a262ad5f6ea..5380a7ec492 100644 --- a/source/blender/compositor/intern/COM_OutputSocket.cpp +++ b/source/blender/compositor/intern/COM_OutputSocket.cpp @@ -98,7 +98,8 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single) relinkToSocket->addConnection(connection); // relinkToSocket->setActualDataType(this->getActualDataType()); this->connections.erase(this->connections.begin()); - } else { + } + else { unsigned int index; for (index = 0 ; index < this->connections.size();index ++) { SocketConnection *connection = this->connections[index]; diff --git a/source/blender/compositor/intern/COM_SocketConnection.cpp b/source/blender/compositor/intern/COM_SocketConnection.cpp index 6c6c673501a..e3e52005add 100644 --- a/source/blender/compositor/intern/COM_SocketConnection.cpp +++ b/source/blender/compositor/intern/COM_SocketConnection.cpp @@ -29,7 +29,7 @@ SocketConnection::SocketConnection() { this->setIgnoreResizeCheck(false); } -void SocketConnection::setFromSocket(OutputSocket* fromsocket){ +void SocketConnection::setFromSocket(OutputSocket* fromsocket) { if (fromsocket == NULL) { throw "ERROR"; } @@ -49,14 +49,16 @@ InputSocket* SocketConnection::getToSocket() const {return this->toSocket;} NodeBase* SocketConnection::getFromNode() const { if (this->getFromSocket() == NULL) { return NULL; - } else { + } + else { return this->getFromSocket()->getNode(); } } NodeBase* SocketConnection::getToNode() const { if (this->getToSocket() == NULL) { return NULL; - } else { + } + else { return this->getToSocket()->getNode(); } } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index e7c1e00dd96..5130525853b 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -114,9 +114,10 @@ void WorkScheduler::schedule(ExecutionGroup *group, int chunkNumber) { delete package; #elif COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE #ifdef COM_OPENCL_ENABLED - if (group->isOpenCL() && openclActive){ + if (group->isOpenCL() && openclActive) { BLI_thread_queue_push(gpuqueue, package); - } else{ + } + else { BLI_thread_queue_push(cpuqueue, package); } #else @@ -145,7 +146,8 @@ void WorkScheduler::start(CompositorContext &context) { BLI_insert_thread(&gputhreads, device); } openclActive = true; - } else { + } + else { openclActive = false; } #endif @@ -159,7 +161,8 @@ void WorkScheduler::finish() { while (BLI_thread_queue_size(gpuqueue) + BLI_thread_queue_size(cpuqueue) > 0) { PIL_sleep_ms(10); } - } else { + } + else { while (BLI_thread_queue_size(cpuqueue) > 0) { PIL_sleep_ms(10); } @@ -286,14 +289,14 @@ void WorkScheduler::initialize() { void WorkScheduler::deinitialize() { #if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE Device* device; - while(cpudevices.size()>0) { + while (cpudevices.size()>0) { device = cpudevices.back(); cpudevices.pop_back(); device->deinitialize(); delete device; } #ifdef COM_OPENCL_ENABLED - while(gpudevices.size()>0) { + while (gpudevices.size()>0) { device = gpudevices.back(); gpudevices.pop_back(); device->deinitialize(); diff --git a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp index 7cd26bc79b7..23acaee7b93 100644 --- a/source/blender/compositor/nodes/COM_AlphaOverNode.cpp +++ b/source/blender/compositor/nodes/COM_AlphaOverNode.cpp @@ -45,18 +45,22 @@ void AlphaOverNode::convertToOperations(ExecutionSystem *graph, CompositorContex mixOperation->setX(ntf->x); convertProg = mixOperation; - } else if (editorNode->custom1) { + } + else if (editorNode->custom1) { convertProg = new AlphaOverKeyOperation(); - } else { + } + else { convertProg = new AlphaOverPremultiplyOperation(); } convertProg->setUseValueAlphaMultiply(false); if (color1Socket->isConnected()) { convertProg->setResolutionInputSocketIndex(1); - } else if (color2Socket->isConnected()) { + } + else if (color2Socket->isConnected()) { convertProg->setResolutionInputSocketIndex(2); - } else { + } + else { convertProg->setResolutionInputSocketIndex(0); } valueSocket->relinkConnections(convertProg->getInputSocket(0), true, 0, graph); diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp index 8c1923b3236..5e29650a5ca 100644 --- a/source/blender/compositor/nodes/COM_BlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BlurNode.cpp @@ -53,7 +53,8 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0)); graph->addOperation(operationfgb); addPreviewOperation(graph, operationfgb->getOutputSocket(), 5); - }else if (!data->bokeh) { + } + else if (!data->bokeh) { GaussianXBlurOperation *operationx = new GaussianXBlurOperation(); operationx->setData(data); operationx->setQuality(quality); @@ -68,7 +69,8 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0)); addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1)); addPreviewOperation(graph, operationy->getOutputSocket(), 5); - } else { + } + else { GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation(); operation->setData(data); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph); diff --git a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp index c40bcab3ffb..68e9b067f07 100644 --- a/source/blender/compositor/nodes/COM_BokehBlurNode.cpp +++ b/source/blender/compositor/nodes/COM_BokehBlurNode.cpp @@ -50,7 +50,8 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex graph->addOperation(operation); graph->addOperation(converter); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); - } else { + } + else { BokehBlurOperation *operation = new BokehBlurOperation(); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph); this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), true, 1, graph); diff --git a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp index bf3def05643..9ab6c6250db 100644 --- a/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp +++ b/source/blender/compositor/nodes/COM_ChannelMatteNode.cpp @@ -39,7 +39,7 @@ void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCon bNode* node = this->getbNode(); /* colorspace */ - switch(node->custom1) { + switch (node->custom1) { case CMP_NODE_CHANNEL_MATTE_CS_RGB: break; case CMP_NODE_CHANNEL_MATTE_CS_HSV: /*HSV*/ diff --git a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp index 73d10d4b1ca..8d5e8a2788e 100644 --- a/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorBalanceNode.cpp @@ -53,7 +53,8 @@ void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorCon operationLGG->setLift(n->lift_lgg); operationLGG->setGammaInv(n->gamma_inv); operation = operationLGG; - } else { + } + else { ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation(); operationCDL->setGain(n->gain); operationCDL->setLift(n->lift); diff --git a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp index 011a2cb12cc..5935167d88e 100644 --- a/source/blender/compositor/nodes/COM_ColorSpillNode.cpp +++ b/source/blender/compositor/nodes/COM_ColorSpillNode.cpp @@ -39,7 +39,8 @@ void ColorSpillNode::convertToOperations(ExecutionSystem *graph, CompositorConte if (editorsnode->custom2 == 0) { // Simple color spill operation = new ColorSpillOperation(); - } else { + } + else { // Average color spill operation = new ColorSpillAverageOperation(); } diff --git a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp index 8a1a34589a5..6bef0441e5e 100644 --- a/source/blender/compositor/nodes/COM_CombineRGBANode.cpp +++ b/source/blender/compositor/nodes/COM_CombineRGBANode.cpp @@ -43,11 +43,14 @@ void CombineRGBANode::convertToOperations(ExecutionSystem *graph, CompositorCont CombineChannelsOperation *operation = new CombineChannelsOperation(); if (inputRSocket->isConnected()) { operation->setResolutionInputSocketIndex(0); - } else if (inputGSocket->isConnected()) { + } + else if (inputGSocket->isConnected()) { operation->setResolutionInputSocketIndex(1); - } else if (inputBSocket->isConnected()) { + } + else if (inputBSocket->isConnected()) { operation->setResolutionInputSocketIndex(2); - } else { + } + else { operation->setResolutionInputSocketIndex(3); } inputRSocket->relinkConnections(operation->getInputSocket(0), true, 0, graph); diff --git a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp index 4e20b3a5d3a..775fa1ad0fd 100644 --- a/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp +++ b/source/blender/compositor/nodes/COM_ConvertAlphaNode.cpp @@ -29,7 +29,7 @@ void ConvertAlphaNode::convertToOperations(ExecutionSystem *graph, CompositorCon bNode* node = this->getbNode(); /* value hardcoded in rna_nodetree.c */ - if (node->custom1 == 1){ + if (node->custom1 == 1) { operation = new ConvertPremulToKeyOperation(); } else { diff --git a/source/blender/compositor/nodes/COM_CropNode.cpp b/source/blender/compositor/nodes/COM_CropNode.cpp index fdbb1529c60..9d48922d0d6 100644 --- a/source/blender/compositor/nodes/COM_CropNode.cpp +++ b/source/blender/compositor/nodes/COM_CropNode.cpp @@ -27,15 +27,16 @@ CropNode::CropNode(bNode *editorNode) : Node(editorNode) { } -void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context){ +void CropNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) { bNode* node = getbNode(); NodeTwoXYs *cropSettings = (NodeTwoXYs*)node->storage; bool relative = (bool)node->custom2; bool cropImage = (bool)node->custom1; CropBaseOperation *operation; - if (cropImage){ + if (cropImage) { operation = new CropImageOperation(); - } else { + } + else { operation = new CropOperation(); } operation->setCropSettings(cropSettings); diff --git a/source/blender/compositor/nodes/COM_DefocusNode.cpp b/source/blender/compositor/nodes/COM_DefocusNode.cpp index 7f5c9896bbe..40adc3793b0 100644 --- a/source/blender/compositor/nodes/COM_DefocusNode.cpp +++ b/source/blender/compositor/nodes/COM_DefocusNode.cpp @@ -60,7 +60,8 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext graph->addOperation(maxRadius); graph->addOperation(minimize); radiusOperation = minimize; - } else { + } + else { ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation(); converter->setCameraObject(camob); converter->setfStop(data->fstop); @@ -101,7 +102,8 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext this->getOutputSocket()->relinkConnections(inverse->getOutputSocket()); graph->addOperation(correct); graph->addOperation(inverse); - } else { + } + else { this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, true, graph); this->getOutputSocket()->relinkConnections(operation->getOutputSocket()); } diff --git a/source/blender/compositor/nodes/COM_FilterNode.cpp b/source/blender/compositor/nodes/COM_FilterNode.cpp index ce78e451f30..f10d0391317 100644 --- a/source/blender/compositor/nodes/COM_FilterNode.cpp +++ b/source/blender/compositor/nodes/COM_FilterNode.cpp @@ -37,7 +37,7 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext * OutputSocket *outputSocket = this->getOutputSocket(0); ConvolutionFilterOperation *operation = NULL; - switch(this->getbNode()->custom1) { + switch (this->getbNode()->custom1) { case CMP_FILT_SOFT: operation = new ConvolutionFilterOperation(); operation->set3x3Filter(1/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 4/16.0f, 2/16.0f, 1/16.0f, 2/16.0f, 1/16.0f); diff --git a/source/blender/compositor/nodes/COM_GroupNode.cpp b/source/blender/compositor/nodes/COM_GroupNode.cpp index dcb8691524a..14718909de9 100644 --- a/source/blender/compositor/nodes/COM_GroupNode.cpp +++ b/source/blender/compositor/nodes/COM_GroupNode.cpp @@ -46,7 +46,8 @@ void GroupNode::ungroup(ExecutionSystem &system) { SocketProxyNode * proxy = new SocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock); inputSocket->relinkConnections(proxy->getInputSocket(0), true, index, &system); ExecutionSystemHelper::addNode(system.getNodes(), proxy); - } else { + } + else { OutputSocketProxyNode * proxy = new OutputSocketProxyNode(this->getbNode(), editorInput, editorInput->groupsock); inputSocket->relinkConnections(proxy->getInputSocket(0), true, index, &system); ExecutionSystemHelper::addNode(system.getNodes(), proxy); diff --git a/source/blender/compositor/nodes/COM_IDMaskNode.cpp b/source/blender/compositor/nodes/COM_IDMaskNode.cpp index 440468afd46..d66657e489c 100644 --- a/source/blender/compositor/nodes/COM_IDMaskNode.cpp +++ b/source/blender/compositor/nodes/COM_IDMaskNode.cpp @@ -37,7 +37,8 @@ void IDMaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0)); if (bnode->custom2==0 || context->getScene()->r.scemode & R_FULL_SAMPLE) { this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); - } else { + } + else { AntiAliasOperation * antiAliasOperation = new AntiAliasOperation(); addLink(graph, operation->getOutputSocket(), antiAliasOperation->getInputSocket(0)); this->getOutputSocket(0)->relinkConnections(antiAliasOperation->getOutputSocket(0)); diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp index 20e6069b60a..ea2e99ed686 100644 --- a/source/blender/compositor/nodes/COM_ImageNode.cpp +++ b/source/blender/compositor/nodes/COM_ImageNode.cpp @@ -65,9 +65,9 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * int numberOfOutputs = this->getNumberOfOutputSockets(); /* force a load, we assume iuser index will be set OK anyway */ - if(image && image->type==IMA_TYPE_MULTILAYER) { + if (image && image->type==IMA_TYPE_MULTILAYER) { BKE_image_get_ibuf(image, imageuser); - if(image->rr) { + if (image->rr) { OutputSocket * socket; int index; for (index = 0 ; index < numberOfOutputs ; index ++) { @@ -110,7 +110,8 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext * } } } - } else { + } + else { if (numberOfOutputs > 0) { ImageOperation *operation = new ImageOperation(); if (outputImage->isConnected()) { diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp index edaa0a9009e..cee2b133eee 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp @@ -42,7 +42,8 @@ void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorC operation->setData(data); graph->addOperation(operation); - } else { + } + else { ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation(); this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph); diff --git a/source/blender/compositor/nodes/COM_MathNode.cpp b/source/blender/compositor/nodes/COM_MathNode.cpp index 075b90c0f2b..e90767703a5 100644 --- a/source/blender/compositor/nodes/COM_MathNode.cpp +++ b/source/blender/compositor/nodes/COM_MathNode.cpp @@ -27,7 +27,7 @@ void MathNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context) { MathBaseOperation* operation=NULL; - switch(this->getbNode()->custom1) + switch (this->getbNode()->custom1) { case 0: /* Add */ operation = new MathAddOperation(); diff --git a/source/blender/compositor/nodes/COM_MovieClipNode.cpp b/source/blender/compositor/nodes/COM_MovieClipNode.cpp index 7d11a06a24d..475a538670d 100644 --- a/source/blender/compositor/nodes/COM_MovieClipNode.cpp +++ b/source/blender/compositor/nodes/COM_MovieClipNode.cpp @@ -67,7 +67,8 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex if (ibuf) { converter->setPredivided(ibuf->flags & IB_cm_predivide); } - } else { + } + else { addPreviewOperation(graph, operation->getOutputSocket(), 9); if (outputMovieClip->isConnected()) { outputMovieClip->relinkConnections(operation->getOutputSocket()); @@ -86,7 +87,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex angle = 0.0f; if (ibuf) { - if(stab->flag&TRACKING_2D_STABILIZATION) { + if (stab->flag&TRACKING_2D_STABILIZATION) { BKE_tracking_stabilization_data(&movieClip->tracking, context->getFramenumber(), ibuf->x, ibuf->y, loc, &scale, &angle); } } diff --git a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp index e22c2fd5910..e4ce63e9193 100644 --- a/source/blender/compositor/nodes/COM_RenderLayersNode.cpp +++ b/source/blender/compositor/nodes/COM_RenderLayersNode.cpp @@ -63,13 +63,15 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem* system, int outputS if (outputSocketNumber == 0) { // only do for image socket if connected addPreviewOperation(system, operation->getOutputSocket(), 9); } - } else { + } + else { if (outputSocketNumber == 0) { system->addOperation(operation); operation->setScene(scene); operation->setLayerId(layerId); addPreviewOperation(system, operation->getOutputSocket(), 9); - } else { + } + else { delete operation; } } diff --git a/source/blender/compositor/nodes/COM_SwitchNode.cpp b/source/blender/compositor/nodes/COM_SwitchNode.cpp index 1b15ae0e890..83e0be7d3c0 100644 --- a/source/blender/compositor/nodes/COM_SwitchNode.cpp +++ b/source/blender/compositor/nodes/COM_SwitchNode.cpp @@ -34,7 +34,8 @@ void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext * if (!switchFrame) { this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), true, 0, graph); - } else { + } + else { this->getInputSocket(1)->relinkConnections(operation->getInputSocket(0), true, 1, graph); } this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket()); diff --git a/source/blender/compositor/nodes/COM_TimeNode.cpp b/source/blender/compositor/nodes/COM_TimeNode.cpp index 3e2c750d3aa..481840cbd58 100644 --- a/source/blender/compositor/nodes/COM_TimeNode.cpp +++ b/source/blender/compositor/nodes/COM_TimeNode.cpp @@ -43,9 +43,11 @@ void TimeNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c if (framenumber < node->custom1) { fac = 0.0f; - } else if (framenumber > node->custom2) { + } + else if (framenumber > node->custom2) { fac = 1.0f; - } else if(node->custom1 < node->custom2) { + } + else if (node->custom1 < node->custom2) { fac= (context->getFramenumber() - node->custom1)/(float)(node->custom2-node->custom1); } diff --git a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp index b5b15b2ba70..42d019c4e93 100644 --- a/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp +++ b/source/blender/compositor/nodes/COM_ViewLevelsNode.cpp @@ -52,7 +52,8 @@ void ViewLevelsNode::convertToOperations(ExecutionSystem *graph, CompositorConte CalculateStandardDeviationOperation * operation = new CalculateStandardDeviationOperation(); if (firstOperationConnected) { addLink(graph, inputSocket, operation->getInputSocket(0)); - }else{ + } + else { input->relinkConnections(operation->getInputSocket(0), true, 0, graph); } operation->setSetting(this->getbNode()->custom1); diff --git a/source/blender/compositor/nodes/COM_ZCombineNode.cpp b/source/blender/compositor/nodes/COM_ZCombineNode.cpp index be7b6ebdc45..8f512769d63 100644 --- a/source/blender/compositor/nodes/COM_ZCombineNode.cpp +++ b/source/blender/compositor/nodes/COM_ZCombineNode.cpp @@ -35,7 +35,8 @@ void ZCombineNode::convertToOperations(ExecutionSystem* system, CompositorContex ZCombineOperation * operation = NULL; if (this->getbNode()->custom1) { operation = new ZCombineAlphaOperation(); - } else { + } + else { operation = new ZCombineOperation(); } @@ -52,7 +53,8 @@ void ZCombineNode::convertToOperations(ExecutionSystem* system, CompositorContex this->getOutputSocket(1)->relinkConnections(zoperation->getOutputSocket()); system->addOperation(zoperation); } - } else { + } + else { if (this->getOutputSocket(1)->isConnected()) { MathMinimumOperation * zoperation = new MathMinimumOperation(); this->getInputSocket(1)->relinkConnections(zoperation->getInputSocket(0), true, 1, system); diff --git a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp index 2dba9572ee8..3e80de78223 100644 --- a/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverKeyOperation.cpp @@ -34,13 +34,13 @@ void AlphaOverKeyOperation::executePixel(float* outputValue, float x, float y, P inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); - if(inputOverColor[3]<=0.0f) { + if (inputOverColor[3]<=0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if(value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp index 9deb00ae71a..48762e6370e 100644 --- a/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverMixedOperation.cpp @@ -35,13 +35,13 @@ void AlphaOverMixedOperation::executePixel(float* outputValue, float x, float y, inputColor1Operation->read(inputColor1, x, y, sampler, inputBuffers); inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); - if(inputOverColor[3]<=0.0f) { + if (inputOverColor[3]<=0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if(value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp index 635a6308601..c46f3a04113 100644 --- a/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp +++ b/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp @@ -35,13 +35,13 @@ void AlphaOverPremultiplyOperation::executePixel(float* outputValue, float x, fl inputColor2Operation->read(inputOverColor, x, y, sampler, inputBuffers); /* Zero alpha values should still permit an add of RGB data */ - if(inputOverColor[3]<0.0f) { + if (inputOverColor[3]<0.0f) { outputValue[0] = inputColor1[0]; outputValue[1] = inputColor1[1]; outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } - else if(value[0]==1.0f && inputOverColor[3]>=1.0f) { + else if (value[0]==1.0f && inputOverColor[3]>=1.0f) { outputValue[0] = inputOverColor[0]; outputValue[1] = inputOverColor[1]; outputValue[2] = inputOverColor[2]; diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp index 729d04c182e..3d8cd13229f 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cpp +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cpp @@ -43,7 +43,8 @@ void AntiAliasOperation::initExecution() { void AntiAliasOperation::executePixel(float* color, int x, int y, MemoryBuffer *inputBuffers[], void * data) { if (y < 0 || y >= this->height || x < 0 || x >= this->width) { color[0] = 0.0f; - } else { + } + else { int offset = y*this->width + x; color[0] = buffer[offset]/255.0f; } @@ -62,7 +63,8 @@ bool AntiAliasOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe rcti imageInput; if (this->buffer) { return false; - } else { + } + else { NodeOperation* operation = getInputOperation(0); imageInput.xmax = operation->getWidth(); imageInput.xmin = 0; diff --git a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp index 5743b388705..8d507a754d5 100644 --- a/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BilateralBlurOperation.cpp @@ -89,7 +89,8 @@ void BilateralBlurOperation::executePixel(float* color, int x, int y, MemoryBuff color[1] = blurColor[1]/blurDivider; color[2] = blurColor[2]/blurDivider; color[3] = blurColor[3]/blurDivider; - } else { + } + else { color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp index b18c0762c1a..60954503949 100644 --- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp @@ -42,7 +42,7 @@ void BlurBaseOperation::initExecution() { this->inputSize = this->getInputSocketReader(1); this->data->image_in_width= this->getWidth(); this->data->image_in_height= this->getHeight(); - if(this->data->relative) { + if (this->data->relative) { switch (this->data->aspect) { case CMP_NODE_BLUR_ASPECT_NONE: this->data->sizex= (int)(this->data->percentx*0.01f*this->data->image_in_width); @@ -80,7 +80,7 @@ float* BlurBaseOperation::make_gausstab(int rad) } sum= 1.0f/sum; - for(i=0; idata = NULL; } -void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers){ +void BlurBaseOperation::updateSize(MemoryBuffer **memoryBuffers) { float result[4]; this->getInputSocketReader(1)->read(result, 0, 0, COM_PS_NEAREST, memoryBuffers); this->size = result[0]; diff --git a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp index 31345dbaeff..1d5f4852340 100644 --- a/source/blender/compositor/operations/COM_BokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehBlurOperation.cpp @@ -57,7 +57,8 @@ void BokehBlurOperation::initExecution() { float dimension; if (widthbokehMidX = width/2.0f; @@ -119,7 +120,8 @@ void BokehBlurOperation::executePixel(float* color, int x, int y, MemoryBuffer * color[1] = tempColor[1]*(1.0/overallmultiplyerg); color[2] = tempColor[2]*(1.0/overallmultiplyerb); color[3] = 1.0f; - } else { + } + else { inputProgram->read(color, x, y, COM_PS_NEAREST, inputBuffers); } } diff --git a/source/blender/compositor/operations/COM_BokehImageOperation.cpp b/source/blender/compositor/operations/COM_BokehImageOperation.cpp index 3286217e71d..22b73417778 100644 --- a/source/blender/compositor/operations/COM_BokehImageOperation.cpp +++ b/source/blender/compositor/operations/COM_BokehImageOperation.cpp @@ -70,9 +70,11 @@ float BokehImageOperation::isInsideBokeh(float distance, float x, float y) { if (distanceRoundingToCenter>=distanceToCenter && catadioptricDistanceToCenter<=distanceToCenter) { if (distanceRoundingToCenter-distanceToCenter<1.0) { insideBokeh = (distanceRoundingToCenter-distanceToCenter); - } else if (this->data->catadioptric != 0.0 && distanceToCenter-catadioptricDistanceToCenter<1.0) { + } + else if (this->data->catadioptric != 0.0 && distanceToCenter-catadioptricDistanceToCenter<1.0) { insideBokeh = (distanceToCenter-catadioptricDistanceToCenter); - } else { + } + else { insideBokeh = 1.0; } } @@ -89,7 +91,8 @@ void BokehImageOperation::executePixel(float* color, float x, float y, PixelSamp color[0] = insideBokehMax; color[1] = insideBokehMed; color[2] = insideBokehMin; - } else { + } + else { color[0] = insideBokehMin; color[1] = insideBokehMed; color[2] = insideBokehMax; diff --git a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp index 44157051089..5b769fef3ef 100644 --- a/source/blender/compositor/operations/COM_BoxMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_BoxMaskOperation.cpp @@ -68,7 +68,8 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler case CMP_NODE_MASKTYPE_ADD: if (inside) { color[0] = max(inputMask[0],inputValue[0]); - } else { + } + else { color[0] = inputMask[0]; } break; @@ -76,14 +77,16 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler if (inside) { color[0] = inputMask[0]-inputValue[0]; CLAMP(color[0], 0, 1); - } else { + } + else { color[0] = inputMask[0]; } break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { color[0] = inputMask[0]*inputValue[0]; - } else { + } + else { color[0] = 0; } break; @@ -91,10 +94,12 @@ void BoxMaskOperation::executePixel(float* color, float x, float y, PixelSampler if (inside) { if (inputMask[0]>0.0f) { color[0] = 0; - } else { + } + else { color[0] = inputValue[0]; } - } else { + } + else { color[0] = inputMask[0]; } break; diff --git a/source/blender/compositor/operations/COM_BrightnessOperation.cpp b/source/blender/compositor/operations/COM_BrightnessOperation.cpp index bb481f71cc1..a62470e5b1d 100644 --- a/source/blender/compositor/operations/COM_BrightnessOperation.cpp +++ b/source/blender/compositor/operations/COM_BrightnessOperation.cpp @@ -53,13 +53,11 @@ void BrightnessOperation::executePixel(float* color, float x, float y, PixelSamp * (http://visca.com/ffactory/archives/5-99/msg00021.html) * Extracted of OpenCV demhist.c */ - if( contrast > 0 ) - { + if (contrast > 0) { a = 1.0f / a; b = a * (brightness - delta); } - else - { + else { delta *= -1; b = a * (brightness + delta); } diff --git a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp index 062e7fc69fe..7a1fc5e511c 100644 --- a/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateMeanOperation.cpp @@ -86,7 +86,7 @@ void CalculateMeanOperation::calculateMean(MemoryBuffer * tile) { if (buffer[offset+3] > 0) { pixels ++; - switch(this->setting) + switch (this->setting) { case 1: { diff --git a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp index 4cd990e417e..9d9dc46eb6c 100644 --- a/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp +++ b/source/blender/compositor/operations/COM_CalculateStandardDeviationOperation.cpp @@ -48,7 +48,7 @@ void* CalculateStandardDeviationOperation::initializeTileData(rcti *rect, Memory if (buffer[offset+3] > 0) { pixels ++; - switch(this->setting) + switch (this->setting) { case 1: { diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp index fd2bd3991ec..da59524586c 100644 --- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp +++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp @@ -42,7 +42,7 @@ void ChangeHSVOperation::executePixel(float* outputValue, float x, float y, Pixe inputOperation->read(inputColor1, x, y, sampler, inputBuffers); outputValue[0] = inputColor1[0] + (this->hue - 0.5f); - if (outputValue[0]>1.0f) outputValue[0]-=1.0; else if(outputValue[0]<0.0) outputValue[0]+= 1.0; + if (outputValue[0]>1.0f) outputValue[0]-=1.0; else if (outputValue[0]<0.0) outputValue[0]+= 1.0; outputValue[1] = inputColor1[1] * this->saturation; outputValue[2] = inputColor1[2] * this->value; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index b595aca3c46..10ff140f8be 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -97,10 +97,10 @@ void ChannelMatteOperation::executePixel(float* outputValue, float x, float y, P alpha = 1.f - alpha; /* test range*/ - if(alpha > limit_max) { + if (alpha > limit_max) { alpha = inColor[3]; /*whatever it was prior */ } - else if(alpha < limit_min){ + else if (alpha < limit_min) { alpha = 0.f; } else {/*blend */ diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp index 8e793f08a3b..9556b673c0f 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cpp @@ -72,13 +72,13 @@ void ChromaMatteOperation::executePixel(float* outputValue, float x, float y, Pi /* if kfg is <0 then the pixel is outside of the key color */ kfg= x_angle-(fabsf(z_angle)/tanf(acceptance/2.f)); - if(kfg>0.f) { /* found a pixel that is within key color */ + if (kfg>0.f) { /* found a pixel that is within key color */ alpha=(1.f-kfg)*(gain); beta=atan2(z_angle,x_angle); /* if beta is within the cutoff angle */ - if(fabsf(beta) < (cutoff/2.f)) { + if (fabsf(beta) < (cutoff/2.f)) { alpha=0.f; } diff --git a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp index fef045481f7..fb617549b1c 100644 --- a/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCorrectionOperation.cpp @@ -63,15 +63,19 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix #define MARGIN_DIV (0.5/MARGIN) if ( level < this->data->startmidtones-MARGIN) { levelShadows = 1.0f; - } else if (level < this->data->startmidtones+MARGIN) { + } + else if (level < this->data->startmidtones+MARGIN) { levelMidtones = ((level-this->data->startmidtones)*MARGIN_DIV)+0.5; levelShadows = 1.0- levelMidtones; - } else if (level < this->data->endmidtones-MARGIN) { + } + else if (level < this->data->endmidtones-MARGIN) { levelMidtones = 1.0f; - } else if (level < this->data->endmidtones+MARGIN) { + } + else if (level < this->data->endmidtones+MARGIN) { levelHighlights = ((level-this->data->endmidtones)*MARGIN_DIV)+0.5; levelMidtones = 1.0- levelHighlights; - } else { + } + else { levelHighlights = 1.0f; } #undef MARGIN @@ -111,17 +115,20 @@ void ColorCorrectionOperation::executePixel(float* output, float x, float y, Pix if (this->redChannelEnabled) { output[0] = r; - } else { + } + else { output[0] = inputImageColor[0]; } if (this->greenChannelEnabled) { output[1] = g; - } else { + } + else { output[1] = inputImageColor[1]; } if (this->blueChannelEnabled) { output[2] = b; - } else { + } + else { output[2] = inputImageColor[2]; } output[3] = inputImageColor[3]; diff --git a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp index cb16b99f06b..375d7269124 100644 --- a/source/blender/compositor/operations/COM_ColorCurveOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorCurveOperation.cpp @@ -69,9 +69,9 @@ void ColorCurveOperation::executePixel(float* color, float x, float y, PixelSamp this->inputFacProgram->read(fac, x, y, sampler, inputBuffers); this->inputImageProgram->read(image, x, y, sampler, inputBuffers); - if(fac[0]>=1.0) + if (fac[0]>=1.0) curvemapping_evaluate_premulRGBF(this->curveMapping, color, image); - else if(*fac<=0.0) { + else if (*fac<=0.0) { color[0]= image[0]; color[1]= image[1]; color[2]= image[2]; diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp index a80788ddd33..6e9c1b0d48a 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cpp @@ -59,7 +59,7 @@ void ColorMatteOperation::executePixel(float* outputValue, float x, float y, Pix * COM_SetAlphaOperation and the Value output */ - if( + if ( /* do hue last because it needs to wrap, and does some more checks */ /* sat */ (fabsf(inColor[1]-inKey[1]) < sat) && diff --git a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp index 9f054540332..56f45c0fdeb 100644 --- a/source/blender/compositor/operations/COM_ColorSpillOperation.cpp +++ b/source/blender/compositor/operations/COM_ColorSpillOperation.cpp @@ -48,7 +48,8 @@ void ColorSpillOperation::initExecution() { settings->uspillg = 0.0f; settings->uspillb = 0.0f; } - } else if (spillChannel == 1) { + } + else if (spillChannel == 1) { rmut = 1.0f; gmut = -1.0f; bmut = 1.0f; @@ -59,7 +60,8 @@ void ColorSpillOperation::initExecution() { settings->uspillg = 1.0f; settings->uspillb = 0.0f; } - } else { + } + else { rmut = 1.0f; gmut = 1.0f; bmut = -1.0f; @@ -87,7 +89,7 @@ void ColorSpillOperation::executePixel(float* outputValue, float x, float y, Pix this->inputImageReader->read(input, x, y, sampler, inputBuffers); float rfac = min(1.0f, fac[0]); map = calculateMapValue(rfac, input); - if(map>0) { + if (map>0) { outputValue[0]=input[0]+rmut*(settings->uspillr*map); outputValue[1]=input[1]+gmut*(settings->uspillg*map); outputValue[2]=input[2]+bmut*(settings->uspillb*map); diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 7590b4be299..6391fa2537d 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -56,8 +56,8 @@ void CompositorOperation::initExecution() { const Scene * scene = this->scene; Render* re= RE_GetRender(scene->id.name); RenderResult *rr= RE_AcquireResultWrite(re); - if(rr) { - if(rr->rectf != NULL) { + if (rr) { + if (rr->rectf != NULL) { MEM_freeN(rr->rectf); } rr->rectf= outputBuffer; diff --git a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp index 345fc37b340..e262533b2f7 100644 --- a/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertDepthToRadiusOperation.cpp @@ -37,7 +37,8 @@ float ConvertDepthToRadiusOperation::determineFocalDistance() { if (cameraObject == NULL || cameraObject->type != OB_CAMERA) { return 10.0f; - } else { + } + else { Camera *camera= (Camera*)this->cameraObject->data; cam_lens = camera->lens; if (camera->dof_ob) { diff --git a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp index 6f676b1c404..c800587ab0c 100644 --- a/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertPremulToKeyOperation.cpp @@ -40,7 +40,7 @@ void ConvertPremulToKeyOperation::executePixel(float* outputValue, float x, floa this->inputColor->read(inputValue, x, y, sampler, inputBuffers); alpha = inputValue[3]; - if(fabsf(alpha) < 1e-5f) { + if (fabsf(alpha) < 1e-5f) { outputValue[0]= 0.f; outputValue[1]= 0.f; outputValue[2]= 0.f; diff --git a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp index 623376d532f..e1aa91e35da 100644 --- a/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertRGBToYCCOperation.cpp @@ -33,7 +33,7 @@ void ConvertRGBToYCCOperation::initExecution() { } void ConvertRGBToYCCOperation::setMode(int mode) { - switch(mode) + switch (mode) { case 1: this->mode = BLI_YCC_ITU_BT709; diff --git a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp index 1d8ee944915..6f9c5244c29 100644 --- a/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp +++ b/source/blender/compositor/operations/COM_ConvertYCCToRGBOperation.cpp @@ -33,7 +33,7 @@ void ConvertYCCToRGBOperation::initExecution() { } void ConvertYCCToRGBOperation::setMode(int mode) { - switch(mode) + switch (mode) { case 1: this->mode = BLI_YCC_ITU_BT709; diff --git a/source/blender/compositor/operations/COM_CropOperation.cpp b/source/blender/compositor/operations/COM_CropOperation.cpp index a763ded7f52..3c4e3428ec2 100644 --- a/source/blender/compositor/operations/COM_CropOperation.cpp +++ b/source/blender/compositor/operations/COM_CropOperation.cpp @@ -23,7 +23,7 @@ #include "COM_CropOperation.h" #include "BLI_math.h" -CropBaseOperation::CropBaseOperation() :NodeOperation(){ +CropBaseOperation::CropBaseOperation() :NodeOperation() { this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); this->addOutputSocket(COM_DT_COLOR); this->inputOperation = NULL; @@ -34,7 +34,7 @@ void CropBaseOperation::updateArea() { SocketReader * inputReference = this->getInputSocketReader(0); float width = inputReference->getWidth(); float height = inputReference->getHeight(); - if (this->relative){ + if (this->relative) { settings->x1= width * settings->fac_x1; settings->x2= width * settings->fac_x2; settings->y1= height * settings->fac_y1; @@ -55,22 +55,23 @@ void CropBaseOperation::updateArea() { this->ymin = MIN2(settings->y1, settings->y2); } -void CropBaseOperation::initExecution(){ +void CropBaseOperation::initExecution() { this->inputOperation = this->getInputSocketReader(0); updateArea(); } -void CropBaseOperation::deinitExecution(){ +void CropBaseOperation::deinitExecution() { this->inputOperation = NULL; } -CropOperation::CropOperation() :CropBaseOperation(){ +CropOperation::CropOperation() :CropBaseOperation() { } -void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]){ - if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)){ +void CropOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { + if ((x < this->xmax && x >= xmin) && (y < ymax && y >= ymin)) { inputOperation->read(color, x, y, sampler, inputBuffers); - } else { + } + else { color[0] = 0.0f; color[1] = 0.0f; color[2] = 0.0f; @@ -78,10 +79,10 @@ void CropOperation::executePixel(float *color, float x, float y, PixelSampler sa } } -CropImageOperation::CropImageOperation() :CropBaseOperation(){ +CropImageOperation::CropImageOperation() :CropBaseOperation() { } -bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output){ +bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; newInput.xmax = input->xmax + this->xmin; @@ -92,13 +93,13 @@ bool CropImageOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } -void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]){ +void CropImageOperation::determineResolution(unsigned int resolution[], unsigned int preferedResolution[]) { NodeOperation::determineResolution(resolution, preferedResolution); updateArea(); resolution[0] = this->xmax - this->xmin; resolution[1] = this->ymax - this->ymin; } -void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]){ +void CropImageOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { this->inputOperation->read(color, (x + this->xmin), (y + this->ymin), sampler, inputBuffers); } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp index 92d9e29dcec..c64f2593318 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cpp @@ -61,15 +61,15 @@ void DifferenceMatteOperation::executePixel(float* outputValue, float x, float y difference=difference/3.0; /*make 100% transparent*/ - if(difference < tolerence) { + if (difference < tolerence) { outputValue[0]=0.0; } /*in the falloff region, make partially transparent */ - else if(difference < falloff+tolerence) { + else if (difference < falloff+tolerence) { difference=difference-tolerence; alpha=difference/falloff; /*only change if more transparent than before */ - if(alpha < inColor1[3]) { + if (alpha < inColor1[3]) { outputValue[0]=alpha; } else { /* leave as before */ diff --git a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp index df3bf996c96..c34d8976719 100644 --- a/source/blender/compositor/operations/COM_DilateErodeOperation.cpp +++ b/source/blender/compositor/operations/COM_DilateErodeOperation.cpp @@ -36,10 +36,12 @@ void DilateErodeOperation::initExecution() { this->inputProgram = this->getInputSocketReader(0); if (this->distance < 0.0f) { this->scope = - this->distance + this->inset; - } else { + } + else { if (this->inset*2 > this->distance) { this->scope = max(this->inset*2 - this->distance, this->distance); - } else { + } + else { this->scope = distance; } } @@ -87,7 +89,8 @@ void DilateErodeOperation::executePixel(float* color, int x, int y, MemoryBuffer } } pixelvalue = -sqrtf(mindist); - } else { + } + else { for (int yi = miny ; yiymin)*bufferWidth+(minx-rect->xmin))*4; for (int xi = minx ; xi= 0.0f) { if (delta >= inset) { color[0] = 1.0f; - } else { + } + else { color[0] = delta/inset; } - } else { + } + else { color[0] = 0.0f; } - } else { + } + else { const float delta = -distance+pixelvalue; if (delta < 0.0f) { if (delta < -inset) { color[0] = 1.0f; - } else { + } + else { color[0] = (-delta)/inset; } - } else { + } + else { color[0] = 0.0f; } } diff --git a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp index 5b066d8f16e..4b4e9ce851a 100644 --- a/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_DirectionalBlurOperation.cpp @@ -73,7 +73,7 @@ void DirectionalBlurOperation::executePixel(float* color, int x, int y, MemoryBu float lsc = sc; float lrot = rot; /* blur the image */ - for(int i= 0; i < iterations; ++i) { + for (int i= 0; i < iterations; ++i) { const float cs= cos(lrot), ss= sin(lrot); const float isc= 1.f / (1.f + lsc); diff --git a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp index bef470ca9de..ab4df7bf1ac 100644 --- a/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_DistanceMatteOperation.cpp @@ -63,15 +63,15 @@ void DistanceMatteOperation::executePixel(float* outputValue, float x, float y, */ /*make 100% transparent */ - if(distance < tolerence) { + if (distance < tolerence) { outputValue[0]=0.f; } /*in the falloff region, make partially transparent */ - else if(distance < falloff+tolerence){ + else if (distance < falloff+tolerence) { distance=distance-tolerence; alpha=distance/falloff; /*only change if more transparent than before */ - if(alpha < inImage[3]) { + if (alpha < inImage[3]) { outputValue[0]=alpha; } else { /* leave as before */ diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp index cb6b27b9da1..b42e676893a 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cpp @@ -26,7 +26,7 @@ // this part has been copied from the double edge mask // Contributor(s): Peter Larabell. -static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -35,134 +35,150 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { - res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + else { + res[x] = 1.0f; // pixel is just part of inner mask, and it's not an edge + } + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size - lres[x]=3; // flag pixel as outer edge + lres[x] = 3; // flag pixel as outer edge } /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the right, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the right, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } @@ -173,7 +189,7 @@ static void do_adjacentKeepBorders(unsigned int t, unsigned int rw, unsigned int rsize[2]=gsz; } -static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -182,20 +198,23 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -203,20 +222,23 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel underneath, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -224,20 +246,23 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty above or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -245,41 +270,47 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if pixel above, or to the left, are empty in the inner mask, // but filled in the outer mask - if((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])){ + if ((!limask[x+rw] && lomask[x+rw]) || (!limask[x-1] && lomask[x-1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the left, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -287,44 +318,50 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel to the left, or to the right, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { + if ((!limask[x-1] && lomask[x-1]) || (!limask[x+1] && lomask[x+1])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -332,22 +369,25 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if pixel underneath, or above, are empty in the inner mask, // but filled in the outer mask - if((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { + if ((!limask[x-rw] && lomask[x-rw]) || (!limask[x+rw] && lomask[x+rw])) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -359,7 +399,7 @@ static void do_adjacentBleedBorders(unsigned int t, unsigned int rw, unsigned in rsize[2]=gsz; } -static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -368,126 +408,142 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the right - if(!limask[x-rw] || !limask[x+1]){ + if (!limask[x-rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the left - if(!limask[x-rw] || !limask[x-1]){ + if (!limask[x-rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the right - if(!limask[x+rw] || !limask[x+1]){ + if (!limask[x+rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the left - if(!limask[x+rw] || !limask[x-1]){ + if (!limask[x+rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge } @@ -498,7 +554,7 @@ static void do_allKeepBorders(unsigned int t, unsigned int rw, unsigned int *lim rsize[2]=gsz; } -static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize){ +static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize) { int x; unsigned int isz=0; // inner edge size unsigned int osz=0; // outer edge size @@ -507,19 +563,22 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* upper left corner */ x=t-rw+1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the right - if(!limask[x-rw] || !limask[x+1]){ + if (!limask[x-rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -527,19 +586,22 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* upper right corner */ x=t; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if the inner mask is empty underneath or to the left - if(!limask[x-rw] || !limask[x-1]){ + if (!limask[x-rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x-1]) { // test if outer mask is empty above or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -547,19 +609,22 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* lower left corner */ x=0; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the right - if(!limask[x+rw] || !limask[x+1]){ + if (!limask[x+rw] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x+1]) { // test if outer mask is empty underneath or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -567,39 +632,45 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li /* lower right corner */ x=rw-1; // test if inner mask is filled - if(limask[x]){ + if (limask[x]) { // test if inner mask is empty above or to the left - if(!limask[x+rw] || !limask[x-1]){ + if (!limask[x+rw] || !limask[x-1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]){ // inner mask was empty, test if outer mask is filled - if(!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x+rw] || !lomask[x-1]) { // test if outer mask is empty underneath or to the left osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } /* Test the TOP row of pixels in buffer, except corners */ - for(x= t-1; x>=(t-rw)+2; x--) { + for (x= t-1; x>=(t-rw)+2; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -607,42 +678,48 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } /* Test the BOTTOM row of pixels in buffer, except corners */ - for(x= rw-2; x; x--) { + for (x= rw-2; x; x--) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty to the left or to the right - if(!limask[x-1] || !limask[x+1]) { + if (!limask[x-1] || !limask[x+1]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-1] || !lomask[x+1]) { // test if outer mask is empty to the left or to the right osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } } } /* Test the LEFT edge of pixels in buffer, except corners */ - for(x= t-(rw<<1)+1; x>=rw; x-=rw) { + for (x= t-(rw<<1)+1; x>=rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -650,21 +727,24 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li } /* Test the RIGHT edge of pixels in buffer, except corners */ - for(x= t-rw; x>rw; x-=rw) { + for (x= t-rw; x>rw; x-=rw) { // test if inner mask is filled - if(limask[x]) { + if (limask[x]) { // test if inner mask is empty underneath or above - if(!limask[x-rw] || !limask[x+rw]) { + if (!limask[x-rw] || !limask[x+rw]) { isz++; // increment inner edge size lres[x]=4; // flag pixel as inner edge - } else { + } + else { res[x]=1.0f; // pixel is just part of inner mask, and it's not an edge } - } else if(lomask[x]) { // inner mask was empty, test if outer mask is filled - if(!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above + } + else if (lomask[x]) { // inner mask was empty, test if outer mask is filled + if (!lomask[x-rw] || !lomask[x+rw]) { // test if outer mask is empty underneath or above osz++; // increment outer edge size lres[x]=3; // flag pixel as outer edge - } else { + } + else { gsz++; // increment the gradient pixel count lres[x]=2; // flag pixel as gradient } @@ -676,7 +756,7 @@ static void do_allBleedBorders(unsigned int t, unsigned int rw, unsigned int *li rsize[2]=gsz; } -static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){ +static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) { int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -685,39 +765,42 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop /* Test all rows between the FIRST and LAST rows, excluding left and right edges */ - for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { + for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { a=x-2; pix_prevRow=a+rw; pix_nextRow=a-rw; pix_prevCol=a+1; pix_nextCol=a-1; - while(a>dx-2) { - if(!limask[a]) { // if the inner mask is empty - if(lomask[a]) { // if the outer mask is full + while (a>dx-2) { + if (!limask[a]) { // if the inner mask is empty + if (lomask[a]) { // if the outer mask is full /* Next we test all 4 directions around the current pixel: next/prev/up/down The test ensures that the outer mask is empty and that the inner mask is also empty. If both conditions are true for any one of the 4 adjacent pixels then the current pixel is counted as being a true outer edge pixel. */ - if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || + if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) || (!lomask[pix_prevCol] && !limask[pix_prevCol]) || (!lomask[pix_nextRow] && !limask[pix_nextRow]) || (!lomask[pix_prevRow] && !limask[pix_prevRow])) { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge - } else { // it's not a boundary pixel, but it is a gradient pixel + } + else { // it's not a boundary pixel, but it is a gradient pixel in_gsz++; // increment the gradient pixel count lres[a]=2; // flag pixel as gradient } } - } else { - if(!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { + } + else { + if (!limask[pix_nextCol] || !limask[pix_prevCol] || !limask[pix_nextRow] || !limask[pix_prevRow]) { in_isz++; // increment the inner boundary pixel count lres[a]=4; // flag pixel as part of inner edge - } else { + } + else { res[a]=1.0f; // pixel is part of inner mask, but not at an edge } } @@ -734,7 +817,7 @@ static void do_allEdgeDetection(unsigned int t, unsigned int rw, unsigned int *l rsize[2]=in_gsz; } -static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz){ +static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned int *limask, unsigned int *lomask, unsigned int *lres, float *res, unsigned int *rsize, unsigned int in_isz, unsigned int in_osz, unsigned int in_gsz) { int x; // x = pixel loop counter int a; // a = pixel loop counter int dx; // dx = delta x @@ -743,43 +826,46 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i int pix_prevCol; // pix_prevCol = pixel one column behind the one we are testing in a loop int pix_nextCol; // pix_nextCol = pixel one column in front of the one we are testing in a loop /* Test all rows between the FIRST and LAST rows, excluding left and right edges */ - for(x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { + for (x= (t-rw)+1, dx=x-(rw-2); dx>rw; x-=rw,dx-=rw) { a=x-2; pix_prevRow=a+rw; pix_nextRow=a-rw; pix_prevCol=a+1; pix_nextCol=a-1; - while(a>dx-2) { - if(!limask[a]) { // if the inner mask is empty - if(lomask[a]) { // if the outer mask is full + while (a>dx-2) { + if (!limask[a]) { // if the inner mask is empty + if (lomask[a]) { // if the outer mask is full /* Next we test all 4 directions around the current pixel: next/prev/up/down The test ensures that the outer mask is empty and that the inner mask is also empty. If both conditions are true for any one of the 4 adjacent pixels then the current pixel is counted as being a true outer edge pixel. */ - if((!lomask[pix_nextCol] && !limask[pix_nextCol]) || + if ((!lomask[pix_nextCol] && !limask[pix_nextCol]) || (!lomask[pix_prevCol] && !limask[pix_prevCol]) || (!lomask[pix_nextRow] && !limask[pix_nextRow]) || (!lomask[pix_prevRow] && !limask[pix_prevRow])) { in_osz++; // increment the outer boundary pixel count lres[a]=3; // flag pixel as part of outer edge - } else { // it's not a boundary pixel, but it is a gradient pixel + } + else { // it's not a boundary pixel, but it is a gradient pixel in_gsz++; // increment the gradient pixel count lres[a]=2; // flag pixel as gradient } } - } else { - if((!limask[pix_nextCol] && lomask[pix_nextCol]) || + } + else { + if ((!limask[pix_nextCol] && lomask[pix_nextCol]) || (!limask[pix_prevCol] && lomask[pix_prevCol]) || (!limask[pix_nextRow] && lomask[pix_nextRow]) || (!limask[pix_prevRow] && lomask[pix_prevRow])) { in_isz++; // increment the inner boundary pixel count lres[a]=4; // flag pixel as part of inner edge - } else { + } + else { res[a]=1.0f; // pixel is part of inner mask, but not at an edge } } @@ -796,7 +882,7 @@ static void do_adjacentEdgeDetection(unsigned int t, unsigned int rw, unsigned i rsize[2]=in_gsz; } -static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz){ +static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigned int *lres, float *res, unsigned short *gbuf, unsigned int *innerEdgeOffset, unsigned int *outerEdgeOffset, unsigned int isz, unsigned int gsz) { int x; // x = pixel loop counter int a; // a = temporary pixel index buffer loop counter unsigned int ud; // ud = unscaled edge distance @@ -878,21 +964,23 @@ static void do_createEdgeLocationBuffer(unsigned int t, unsigned int rw, unsigne innerAccum = *innerEdgeOffset; // section's offset so when we start filling, each outerAccum = *outerEdgeOffset; // section fills up it's allocated space in gbuf //uses dmin=row, rsl=col - for(x=0,dmin=0; x=0; x--) { + for (x= gsz-1; x>=0; x--) { gradientFillOffset=x<<1; t=gbuf[gradientFillOffset]; // calculate column of pixel indexed by gbuf[x] fsz=gbuf[gradientFillOffset+1]; // calculate row of pixel indexed by gbuf[x] dmin=0xffffffff; // reset min distance to edge pixel - for(a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels + for (a=outerEdgeOffset+osz-1; a>=outerEdgeOffset; a--) { // loop through all outer edge buffer pixels ud=a<<1; dy=t-gbuf[ud]; // set dx to gradient pixel column - outer edge pixel row dx=fsz-gbuf[ud+1]; // set dy to gradient pixel row - outer edge pixel column ud=dx*dx+dy*dy; // compute sum of squares - if(ud=innerEdgeOffset; a--) { // loop through all inside edge pixels + for (a= innerEdgeOffset+isz-1; a>=innerEdgeOffset; a--) { // loop through all inside edge pixels ud=a<<1; dy=t-gbuf[ud]; // compute delta in Y from gradient pixel to inside edge pixel dx=fsz-gbuf[ud+1]; // compute delta in X from gradient pixel to inside edge pixel ud=dx*dx+dy*dy; // compute sum of squares - if(udgetWidth()*this->getHeight())-1; // determine size of the frame @@ -1087,10 +1175,11 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float Each version has slightly different criteria for detecting an edge pixel. */ - if(this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on - if(this->keepInside) { // if "keep inside" buffer edge mode is turned on + if (this->adjecentOnly) { // if "adjacent only" inner edge mode is turned on + if (this->keepInside) { // if "keep inside" buffer edge mode is turned on do_adjacentKeepBorders(t,rw,limask,lomask,lres,res,rsize); - }else{ // "bleed out" buffer edge mode is turned on + } + else { // "bleed out" buffer edge mode is turned on do_adjacentBleedBorders(t,rw,limask,lomask,lres,res,rsize); } isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass @@ -1098,10 +1187,12 @@ void DoubleEdgeMaskOperation::doDoubleEdgeMask(float* imask, float *omask, float gsz=rsize[2]; // detect edges in all non-border pixels in the buffer do_adjacentEdgeDetection(t,rw,limask,lomask,lres,res,rsize,isz,osz,gsz); - }else{ // "all" inner edge mode is turned on - if(this->keepInside) { // if "keep inside" buffer edge mode is turned on + } + else { // "all" inner edge mode is turned on + if (this->keepInside) { // if "keep inside" buffer edge mode is turned on do_allKeepBorders(t,rw,limask,lomask,lres,res,rsize); - }else{ // "bleed out" buffer edge mode is turned on + } + else { // "bleed out" buffer edge mode is turned on do_allBleedBorders(t,rw,limask,lomask,lres,res,rsize); } isz=rsize[0]; // set up inner edge, outer edge, and gradient buffer sizes after border pass @@ -1144,7 +1235,8 @@ bool DoubleEdgeMaskOperation::determineDependingAreaOfInterest(rcti *input, Read newInput.ymax = this->getHeight(); newInput.ymin = 0; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); - } else { + } + else { return false; } } diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 033cb4da84d..bc15523c149 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -72,7 +72,8 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam case CMP_NODE_MASKTYPE_ADD: if (inside) { color[0] = max(inputMask[0],inputValue[0]); - } else { + } + else { color[0] = inputMask[0]; } break; @@ -80,14 +81,16 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam if (inside) { color[0] = inputMask[0]-inputValue[0]; CLAMP(color[0], 0, 1); - } else { + } + else { color[0] = inputMask[0]; } break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { color[0] = inputMask[0]*inputValue[0]; - } else { + } + else { color[0] = 0; } break; @@ -95,10 +98,12 @@ void EllipseMaskOperation::executePixel(float* color, float x, float y, PixelSam if (inside) { if (inputMask[0]>0.0f) { color[0] = 0; - } else { + } + else { color[0] = inputValue[0]; } - } else { + } + else { color[0] = inputMask[0]; } break; diff --git a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp index aae39694220..6194e1d6699 100644 --- a/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_FastGaussianBlurOperation.cpp @@ -24,7 +24,7 @@ #include "MEM_guardedalloc.h" #include "BLI_utildefines.h" -FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation(){ +FastGaussianBlurOperation::FastGaussianBlurOperation(): BlurBaseOperation() { this->iirgaus = false; } @@ -34,7 +34,7 @@ void FastGaussianBlurOperation::executePixel(float *color,int x, int y, MemoryBu newData->read(color, x, y); } -bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output){ +bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) { rcti newInput; rcti sizeInput; sizeInput.xmin = 0; @@ -45,13 +45,15 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re NodeOperation * operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - }else { - if(this->iirgaus){ + } + else { + if (this->iirgaus) { newInput.xmax = input->xmax + (sx); newInput.xmin = input->xmin - (sx); newInput.ymax = input->ymax + (sy); newInput.ymin = input->ymin - (sy); - }else { + } + else { newInput.xmin = 0; newInput.ymin = 0; newInput.xmax = this->getWidth(); @@ -61,7 +63,7 @@ bool FastGaussianBlurOperation::determineDependingAreaOfInterest(rcti *input, Re } } -void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers){ +void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers) { MemoryBuffer *newBuf = (MemoryBuffer*)this->inputProgram->initializeTileData(rect, memoryBuffers); MemoryBuffer *copy = newBuf->duplicate(); updateSize(memoryBuffers); @@ -88,7 +90,7 @@ void* FastGaussianBlurOperation::initializeTileData(rcti *rect, MemoryBuffer **m return copy; } -void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data){ +void FastGaussianBlurOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data) { MemoryBuffer *newData = (MemoryBuffer*)data; delete newData; } diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index afe3173ab0f..98acb4cfb5d 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -52,14 +52,16 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper if (this->flipX) { newInput.xmax = (this->getWidth()- 1 - input->xmin)+1; newInput.xmin = (this->getWidth()- 1 - input->xmax)-1; - } else { + } + else { newInput.xmin = input->xmin; newInput.xmax = input->xmax; } if (this->flipY) { newInput.ymax = (this->getHeight()- 1 - input->ymin)+1; newInput.ymin = (this->getHeight()- 1 - input->ymax)-1; - } else { + } + else { newInput.ymin = input->ymin; newInput.ymax = input->ymax; } diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp index 9b7df61143e..faadad27a55 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp @@ -51,16 +51,16 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { updateSize(memoryBuffers); radxf = size*(float)this->data->sizex; - if(radxf>width/2.0f) + if (radxf>width/2.0f) radxf= width/2.0f; - else if(radxf<1.0f) + else if (radxf<1.0f) radxf= 1.0f; /* vertical */ radyf = size*(float)this->data->sizey; - if(radyf>height/2.0f) + if (radyf>height/2.0f) radyf= height/2.0f; - else if(radyf<1.0f) + else if (radyf<1.0f) radyf= 1.0f; radx= ceil(radxf); @@ -72,8 +72,8 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { ddgauss= new float[n]; dgauss= ddgauss; val= 0.0f; - for(j=-rady; j<=rady; j++) { - for(i=-radx; i<=radx; i++, dgauss++) { + for (j=-rady; j<=rady; j++) { + for (i=-radx; i<=radx; i++, dgauss++) { float fj= (float)j/radyf; float fi= (float)i/radxf; float dist= sqrt(fj*fj + fi*fi); @@ -82,9 +82,9 @@ void GaussianBokehBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { val+= *dgauss; } } - if(val!=0.0f) { + if (val!=0.0f) { val= 1.0f/val; - for(j= n -1; j>=0; j--) + for (j= n -1; j>=0; j--) ddgauss[j]*= val; } else ddgauss[4]= 1.0f; @@ -155,7 +155,8 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - } else { + } + else { if (this->gausstab) { int addx = radx; int addy = rady; @@ -163,7 +164,8 @@ bool GaussianBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, R newInput.xmin = input->xmin - addx; newInput.ymax = input->ymax + addy; newInput.ymin = input->ymin - addy; - } else { + } + else { newInput.xmin = 0; newInput.ymin = 0; newInput.xmax = this->getWidth(); diff --git a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp index a93c0e44d18..7ac8fcb2d64 100644 --- a/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp @@ -43,7 +43,7 @@ void GaussianXBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { updateSize(memoryBuffers); float rad = size*this->data->sizex; - if(rad<1) + if (rad<1) rad= 1; this->rad = rad; @@ -111,13 +111,15 @@ bool GaussianXBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB NodeOperation * operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - }else { + } + else { if (this->gausstab == NULL) { newInput.xmax = this->getWidth(); newInput.xmin = 0; newInput.ymax = this->getHeight(); newInput.ymin = 0; - }else{ + } + else { newInput.xmax = input->xmax + rad; newInput.xmin = input->xmin - rad; newInput.ymax = input->ymax; diff --git a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp index 86f9dbf5c40..2218334bec8 100644 --- a/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp @@ -42,7 +42,7 @@ void GaussianYBlurOperation::updateGauss(MemoryBuffer **memoryBuffers) { if (this->gausstab == NULL) { updateSize(memoryBuffers); float rad = size*this->data->sizey; - if(rad<1) + if (rad<1) rad= 1; this->rad = rad; @@ -108,13 +108,15 @@ bool GaussianYBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadB NodeOperation * operation = this->getInputOperation(1); if (operation->determineDependingAreaOfInterest(&sizeInput, readOperation, output)) { return true; - }else { + } + else { if (this->gausstab == NULL) { newInput.xmax = this->getWidth(); newInput.xmin = 0; newInput.ymax = this->getHeight(); newInput.ymin = 0; - } else { + } + else { newInput.xmax = input->xmax; newInput.xmin = input->xmin; newInput.ymax = input->ymax + rad; diff --git a/source/blender/compositor/operations/COM_ImageOperation.cpp b/source/blender/compositor/operations/COM_ImageOperation.cpp index 52c2e44f7d4..f4cea24cb20 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cpp +++ b/source/blender/compositor/operations/COM_ImageOperation.cpp @@ -61,7 +61,7 @@ ImBuf* BaseImageOperation::getImBuf() { ImBuf *ibuf; ibuf= BKE_image_get_ibuf(this->image, this->imageUser); - if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { + if (ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL)) { return NULL; } @@ -102,7 +102,8 @@ void ImageOperation::executePixel(float *color, float x, float y, PixelSampler s color[1] = 0.0f; color[2] = 0.0f; color[3] = 0.0f; - } else { + } + else { switch (sampler) { case COM_PS_NEAREST: neareast_interpolation_color(this->buffer, NULL, color, x, y); @@ -122,7 +123,8 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp if (this->imageBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { tempcolor[3] = 1.0f; switch (sampler) { case COM_PS_NEAREST: @@ -142,7 +144,8 @@ void ImageAlphaOperation::executePixel(float *color, float x, float y, PixelSamp void ImageDepthOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { if (this->depthBuffer == NULL || x < 0 || y < 0 || x >= this->getWidth() || y >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { int offset = y * width + x; color[0] = this->depthBuffer[offset]; } diff --git a/source/blender/compositor/operations/COM_InvertOperation.cpp b/source/blender/compositor/operations/COM_InvertOperation.cpp index a90c7b6b8d2..baf8699603c 100644 --- a/source/blender/compositor/operations/COM_InvertOperation.cpp +++ b/source/blender/compositor/operations/COM_InvertOperation.cpp @@ -46,17 +46,18 @@ void InvertOperation::executePixel(float* out, float x, float y, PixelSampler sa const float value = inputValue[0]; const float invertedValue = 1.0f - value; - if(color) { + if (color) { out[0] = (1.0f - inputColor[0])*value + inputColor[0]*invertedValue; out[1] = (1.0f - inputColor[1])*value + inputColor[1]*invertedValue; out[2] = (1.0f - inputColor[2])*value + inputColor[2]*invertedValue; - } else { + } + else { out[0] = inputColor[0]; out[1] = inputColor[1]; out[2] = inputColor[2]; } - if(alpha) + if (alpha) out[3] = (1.0f - inputColor[3])*value + inputColor[3]*invertedValue; else out[3] = inputColor[3]; diff --git a/source/blender/compositor/operations/COM_LensGhostOperation.cpp b/source/blender/compositor/operations/COM_LensGhostOperation.cpp index 6236708c9e1..89387675090 100644 --- a/source/blender/compositor/operations/COM_LensGhostOperation.cpp +++ b/source/blender/compositor/operations/COM_LensGhostOperation.cpp @@ -119,7 +119,8 @@ public: float b2c = b*b-c; if (b2c < 0) { result->hit = false; - } else { + } + else { float sgn = (this->radius*ray->direction[2])>0?1.0f:-1.0f; float t = sqrtf(b2c)*sgn-b; result->position[0] = ray->direction[0]*t+ray->position[0]; @@ -137,7 +138,8 @@ public: result->normal[0] = -p[0]; result->normal[1] = -p[1]; result->normal[2] = -p[2]; - } else { + } + else { result->normal[0] = p[0]; result->normal[1] = p[1]; result->normal[2] = p[2]; @@ -168,7 +170,7 @@ public: bool valid; bool hasIntensity; }; -class Bounce{ +class Bounce { public: LensInterface *interface1; LensInterface *interface2; @@ -245,15 +247,15 @@ public: // dot= view[0]*n[0] + view[1]*n[1] + view[2]*n[2]; -// if(dot>0.0f) { +// if (dot>0.0f) { // index = 1.0f/index; // fac= 1.0f - (1.0f - dot*dot)*index*index; -// if(fac<= 0.0f) return 0; +// if (fac<= 0.0f) return 0; // fac= -dot*index + sqrt(fac); // } // else { // fac= 1.0f - (1.0f - dot*dot)*index*index; -// if(fac<= 0.0f) return 0; +// if (fac<= 0.0f) return 0; // fac= -dot*index - sqrt(fac); // } @@ -281,7 +283,8 @@ public: // double test = 1.0f - index*index*(1.0f-ni*ni); // if (test < 0) { // return 0; -// } else { +// } +// else { // double mul = index*ni + sqrt(test); // refract[0] = index * view[0] - mul*n[0]; // refract[1] = index * view[1] - mul*n[1]; @@ -348,7 +351,8 @@ public: delta = -delta; if (phase == 0) { next = bounce->interface2; - } else { + } + else { next = NULL; } phase ++; @@ -399,7 +403,8 @@ public: if (ref == 0) { break; } - } else { + } + else { this->reflection(result->direction, intersection.normal, result->direction); float fresnelMultiplyer = fresnelAR(intersection.theta, result->wavelength, f->thicknessCoathing, n0, n1, n2); if (isnan(fresnelMultiplyer)) { @@ -412,7 +417,8 @@ public: } if (k < bounce->length-1) { result->intensity = 0; - } else { + } + else { result->valid = true; } } @@ -446,7 +452,8 @@ void LensGhostProjectionOperation::initExecution() { visualLampPosition[0] = 0; visualLampPosition[1] = 0; visualLampPosition[2] = 0; - } else { + } + else { /* too simple, better to return the distance on the view axis only * return len_v3v3(ob->obmat[3], cam->dof_ob->obmat[3]); */ float matt[4][4], imat[4][4], obmat[4][4]; @@ -612,21 +619,25 @@ void* LensGhostOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBu face->v2 = vertex4; face->v3 = vertex1; result->push_back(face); - } else if (number == 3) { + } + else if (number == 3) { LensFace *face = new LensFace(); if (!vertex1->hasIntensity) { face->v1 = vertex2; face->v2 = vertex3; face->v3 = vertex4; - } else if (!vertex2->hasIntensity) { + } + else if (!vertex2->hasIntensity) { face->v1 = vertex1; face->v2 = vertex3; face->v3 = vertex4; - } else if (!vertex3->hasIntensity) { + } + else if (!vertex3->hasIntensity) { face->v1 = vertex1; face->v2 = vertex2; face->v3 = vertex4; - } else { + } + else { face->v1 = vertex1; face->v2 = vertex2; face->v3 = vertex3; diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp index 7850a631212..3e8a5ed3344 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cpp @@ -52,10 +52,10 @@ void LuminanceMatteOperation::executePixel(float* outputValue, float x, float y, */ /* test range*/ - if(inColor[0] > high) { + if (inColor[0] > high) { alpha=1.f; } - else if(inColor[0] < low){ + else if (inColor[0] < low) { alpha=0.f; } else {/*blend */ diff --git a/source/blender/compositor/operations/COM_MapUVOperation.cpp b/source/blender/compositor/operations/COM_MapUVOperation.cpp index ef0c9004a7d..08790955d03 100644 --- a/source/blender/compositor/operations/COM_MapUVOperation.cpp +++ b/source/blender/compositor/operations/COM_MapUVOperation.cpp @@ -110,7 +110,7 @@ void MapUVOperation::executePixel(float* color, float x, float y, PixelSampler s this->inputColorProgram->read(color, u, v, dx, dy, inputBuffers); /* "premul" */ - if(alpha < 1.0f) { + if (alpha < 1.0f) { color[0]*= alpha; color[1]*= alpha; color[2]*= alpha; diff --git a/source/blender/compositor/operations/COM_MapValueOperation.cpp b/source/blender/compositor/operations/COM_MapValueOperation.cpp index 33d38b8475d..5a7005af382 100644 --- a/source/blender/compositor/operations/COM_MapValueOperation.cpp +++ b/source/blender/compositor/operations/COM_MapValueOperation.cpp @@ -37,11 +37,11 @@ void MapValueOperation::executePixel(float* outputValue, float x, float y, Pixel inputOperation->read(src, x, y, sampler, inputBuffers); TexMapping *texmap= this->settings; float value = (src[0] + texmap->loc[0])*texmap->size[0]; - if(texmap->flag & TEXMAP_CLIP_MIN) - if(valuemin[0]) + if (texmap->flag & TEXMAP_CLIP_MIN) + if (valuemin[0]) value= texmap->min[0]; - if(texmap->flag & TEXMAP_CLIP_MAX) - if(value>texmap->max[0]) + if (texmap->flag & TEXMAP_CLIP_MAX) + if (value>texmap->max[0]) value= texmap->max[0]; outputValue[0] = value; diff --git a/source/blender/compositor/operations/COM_MathBaseOperation.cpp b/source/blender/compositor/operations/COM_MathBaseOperation.cpp index 55880566bf2..d612361a7fe 100644 --- a/source/blender/compositor/operations/COM_MathBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MathBaseOperation.cpp @@ -81,7 +81,7 @@ void MathDivideOperation::executePixel(float* outputValue, float x, float y, Pix inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if(inputValue2[0]==0) /* We don't want to divide by zero. */ + if (inputValue2[0]==0) /* We don't want to divide by zero. */ outputValue[0]= 0.0; else outputValue[0]= inputValue1[0] / inputValue2[0]; @@ -124,7 +124,7 @@ void MathArcSineOperation::executePixel(float* outputValue, float x, float y, Pi inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if(inputValue1[0] <= 1 && inputValue1[0] >= -1 ) + if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) outputValue[0]= asin(inputValue1[0]); else outputValue[0]= 0.0; @@ -137,7 +137,7 @@ void MathArcCosineOperation::executePixel(float* outputValue, float x, float y, inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if(inputValue1[0] <= 1 && inputValue1[0] >= -1 ) + if (inputValue1[0] <= 1 && inputValue1[0] >= -1 ) outputValue[0]= acos(inputValue1[0]); else outputValue[0]= 0.0; @@ -160,14 +160,16 @@ void MathPowerOperation::executePixel(float* outputValue, float x, float y, Pixe inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if( inputValue1[0] >= 0 ) { + if ( inputValue1[0] >= 0 ) { outputValue[0]= pow(inputValue1[0], inputValue2[0]); - } else { + } + else { float y_mod_1 = fmod(inputValue2[0], 1); /* if input value is not nearly an integer, fall back to zero, nicer than straight rounding */ if (y_mod_1 > 0.999 || y_mod_1 < 0.001) { outputValue[0]= pow(inputValue1[0], (float)floor(inputValue2[0] + 0.5)); - } else { + } + else { outputValue[0] = 0.0; } } @@ -180,7 +182,7 @@ void MathLogarithmOperation::executePixel(float* outputValue, float x, float y, inputValue1Operation->read(&inputValue1[0], x, y, sampler, inputBuffers); inputValue2Operation->read(&inputValue2[0], x, y, sampler, inputBuffers); - if( inputValue1[0] > 0 && inputValue2[0] > 0 ) + if ( inputValue1[0] > 0 && inputValue2[0] > 0 ) outputValue[0]= log(inputValue1[0]) / log(inputValue2[0]); else outputValue[0]= 0.0; diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index 9f8378defe9..a84ecc6edf8 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -64,23 +64,25 @@ void MixBaseOperation::deinitExecution() { this->inputColor2Operation = NULL; } -void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]){ +void MixBaseOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { InputSocket* socket; unsigned int tempPreferredResolution[] = {0,0}; unsigned int tempResolution[2]; socket = this->getInputSocket(1); socket->determineResolution(tempResolution, tempPreferredResolution); - if((tempResolution[0] != 0) && (tempResolution[1] != 0)){ + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { this->setResolutionInputSocketIndex(1); - }else { + } + else { socket = this->getInputSocket(2); tempPreferredResolution[0] = 0; tempPreferredResolution[1] = 0; socket->determineResolution(tempResolution, tempPreferredResolution); - if((tempResolution[0] != 0) && (tempResolution[1] != 0)){ + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { this->setResolutionInputSocketIndex(2); - }else { + } + else { this->setResolutionInputSocketIndex(0); } } diff --git a/source/blender/compositor/operations/COM_MixColorOperation.cpp b/source/blender/compositor/operations/COM_MixColorOperation.cpp index ebcb7056570..d5ec55daf07 100644 --- a/source/blender/compositor/operations/COM_MixColorOperation.cpp +++ b/source/blender/compositor/operations/COM_MixColorOperation.cpp @@ -45,7 +45,7 @@ void MixColorOperation::executePixel(float* outputValue, float x, float y, Pixel float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - if(colS!=0.0f){ + if (colS!=0.0f) { float rH,rS,rV; float tmpr,tmpg,tmpb; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); diff --git a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp index 773a51e92cb..7e8271a9c96 100644 --- a/source/blender/compositor/operations/COM_MixDarkenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDarkenOperation.cpp @@ -40,13 +40,13 @@ void MixDarkenOperation::executePixel(float* outputValue, float x, float y, Pixe float valuem = 1.0f-value; float tmp; tmp=inputColor2[0]+((1.0f-inputColor2[0])*valuem); - if(tmp < inputColor1[0]) outputValue[0]= tmp; + if (tmp < inputColor1[0]) outputValue[0]= tmp; else outputValue[0] = inputColor1[0]; tmp=inputColor2[1]+((1.0f-inputColor2[1])*valuem); - if(tmp < inputColor1[1]) outputValue[1]= tmp; + if (tmp < inputColor1[1]) outputValue[1]= tmp; else outputValue[1] = inputColor1[1]; tmp=inputColor2[2]+((1.0f-inputColor2[2])*valuem); - if(tmp < inputColor1[2]) outputValue[2]= tmp; + if (tmp < inputColor1[2]) outputValue[2]= tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_MixDivideOperation.cpp b/source/blender/compositor/operations/COM_MixDivideOperation.cpp index c2579c6a89c..6bab381c706 100644 --- a/source/blender/compositor/operations/COM_MixDivideOperation.cpp +++ b/source/blender/compositor/operations/COM_MixDivideOperation.cpp @@ -39,15 +39,15 @@ void MixDivideOperation::executePixel(float* outputValue, float x, float y, Pixe } float valuem= 1.0f-value; - if(inputColor2[0]!=0.0f) + if (inputColor2[0]!=0.0f) outputValue[0] = valuem*(inputColor1[0]) + value*(inputColor1[0])/inputColor2[0]; else outputValue[0] = 0.0f; - if(inputColor2[1]!=0.0f) + if (inputColor2[1]!=0.0f) outputValue[1] = valuem*(inputColor1[1]) + value*(inputColor1[1])/inputColor2[1]; else outputValue[1] = 0.0f; - if(inputColor2[2]!=0.0f) + if (inputColor2[2]!=0.0f) outputValue[2] = valuem*(inputColor1[2]) + value*(inputColor1[2])/inputColor2[2]; else outputValue[2] = 0.0f; diff --git a/source/blender/compositor/operations/COM_MixHueOperation.cpp b/source/blender/compositor/operations/COM_MixHueOperation.cpp index 386bd02ba2a..8454c694f65 100644 --- a/source/blender/compositor/operations/COM_MixHueOperation.cpp +++ b/source/blender/compositor/operations/COM_MixHueOperation.cpp @@ -45,7 +45,7 @@ void MixHueOperation::executePixel(float* outputValue, float x, float y, PixelSa float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); - if(colS!=0.0f){ + if (colS!=0.0f) { float rH,rS,rV; float tmpr,tmpg,tmpb; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); diff --git a/source/blender/compositor/operations/COM_MixLightenOperation.cpp b/source/blender/compositor/operations/COM_MixLightenOperation.cpp index 32d28b785b7..6a06d5ab6e1 100644 --- a/source/blender/compositor/operations/COM_MixLightenOperation.cpp +++ b/source/blender/compositor/operations/COM_MixLightenOperation.cpp @@ -39,13 +39,13 @@ void MixLightenOperation::executePixel(float* outputValue, float x, float y, Pix } float tmp; tmp=value * inputColor2[0]; - if(tmp > inputColor1[0]) outputValue[0]= tmp; + if (tmp > inputColor1[0]) outputValue[0]= tmp; else outputValue[0] = inputColor1[0]; tmp=value * inputColor2[1]; - if(tmp > inputColor1[1]) outputValue[1]= tmp; + if (tmp > inputColor1[1]) outputValue[1]= tmp; else outputValue[1] = inputColor1[1]; tmp=value * inputColor2[2]; - if(tmp > inputColor1[2]) outputValue[2]= tmp; + if (tmp > inputColor1[2]) outputValue[2]= tmp; else outputValue[2] = inputColor1[2]; outputValue[3] = inputColor1[3]; } diff --git a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp index 8254701adad..7a3030b9262 100644 --- a/source/blender/compositor/operations/COM_MixOverlayOperation.cpp +++ b/source/blender/compositor/operations/COM_MixOverlayOperation.cpp @@ -40,19 +40,22 @@ void MixOverlayOperation::executePixel(float* outputValue, float x, float y, Pix float valuem= 1.0f-value; - if(inputColor1[0] < 0.5f) { + if (inputColor1[0] < 0.5f) { outputValue[0] = inputColor1[0] * (valuem + 2.0f*value*inputColor2[0]); - } else { + } + else { outputValue[0] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[0])) * (1.0f - inputColor1[0]); } - if(inputColor1[1] < 0.5f) { + if (inputColor1[1] < 0.5f) { outputValue[1] = inputColor1[1] * (valuem + 2.0f*value*inputColor2[1]); - } else { + } + else { outputValue[1] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[1])) * (1.0f - inputColor1[1]); } - if(inputColor1[2] < 0.5f) { + if (inputColor1[2] < 0.5f) { outputValue[2] = inputColor1[2] * (valuem + 2.0f*value*inputColor2[2]); - } else { + } + else { outputValue[2] = 1.0f - (valuem + 2.0f*value*(1.0f - inputColor2[2])) * (1.0f - inputColor1[2]); } outputValue[3] = inputColor1[3]; diff --git a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp index 18ff6f46c46..a8fe647828b 100644 --- a/source/blender/compositor/operations/COM_MixSaturationOperation.cpp +++ b/source/blender/compositor/operations/COM_MixSaturationOperation.cpp @@ -45,7 +45,7 @@ void MixSaturationOperation::executePixel(float* outputValue, float x, float y, float rH,rS,rV; rgb_to_hsv(inputColor1[0], inputColor1[1], inputColor1[2], &rH, &rS, &rV); - if(rS!=0.0f){ + if (rS!=0.0f) { float colH,colS,colV; rgb_to_hsv(inputColor2[0], inputColor2[1], inputColor2[2], &colH, &colS, &colV); hsv_to_rgb(rH , (valuem*rS+value*colS), rV, &outputValue[0], &outputValue[1], &outputValue[2]); diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cpp b/source/blender/compositor/operations/COM_MovieClipOperation.cpp index 74179293c6c..7597497acc7 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cpp @@ -78,7 +78,8 @@ void MovieClipOperation::executePixel(float *color, float x, float y, PixelSampl color[1] = 0.0f; color[2] = 0.0f; color[3] = 0.0f; - } else { + } + else { switch (sampler) { case COM_PS_NEAREST: neareast_interpolation_color(this->movieClipBuffer, NULL, color, x, y); diff --git a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp index 360719aa59f..b848192d40b 100644 --- a/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieDistortionOperation.cpp @@ -54,7 +54,8 @@ void MovieDistortionOperation::initExecution() { DistortionCache* newC = new DistortionCache(this->movieClip, this->width, this->height, this->distortion); s_cache.push_back(newC); this->cache = newC; - } else { + } + else { this->cache = NULL; } } diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp index 53b71ed528e..df2b762b563 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp @@ -33,7 +33,7 @@ MultilayerBaseOperation::MultilayerBaseOperation(int pass): BaseImageOperation() ImBuf* MultilayerBaseOperation::getImBuf() { RenderPass *rpass; rpass = (RenderPass *)BLI_findlink(&this->renderlayer->passes, this->passId); - if(rpass) { + if (rpass) { this->imageUser->pass= this->passId; BKE_image_multilayer_index(image->rr, this->imageUser); return BaseImageOperation::getImBuf(); @@ -49,7 +49,8 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe color[1] = 0.0f; color[2] = 0.0f; color[3] = 0.0f; - } else { + } + else { if (this->numberOfChannels == 4) { switch (sampler) { case COM_PS_NEAREST: @@ -62,7 +63,8 @@ void MultilayerColorOperation::executePixel(float *color, float x, float y, Pixe bicubic_interpolation_color(this->buffer, NULL, color, x, y); break; } - } else { + } + else { int offset = (yi*this->getWidth()+xi)*3; color[0] = this->imageBuffer[offset]; color[1] = this->imageBuffer[offset+1]; @@ -76,7 +78,8 @@ void MultilayerValueOperation::executePixel(float *color, float x, float y, Pixe int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { float result = this->imageBuffer[yi*this->getWidth()+xi]; color[0] = result; } @@ -87,7 +90,8 @@ void MultilayerVectorOperation::executePixel(float *color, float x, float y, Pix int xi = x; if (this->imageBuffer == NULL || xi < 0 || yi < 0 || xi >= this->getWidth() || yi >= this->getHeight() ) { color[0] = 0.0f; - } else { + } + else { int offset = (yi*this->getWidth()+xi)*3; color[0] = this->imageBuffer[offset]; color[1] = this->imageBuffer[offset+1]; diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp index 4cf50823c00..adaba8e3330 100644 --- a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp +++ b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp @@ -3,7 +3,7 @@ const char* sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \ "\n" \ -"__kernel void testKernel(__global __write_only image2d_t output){\n" \ +"__kernel void testKernel(__global __write_only image2d_t output) {\n" \ " int x = get_global_id(0);\n" \ " int y = get_global_id(1);\n" \ " int2 coords = {x, y}; \n" \ diff --git a/source/blender/compositor/operations/COM_PreviewOperation.cpp b/source/blender/compositor/operations/COM_PreviewOperation.cpp index 5191c940f70..4a9d08380ea 100644 --- a/source/blender/compositor/operations/COM_PreviewOperation.cpp +++ b/source/blender/compositor/operations/COM_PreviewOperation.cpp @@ -52,7 +52,8 @@ void PreviewOperation::initExecution() { this->input = getInputSocketReader(0); if (!this->node->preview) { this->node->preview = (bNodePreview*)MEM_callocN(sizeof(bNodePreview), "node preview"); - } else { + } + else { if (this->getWidth() == (unsigned int)this->node->preview->xsize && this->getHeight() == (unsigned int)this->node->preview->ysize) { this->outputBuffer = this->node->preview->rect; } @@ -60,7 +61,7 @@ void PreviewOperation::initExecution() { if (this->outputBuffer == NULL) { this->outputBuffer = (unsigned char*)MEM_callocN(sizeof(unsigned char)*4*getWidth()*getHeight(), "PreviewOperation"); - if(this->node->preview->rect) { + if (this->node->preview->rect) { MEM_freeN(this->node->preview->rect); } this->node->preview->xsize= getWidth(); @@ -112,7 +113,8 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i this->divider = 0.0f; if (width > height) { divider = COM_PREVIEW_SIZE / (width-1); - } else { + } + else { divider = COM_PREVIEW_SIZE / (height-1); } width = width * divider; diff --git a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp index 483a75a69d2..69405ef6d23 100644 --- a/source/blender/compositor/operations/COM_ReadBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_ReadBufferOperation.cpp @@ -48,7 +48,8 @@ void ReadBufferOperation::executePixel(float* color, float x, float y, PixelSamp if (inputBuffer) { if (sampler == COM_PS_NEAREST) { inputBuffer->read(color, x, y); - } else { + } + else { inputBuffer->readCubic(color, x, y); } } diff --git a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp index d85d54489ac..d18915c593b 100644 --- a/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersAlphaProg.cpp @@ -36,7 +36,8 @@ void RenderLayersAlphaProg::executePixel(float* output, float x, float y, PixelS output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; - } else { + } + else { unsigned int offset = (iy*this->getWidth()+ix) * 4; output[0] = inputBuffer[offset+3]; output[1] = 0.0f; diff --git a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp index e63fcd5df4d..94ba8973314 100644 --- a/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp +++ b/source/blender/compositor/operations/COM_RenderLayersBaseProg.cpp @@ -44,15 +44,15 @@ void RenderLayersBaseProg::initExecution() { Render *re= (scene)? RE_GetRender(scene->id.name): NULL; RenderResult *rr= NULL; - if(re) + if (re) rr= RE_AcquireResultRead(re); - if(rr) { + if (rr) { SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&scene->r.layers, getLayerId()); - if(srl) { + if (srl) { RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if(rl && rl->rectf) { + if (rl && rl->rectf) { this->inputBuffer = RE_RenderLayerGetPass(rl, renderpass); if (this->inputBuffer == NULL || renderpass == SCE_PASS_COMBINED) { @@ -76,19 +76,22 @@ void RenderLayersBaseProg::executePixel(float* output, float x, float y, PixelSa output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; - } else { + } + else { unsigned int offset = (iy*this->getWidth()+ix) * elementsize; if (elementsize == 1) { output[0] = inputBuffer[offset]; output[1] = 0.0f; output[2] = 0.0f; output[3] = 0.0f; - } else if (elementsize == 3){ + } + else if (elementsize == 3) { output[0] = inputBuffer[offset]; output[1] = inputBuffer[offset+1]; output[2] = inputBuffer[offset+2]; output[3] = 1.0f; - } else { + } + else { output[0] = inputBuffer[offset]; output[1] = inputBuffer[offset+1]; output[2] = inputBuffer[offset+2]; @@ -109,21 +112,21 @@ void RenderLayersBaseProg::determineResolution(unsigned int resolution[], unsign resolution[0] = 0; resolution[1] = 0; - if(re) + if (re) rr= RE_AcquireResultRead(re); - if(rr) { + if (rr) { SceneRenderLayer *srl= (SceneRenderLayer*)BLI_findlink(&sce->r.layers, getLayerId()); - if(srl) { + if (srl) { RenderLayer *rl= RE_GetRenderLayer(rr, srl->name); - if(rl && rl->rectf) { + if (rl && rl->rectf) { resolution[0]=rl->rectx; resolution[1]=rl->recty; } } } - if(re) + if (re) RE_ReleaseResult(re); } diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index ef6c5bee90a..ac2e8c5e8a9 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -42,7 +42,8 @@ void RotateOperation::initExecution() { double rad; if (this->doDegree2RadConversion) { rad = DEG2RAD(degree[0]); - } else { + } + else { rad = degree[0]; } this->cosine = cos(rad); diff --git a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp index 87ef015384d..474874d4bb4 100644 --- a/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp +++ b/source/blender/compositor/operations/COM_ScreenLensDistortionOperation.cpp @@ -133,7 +133,8 @@ void ScreenLensDistortionOperation::executePixel(float* outputColor, int x, int /* set alpha */ outputColor[3]= 1.0f; - } else { + } + else { outputColor[0]= 0.0f; outputColor[1]= 0.0f; outputColor[2]= 0.0f; diff --git a/source/blender/compositor/operations/COM_SetVectorOperation.cpp b/source/blender/compositor/operations/COM_SetVectorOperation.cpp index b9c8f4bc369..3e9b68ac971 100644 --- a/source/blender/compositor/operations/COM_SetVectorOperation.cpp +++ b/source/blender/compositor/operations/COM_SetVectorOperation.cpp @@ -38,7 +38,8 @@ void SetVectorOperation::determineResolution(unsigned int resolution[], unsigned if (preferredResolution[0] == 0 ||preferredResolution[1]==0) { resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH; resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT; - } else { + } + else { resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } diff --git a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp index f9000cc63da..f2d5e491001 100644 --- a/source/blender/compositor/operations/COM_SplitViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_SplitViewerOperation.cpp @@ -77,17 +77,20 @@ void SplitViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me image1 = xSplit?x>perc:y>perc; if (image1) { image1Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers); - } else { + } + else { image2Input->read(&(buffer[offset]), x, y, COM_PS_NEAREST, memoryBuffers); } /// @todo: linear conversion only when scene color management is selected, also check predivide. if (this->doColorManagement) { - if(this->doColorPredivide) { + if (this->doColorPredivide) { linearrgb_to_srgb_predivide_v4(srgb, buffer+offset); - } else { + } + else { linearrgb_to_srgb_v4(srgb, buffer+offset); } - } else { + } + else { copy_v4_v4(srgb, buffer+offset); } diff --git a/source/blender/compositor/operations/COM_TextureOperation.cpp b/source/blender/compositor/operations/COM_TextureOperation.cpp index 1ca986f8893..3eb08140914 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cpp +++ b/source/blender/compositor/operations/COM_TextureOperation.cpp @@ -52,7 +52,8 @@ void TextureBaseOperation::determineResolution(unsigned int resolution[], unsign if (preferredResolution[0] == 0 || preferredResolution[1] == 0) { resolution[0] = COM_DEFAULT_RESOLUTION_WIDTH; resolution[1] = COM_DEFAULT_RESOLUTION_HEIGHT; - } else { + } + else { resolution[0] = preferredResolution[0]; resolution[1] = preferredResolution[1]; } @@ -86,12 +87,12 @@ void TextureBaseOperation::executePixel(float *color, float x, float y, PixelSam retval= multitex_ext(this->texture, vec, NULL, NULL, 0, &texres); - if(texres.talpha) + if (texres.talpha) color[3]= texres.ta; else color[3]= texres.tin; - if((retval & TEX_RGB)) { + if ((retval & TEX_RGB)) { color[0]= texres.tr; color[1]= texres.tg; color[2]= texres.tb; diff --git a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp index e97b1155e22..83b9f55b431 100644 --- a/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp @@ -84,7 +84,9 @@ void VariableSizeBokehBlurOperation::executePixel(float* color, int x, int y, Me float dx = nx - x; float dy = ny - y; if (nx == x && ny == y) { - } else if (size>= fabs(dx) && size >= fabs(dy)) { + /* pass */ + } + else if (size>= fabs(dx) && size >= fabs(dy)) { float u = 256+ dx*256/size; float v = 256+ dy*256/size; inputBokehProgram->read(bokeh, u, v, COM_PS_NEAREST, inputBuffers); diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp index 7d660177fbb..7b6ebe9728f 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cpp +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cpp @@ -94,7 +94,8 @@ bool VectorBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuff newInput.ymax = this->getHeight(); newInput.ymin = 0; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); - } else { + } + else { return false; } } diff --git a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp index 16143af7165..85b5cc4c3a8 100644 --- a/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerBaseOperation.cpp @@ -86,7 +86,8 @@ void ViewerBaseOperation::deinitExecution() { const int ViewerBaseOperation::getRenderPriority() const { if (this->isActiveViewerOutput()) { return 8; - } else { + } + else { return 0; } } diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index b0d443f1cbd..8fa63329e1f 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -85,12 +85,14 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber, MemoryB } /// @todo: linear conversion only when scene color management is selected, also check predivide. if (this->doColorManagement) { - if(this->doColorPredivide) { + if (this->doColorPredivide) { linearrgb_to_srgb_predivide_v4(srgb, buffer+offset); - } else { + } + else { linearrgb_to_srgb_v4(srgb, buffer+offset); } - } else { + } + else { copy_v4_v4(srgb, buffer+offset); } diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index 44a769ee947..6bb38c007ef 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -80,7 +80,8 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me this->input->deinitializeTileData(rect, memoryBuffers, data); data = NULL; } - } else { + } + else { int x1 = rect->xmin; int y1 = rect->ymin; int x2 = rect->xmax; diff --git a/source/blender/compositor/operations/COM_ZCombineOperation.cpp b/source/blender/compositor/operations/COM_ZCombineOperation.cpp index 9aa06df1ead..e45d66dd597 100644 --- a/source/blender/compositor/operations/COM_ZCombineOperation.cpp +++ b/source/blender/compositor/operations/COM_ZCombineOperation.cpp @@ -52,7 +52,8 @@ void ZCombineOperation::executePixel(float* color, float x, float y, PixelSample this->depth2Reader->read(depth2, x, y, sampler, inputBuffers); if (depth1[0]image1Reader->read(color, x, y, sampler, inputBuffers); - } else { + } + else { this->image2Reader->read(color, x, y, sampler, inputBuffers); } } @@ -67,7 +68,8 @@ void ZCombineAlphaOperation::executePixel(float* color, float x, float y, PixelS if (depth1[0]image1Reader->read(color1, x, y, sampler, inputBuffers); this->image2Reader->read(color2, x, y, sampler, inputBuffers); - } else { + } + else { this->image1Reader->read(color2, x, y, sampler, inputBuffers); this->image2Reader->read(color1, x, y, sampler, inputBuffers); } -- cgit v1.2.3