diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/compositor/nodes/COM_DilateErodeNode.cpp | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/compositor/nodes/COM_DilateErodeNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_DilateErodeNode.cpp | 221 |
1 files changed, 111 insertions, 110 deletions
diff --git a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp index bab54993eaf..cde94b23ed8 100644 --- a/source/blender/compositor/nodes/COM_DilateErodeNode.cpp +++ b/source/blender/compositor/nodes/COM_DilateErodeNode.cpp @@ -26,121 +26,122 @@ DilateErodeNode::DilateErodeNode(bNode *editorNode) : Node(editorNode) { - /* initialize node data */ - NodeBlurData *data = &m_alpha_blur; - memset(data, 0, sizeof(NodeBlurData)); - data->filtertype = R_FILTER_GAUSS; - - if (editorNode->custom2 > 0) { - data->sizex = data->sizey = editorNode->custom2; - } - else { - data->sizex = data->sizey = -editorNode->custom2; - } + /* initialize node data */ + NodeBlurData *data = &m_alpha_blur; + memset(data, 0, sizeof(NodeBlurData)); + data->filtertype = R_FILTER_GAUSS; + + if (editorNode->custom2 > 0) { + data->sizex = data->sizey = editorNode->custom2; + } + else { + data->sizex = data->sizey = -editorNode->custom2; + } } -void DilateErodeNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void DilateErodeNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *editorNode = this->getbNode(); - if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { - DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); - operation->setDistance(editorNode->custom2); - operation->setInset(editorNode->custom3); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - - if (editorNode->custom3 < 2.0f) { - AntiAliasOperation *antiAlias = new AntiAliasOperation(); - converter.addOperation(antiAlias); - - converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0)); - } - else { - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - } - else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { - if (editorNode->custom2 > 0) { - DilateDistanceOperation *operation = new DilateDistanceOperation(); - operation->setDistance(editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - else { - ErodeDistanceOperation *operation = new ErodeDistanceOperation(); - operation->setDistance(-editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - } - else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { - /* this uses a modified gaussian blur function otherwise its far too slow */ - CompositorQuality quality = context.getQuality(); - - GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); - operationx->setData(&m_alpha_blur); - operationx->setQuality(quality); - operationx->setFalloff(PROP_SMOOTH); - converter.addOperation(operationx); - - converter.mapInputSocket(getInputSocket(0), operationx->getInputSocket(0)); - // converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); // no size input yet - - GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); - operationy->setData(&m_alpha_blur); - operationy->setQuality(quality); - operationy->setFalloff(PROP_SMOOTH); - converter.addOperation(operationy); - - converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); - // converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); // no size input yet - converter.mapOutputSocket(getOutputSocket(0), operationy->getOutputSocket()); - - converter.addPreview(operationy->getOutputSocket()); - - /* TODO? */ - /* see gaussian blue node for original usage */ + bNode *editorNode = this->getbNode(); + if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) { + DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation(); + operation->setDistance(editorNode->custom2); + operation->setInset(editorNode->custom3); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + + if (editorNode->custom3 < 2.0f) { + AntiAliasOperation *antiAlias = new AntiAliasOperation(); + converter.addOperation(antiAlias); + + converter.addLink(operation->getOutputSocket(), antiAlias->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), antiAlias->getOutputSocket(0)); + } + else { + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + } + else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) { + if (editorNode->custom2 > 0) { + DilateDistanceOperation *operation = new DilateDistanceOperation(); + operation->setDistance(editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + else { + ErodeDistanceOperation *operation = new ErodeDistanceOperation(); + operation->setDistance(-editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + } + else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_FEATHER) { + /* this uses a modified gaussian blur function otherwise its far too slow */ + CompositorQuality quality = context.getQuality(); + + GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation(); + operationx->setData(&m_alpha_blur); + operationx->setQuality(quality); + operationx->setFalloff(PROP_SMOOTH); + converter.addOperation(operationx); + + converter.mapInputSocket(getInputSocket(0), operationx->getInputSocket(0)); + // converter.mapInputSocket(getInputSocket(1), operationx->getInputSocket(1)); // no size input yet + + GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation(); + operationy->setData(&m_alpha_blur); + operationy->setQuality(quality); + operationy->setFalloff(PROP_SMOOTH); + converter.addOperation(operationy); + + converter.addLink(operationx->getOutputSocket(), operationy->getInputSocket(0)); + // converter.mapInputSocket(getInputSocket(1), operationy->getInputSocket(1)); // no size input yet + converter.mapOutputSocket(getOutputSocket(0), operationy->getOutputSocket()); + + converter.addPreview(operationy->getOutputSocket()); + + /* TODO? */ + /* see gaussian blue node for original usage */ #if 0 - if (!connectedSizeSocket) { - operationx->setSize(size); - operationy->setSize(size); - } + if (!connectedSizeSocket) { + operationx->setSize(size); + operationy->setSize(size); + } #else - operationx->setSize(1.0f); - operationy->setSize(1.0f); + operationx->setSize(1.0f); + operationy->setSize(1.0f); #endif - operationx->setSubtract(editorNode->custom2 < 0); - operationy->setSubtract(editorNode->custom2 < 0); - - if (editorNode->storage) { - NodeDilateErode *data_storage = (NodeDilateErode *)editorNode->storage; - operationx->setFalloff(data_storage->falloff); - operationy->setFalloff(data_storage->falloff); - } - } - else { - if (editorNode->custom2 > 0) { - DilateStepOperation *operation = new DilateStepOperation(); - operation->setIterations(editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - else { - ErodeStepOperation *operation = new ErodeStepOperation(); - operation->setIterations(-editorNode->custom2); - converter.addOperation(operation); - - converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); - converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); - } - } + operationx->setSubtract(editorNode->custom2 < 0); + operationy->setSubtract(editorNode->custom2 < 0); + + if (editorNode->storage) { + NodeDilateErode *data_storage = (NodeDilateErode *)editorNode->storage; + operationx->setFalloff(data_storage->falloff); + operationy->setFalloff(data_storage->falloff); + } + } + else { + if (editorNode->custom2 > 0) { + DilateStepOperation *operation = new DilateStepOperation(); + operation->setIterations(editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + else { + ErodeStepOperation *operation = new ErodeStepOperation(); + operation->setIterations(-editorNode->custom2); + converter.addOperation(operation); + + converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); + converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket(0)); + } + } } |