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_ScaleNode.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_ScaleNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_ScaleNode.cpp | 155 |
1 files changed, 74 insertions, 81 deletions
diff --git a/source/blender/compositor/nodes/COM_ScaleNode.cpp b/source/blender/compositor/nodes/COM_ScaleNode.cpp index 61017f1a8e8..e47f673a8be 100644 --- a/source/blender/compositor/nodes/COM_ScaleNode.cpp +++ b/source/blender/compositor/nodes/COM_ScaleNode.cpp @@ -26,88 +26,81 @@ ScaleNode::ScaleNode(bNode *editorNode) : Node(editorNode) { - /* pass */ + /* pass */ } -void ScaleNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const +void ScaleNode::convertToOperations(NodeConverter &converter, + const CompositorContext &context) const { - bNode *bnode = this->getbNode(); - - NodeInput *inputSocket = this->getInputSocket(0); - NodeInput *inputXSocket = this->getInputSocket(1); - NodeInput *inputYSocket = this->getInputSocket(2); - NodeOutput *outputSocket = this->getOutputSocket(0); - - switch (bnode->custom1) { - case CMP_SCALE_RELATIVE: - { - ScaleOperation *operation = new ScaleOperation(); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - break; - } - case CMP_SCALE_SCENEPERCENT: - { - SetValueOperation *scaleFactorOperation = new SetValueOperation(); - scaleFactorOperation->setValue(context.getRenderData()->size / 100.0f); - converter.addOperation(scaleFactorOperation); - - ScaleOperation *operation = new ScaleOperation(); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); - converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - - break; - } - case CMP_SCALE_RENDERPERCENT: - { - const RenderData *rd = context.getRenderData(); - ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); - /* framing options */ - operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); - operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); - operation->setOffset(bnode->custom3, bnode->custom4); - operation->setNewWidth(rd->xsch * rd->size / 100.0f); - operation->setNewHeight(rd->ysch * rd->size / 100.0f); - operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - - break; - } - case CMP_SCALE_ABSOLUTE: - { - /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ - ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); - converter.addOperation(operation); - - converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); - converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); - converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); - converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); - - operation->setVariableSize(inputXSocket->isLinked() || - inputYSocket->isLinked()); - - break; - } - } + bNode *bnode = this->getbNode(); + + NodeInput *inputSocket = this->getInputSocket(0); + NodeInput *inputXSocket = this->getInputSocket(1); + NodeInput *inputYSocket = this->getInputSocket(2); + NodeOutput *outputSocket = this->getOutputSocket(0); + + switch (bnode->custom1) { + case CMP_SCALE_RELATIVE: { + ScaleOperation *operation = new ScaleOperation(); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); + converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + break; + } + case CMP_SCALE_SCENEPERCENT: { + SetValueOperation *scaleFactorOperation = new SetValueOperation(); + scaleFactorOperation->setValue(context.getRenderData()->size / 100.0f); + converter.addOperation(scaleFactorOperation); + + ScaleOperation *operation = new ScaleOperation(); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(1)); + converter.addLink(scaleFactorOperation->getOutputSocket(), operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + + break; + } + case CMP_SCALE_RENDERPERCENT: { + const RenderData *rd = context.getRenderData(); + ScaleFixedSizeOperation *operation = new ScaleFixedSizeOperation(); + /* framing options */ + operation->setIsAspect((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_ASPECT) != 0); + operation->setIsCrop((bnode->custom2 & CMP_SCALE_RENDERSIZE_FRAME_CROP) != 0); + operation->setOffset(bnode->custom3, bnode->custom4); + operation->setNewWidth(rd->xsch * rd->size / 100.0f); + operation->setNewHeight(rd->ysch * rd->size / 100.0f); + operation->getInputSocket(0)->setResizeMode(COM_SC_NO_RESIZE); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + + break; + } + case CMP_SCALE_ABSOLUTE: { + /* TODO: what is the use of this one.... perhaps some issues when the ui was updated... */ + ScaleAbsoluteOperation *operation = new ScaleAbsoluteOperation(); + converter.addOperation(operation); + + converter.mapInputSocket(inputSocket, operation->getInputSocket(0)); + converter.mapInputSocket(inputXSocket, operation->getInputSocket(1)); + converter.mapInputSocket(inputYSocket, operation->getInputSocket(2)); + converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0)); + + operation->setVariableSize(inputXSocket->isLinked() || inputYSocket->isLinked()); + + break; + } + } } |