diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-01 01:15:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-01 01:15:38 +0400 |
commit | a9015e3f7da9c4885fe6d73841037fcce8cc48cd (patch) | |
tree | d4ba4a93add19f7174d690d7474016d0bf5e2e84 /source/blender/compositor/operations/COM_TranslateOperation.cpp | |
parent | 64c6736ef2888eaf2f694536eaf4b10b99c2de54 (diff) |
style cleanup
Diffstat (limited to 'source/blender/compositor/operations/COM_TranslateOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_TranslateOperation.cpp | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cpp b/source/blender/compositor/operations/COM_TranslateOperation.cpp index c34931471c7..253c5df8f9d 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cpp +++ b/source/blender/compositor/operations/COM_TranslateOperation.cpp @@ -64,7 +64,7 @@ void TranslateOperation::executePixel(float output[4], float x, float y, PixelSa float originalXPos = x - this->getDeltaX(); float originalYPos = y - this->getDeltaY(); - switch(m_wrappingType) { + switch (m_wrappingType) { case 0: //Intentionally empty, originalXPos and originalYPos have been set before break; @@ -83,7 +83,7 @@ void TranslateOperation::executePixel(float output[4], float x, float y, PixelSa break; } - this->m_inputOperation->read(output, originalXPos , originalYPos, sampler); + this->m_inputOperation->read(output, originalXPos, originalYPos, sampler); } @@ -98,20 +98,20 @@ bool TranslateOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe newInput.ymin = input->ymin - this->getDeltaY(); newInput.ymax = input->ymax - this->getDeltaY(); - if (m_wrappingType == 1 || m_wrappingType == 3){ + if (m_wrappingType == 1 || m_wrappingType == 3) { // wrap only on the x-axis if tile is wrapping newInput.xmin = getWrappedOriginalXPos(input->xmin); newInput.xmax = getWrappedOriginalXPos(input->xmax); - if(newInput.xmin > newInput.xmax){ + if (newInput.xmin > newInput.xmax) { newInput.xmin = 0; newInput.xmax = this->getWidth(); } } - if(m_wrappingType == 2 || m_wrappingType == 3) { + if (m_wrappingType == 2 || m_wrappingType == 3) { // wrap only on the y-axis if tile is wrapping newInput.ymin = getWrappedOriginalYPos(input->ymin); newInput.ymax = getWrappedOriginalYPos(input->ymax); - if (newInput.ymin > newInput.ymax){ + if (newInput.ymin > newInput.ymax) { newInput.ymin = 0; newInput.ymax = this->getHeight(); } @@ -131,17 +131,22 @@ float TranslateOperation::getWrappedOriginalXPos(float x) float originalXPos = 0; // Positive offset: Append image data from the left - if ( this->m_relativeOffsetX > 0 ) { - if ( x < this->m_relativeOffsetX ) + if (this->m_relativeOffsetX > 0) { + if (x < this->m_relativeOffsetX) { originalXPos = this->getWidth() - this->m_relativeOffsetX + x; - else - originalXPos = x - this->m_relativeOffsetX; - } else { + } + else { + originalXPos = x - this->m_relativeOffsetX; + } + } + else { // Negative offset: Append image data from the right - if (x < (this->getWidth() + this->m_relativeOffsetX)) + if (x < (this->getWidth() + this->m_relativeOffsetX)) { originalXPos = x - this->m_relativeOffsetX; - else + } + else { originalXPos = x - (this->getWidth() + this->m_relativeOffsetX); + } } while (originalXPos < 0) originalXPos += this->m_width; @@ -154,17 +159,22 @@ float TranslateOperation::getWrappedOriginalYPos(float y) float originalYPos = 0; // Positive offset: Append image data from the bottom - if ( this->m_relativeOffsetY > 0 ) { - if ( y < this->m_relativeOffsetY ) - originalYPos = this->getHeight()- this->m_relativeOffsetY + y; - else - originalYPos = y - this->m_relativeOffsetY; - } else { + if (this->m_relativeOffsetY > 0) { + if (y < this->m_relativeOffsetY) { + originalYPos = this->getHeight() - this->m_relativeOffsetY + y; + } + else { + originalYPos = y - this->m_relativeOffsetY; + } + } + else { // Negative offset: Append image data from the top - if (y < (this->getHeight() + this->m_relativeOffsetY)) + if (y < (this->getHeight() + this->m_relativeOffsetY)) { originalYPos = y - this->m_relativeOffsetY; - else + } + else { originalYPos = y - (this->getHeight() + this->m_relativeOffsetY); + } } while (originalYPos < 0) originalYPos += this->m_height; |