From 570cc70772d78703053956ce57b20c6c4ed74c95 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 15 Jun 2012 18:42:03 +0000 Subject: style cleanup: compositor operations --- .../operations/COM_EllipseMaskOperation.cpp | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'source/blender/compositor/operations/COM_EllipseMaskOperation.cpp') diff --git a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp index 650c57dd8dc..0beacd02738 100644 --- a/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_EllipseMaskOperation.cpp @@ -24,7 +24,7 @@ #include "BLI_math.h" #include "DNA_node_types.h" -EllipseMaskOperation::EllipseMaskOperation(): NodeOperation() +EllipseMaskOperation::EllipseMaskOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addInputSocket(COM_DT_VALUE); @@ -41,7 +41,7 @@ void EllipseMaskOperation::initExecution() const double rad = DEG2RAD((double)this->data->rotation); this->cosine = cos(rad); this->sine = sin(rad); - this->aspectRatio = ((float)this->getWidth())/this->getHeight(); + this->aspectRatio = ((float)this->getWidth()) / this->getHeight(); } void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) @@ -49,32 +49,32 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam float inputMask[4]; float inputValue[4]; - float rx = x/this->getWidth(); - float ry = y/this->getHeight(); + float rx = x / this->getWidth(); + float ry = y / this->getHeight(); - const float dy = (ry - this->data->y)/this->aspectRatio; + const float dy = (ry - this->data->y) / this->aspectRatio; const float dx = rx - this->data->x; - rx = this->data->x+(this->cosine*dx + this->sine*dy); - ry = this->data->y+(-this->sine*dx + this->cosine*dy); + rx = this->data->x + (this->cosine * dx + this->sine * dy); + ry = this->data->y + (-this->sine * dx + this->cosine * dy); this->inputMask->read(inputMask, x, y, sampler, inputBuffers); this->inputValue->read(inputValue, x, y, sampler, inputBuffers); - const float halfHeight = (this->data->height)/2.0f; - const float halfWidth = this->data->width/2.0f; - float sx = rx-this->data->x; + const float halfHeight = (this->data->height) / 2.0f; + const float halfWidth = this->data->width / 2.0f; + float sx = rx - this->data->x; sx *= sx; const float tx = halfWidth * halfWidth; - float sy = ry-this->data->y; + float sy = ry - this->data->y; sy *= sy; const float ty = halfHeight * halfHeight; - bool inside = ((sx/tx)+(sy/ty))<1.0f; + bool inside = ((sx / tx) + (sy / ty)) < 1.0f; switch (this->maskType) { case CMP_NODE_MASKTYPE_ADD: if (inside) { - color[0] = max(inputMask[0],inputValue[0]); + color[0] = max(inputMask[0], inputValue[0]); } else { color[0] = inputMask[0]; @@ -82,7 +82,7 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam break; case CMP_NODE_MASKTYPE_SUBTRACT: if (inside) { - color[0] = inputMask[0]-inputValue[0]; + color[0] = inputMask[0] - inputValue[0]; CLAMP(color[0], 0, 1); } else { @@ -91,24 +91,24 @@ void EllipseMaskOperation::executePixel(float *color, float x, float y, PixelSam break; case CMP_NODE_MASKTYPE_MULTIPLY: if (inside) { - color[0] = inputMask[0]*inputValue[0]; + color[0] = inputMask[0] * inputValue[0]; } else { color[0] = 0; } break; case CMP_NODE_MASKTYPE_NOT: - if (inside) { - if (inputMask[0]>0.0f) { - color[0] = 0; + if (inside) { + if (inputMask[0] > 0.0f) { + color[0] = 0; + } + else { + color[0] = inputValue[0]; + } } else { - color[0] = inputValue[0]; + color[0] = inputMask[0]; } - } - else { - color[0] = inputMask[0]; - } break; } -- cgit v1.2.3