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/operations/COM_ChannelMatteOperation.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/operations/COM_ChannelMatteOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_ChannelMatteOperation.cpp | 152 |
1 files changed, 75 insertions, 77 deletions
diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp index 1e3808a80cc..cbd46ea71f8 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cpp @@ -21,102 +21,100 @@ ChannelMatteOperation::ChannelMatteOperation() : NodeOperation() { - addInputSocket(COM_DT_COLOR); - addOutputSocket(COM_DT_VALUE); + addInputSocket(COM_DT_COLOR); + addOutputSocket(COM_DT_VALUE); - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = NULL; } void ChannelMatteOperation::initExecution() { - this->m_inputImageProgram = this->getInputSocketReader(0); + this->m_inputImageProgram = this->getInputSocketReader(0); - this->m_limit_range = this->m_limit_max - this->m_limit_min; + this->m_limit_range = this->m_limit_max - this->m_limit_min; - switch (this->m_limit_method) { - /* SINGLE */ - case 0: - { - /* 123 / RGB / HSV / YUV / YCC */ - const int matte_channel = this->m_matte_channel - 1; - const int limit_channel = this->m_limit_channel - 1; - this->m_ids[0] = matte_channel; - this->m_ids[1] = limit_channel; - this->m_ids[2] = limit_channel; - break; - } - /* MAX */ - case 1: - { - switch (this->m_matte_channel) { - case 1: - { - this->m_ids[0] = 0; - this->m_ids[1] = 1; - this->m_ids[2] = 2; - break; - } - case 2: - { - this->m_ids[0] = 1; - this->m_ids[1] = 0; - this->m_ids[2] = 2; - break; - } - case 3: - { - this->m_ids[0] = 2; - this->m_ids[1] = 0; - this->m_ids[2] = 1; - break; - } - default: - break; - } - break; - } - default: - break; - } + switch (this->m_limit_method) { + /* SINGLE */ + case 0: { + /* 123 / RGB / HSV / YUV / YCC */ + const int matte_channel = this->m_matte_channel - 1; + const int limit_channel = this->m_limit_channel - 1; + this->m_ids[0] = matte_channel; + this->m_ids[1] = limit_channel; + this->m_ids[2] = limit_channel; + break; + } + /* MAX */ + case 1: { + switch (this->m_matte_channel) { + case 1: { + this->m_ids[0] = 0; + this->m_ids[1] = 1; + this->m_ids[2] = 2; + break; + } + case 2: { + this->m_ids[0] = 1; + this->m_ids[1] = 0; + this->m_ids[2] = 2; + break; + } + case 3: { + this->m_ids[0] = 2; + this->m_ids[1] = 0; + this->m_ids[2] = 1; + break; + } + default: + break; + } + break; + } + default: + break; + } } void ChannelMatteOperation::deinitExecution() { - this->m_inputImageProgram = NULL; + this->m_inputImageProgram = NULL; } -void ChannelMatteOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void ChannelMatteOperation::executePixelSampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inColor[4]; - float alpha; + float inColor[4]; + float alpha; - const float limit_max = this->m_limit_max; - const float limit_min = this->m_limit_min; - const float limit_range = this->m_limit_range; + const float limit_max = this->m_limit_max; + const float limit_min = this->m_limit_min; + const float limit_range = this->m_limit_range; - this->m_inputImageProgram->readSampled(inColor, x, y, sampler); + this->m_inputImageProgram->readSampled(inColor, x, y, sampler); - /* matte operation */ - alpha = inColor[this->m_ids[0]] - max(inColor[this->m_ids[1]], inColor[this->m_ids[2]]); + /* matte operation */ + alpha = inColor[this->m_ids[0]] - max(inColor[this->m_ids[1]], inColor[this->m_ids[2]]); - /* flip because 0.0 is transparent, not 1.0 */ - alpha = 1.0f - alpha; + /* flip because 0.0 is transparent, not 1.0 */ + alpha = 1.0f - alpha; - /* test range */ - if (alpha > limit_max) { - alpha = inColor[3]; /*whatever it was prior */ - } - else if (alpha < limit_min) { - alpha = 0.0f; - } - else { /*blend */ - alpha = (alpha - limit_min) / limit_range; - } + /* test range */ + if (alpha > limit_max) { + alpha = inColor[3]; /*whatever it was prior */ + } + else if (alpha < limit_min) { + alpha = 0.0f; + } + else { /*blend */ + alpha = (alpha - limit_min) / limit_range; + } - /* store matte(alpha) value in [0] to go with - * COM_SetAlphaOperation and the Value output - */ + /* store matte(alpha) value in [0] to go with + * COM_SetAlphaOperation and the Value output + */ - /* don't make something that was more transparent less transparent */ - output[0] = min(alpha, inColor[3]); + /* don't make something that was more transparent less transparent */ + output[0] = min(alpha, inColor[3]); } |