diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_RotateOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_RotateOperation.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/compositor/operations/COM_RotateOperation.cpp b/source/blender/compositor/operations/COM_RotateOperation.cpp index a391a26b89c..ac06048faf3 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.cpp +++ b/source/blender/compositor/operations/COM_RotateOperation.cpp @@ -38,8 +38,8 @@ void RotateOperation::initExecution() { this->imageSocket = this->getInputSocketReader(0); this->degreeSocket = this->getInputSocketReader(1); - this->centerX = this->getWidth()/2.0; - this->centerY = this->getHeight()/2.0; + this->centerX = this->getWidth() / 2.0; + this->centerY = this->getHeight() / 2.0; } void RotateOperation::deinitExecution() @@ -54,10 +54,10 @@ inline void RotateOperation::ensureDegree() { this->degreeSocket->read(degree, 0, 0, COM_PS_NEAREST, NULL); double rad; if (this->doDegree2RadConversion) { - rad = DEG2RAD((double)degree[0]); + rad = DEG2RAD((double)degree[0]); } else { - rad = degree[0]; + rad = degree[0]; } this->cosine = cos(rad); this->sine = sin(rad); @@ -67,13 +67,13 @@ inline void RotateOperation::ensureDegree() { } -void RotateOperation::executePixel(float *color,float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) +void RotateOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]) { ensureDegree(); const float dy = y - this->centerY; const float dx = x - this->centerX; - const float nx = this->centerX+(this->cosine*dx + this->sine*dy); - const float ny = this->centerY+(-this->sine*dx + this->cosine*dy); + const float nx = this->centerX + (this->cosine * dx + this->sine * dy); + const float ny = this->centerY + (-this->sine * dx + this->cosine * dy); this->imageSocket->read(color, nx, ny, sampler, inputBuffers); } @@ -87,23 +87,23 @@ bool RotateOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOp const float dxmax = input->xmax - this->centerX; const float dymax = input->ymax - this->centerY; - const float x1 = this->centerX+(this->cosine*dxmin + this->sine*dymin); - const float x2 = this->centerX+(this->cosine*dxmax + this->sine*dymin); - const float x3 = this->centerX+(this->cosine*dxmin + this->sine*dymax); - const float x4 = this->centerX+(this->cosine*dxmax + this->sine*dymax); - const float y1 = this->centerY+(-this->sine*dxmin + this->cosine*dymin); - const float y2 = this->centerY+(-this->sine*dxmax + this->cosine*dymin); - const float y3 = this->centerY+(-this->sine*dxmin + this->cosine*dymax); - const float y4 = this->centerY+(-this->sine*dxmax + this->cosine*dymax); + const float x1 = this->centerX + (this->cosine * dxmin + this->sine * dymin); + const float x2 = this->centerX + (this->cosine * dxmax + this->sine * dymin); + const float x3 = this->centerX + (this->cosine * dxmin + this->sine * dymax); + const float x4 = this->centerX + (this->cosine * dxmax + this->sine * dymax); + const float y1 = this->centerY + (-this->sine * dxmin + this->cosine * dymin); + const float y2 = this->centerY + (-this->sine * dxmax + this->cosine * dymin); + const float y3 = this->centerY + (-this->sine * dxmin + this->cosine * dymax); + const float y4 = this->centerY + (-this->sine * dxmax + this->cosine * dymax); const float minx = min(x1, min(x2, min(x3, x4))); const float maxx = max(x1, max(x2, max(x3, x4))); const float miny = min(y1, min(y2, min(y3, y4))); const float maxy = max(y1, max(y2, max(y3, y4))); - newInput.xmax = ceil(maxx)+1; - newInput.xmin = floor(minx)-1; - newInput.ymax = ceil(maxy)+1; - newInput.ymin = floor(miny)-1; + newInput.xmax = ceil(maxx) + 1; + newInput.xmin = floor(minx) - 1; + newInput.ymax = ceil(maxy) + 1; + newInput.ymin = floor(miny) - 1; return NodeOperation::determineDependingAreaOfInterest(&newInput, readOperation, output); } |