Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-15 22:42:03 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-15 22:42:03 +0400
commit570cc70772d78703053956ce57b20c6c4ed74c95 (patch)
treeb4c5db0392384251f1b1ccefc17c959d3e742977 /source/blender/compositor/operations/COM_EllipseMaskOperation.cpp
parent8fd2267e56d3d0b6bb860800eb8059bcbfa0b501 (diff)
style cleanup: compositor operations
Diffstat (limited to 'source/blender/compositor/operations/COM_EllipseMaskOperation.cpp')
-rw-r--r--source/blender/compositor/operations/COM_EllipseMaskOperation.cpp46
1 files changed, 23 insertions, 23 deletions
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;
}