diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-03-11 07:39:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-03-11 07:39:58 +0300 |
commit | cf385caf926f06ce54131dac387be39c8665d680 (patch) | |
tree | 1e264eb7f5ca37946255c93b88102a6788fb087f /source/blender/compositor | |
parent | 62faffc8003ed96806fbccb56b99e8c9901e3767 (diff) |
Fix flip node making unsigned int out-of-range
Diffstat (limited to 'source/blender/compositor')
-rw-r--r-- | source/blender/compositor/operations/COM_FlipOperation.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp index 3de2ae9dabc..7ff7d694fa8 100644 --- a/source/blender/compositor/operations/COM_FlipOperation.cpp +++ b/source/blender/compositor/operations/COM_FlipOperation.cpp @@ -44,8 +44,8 @@ void FlipOperation::deinitExecution() void FlipOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) { - float nx = this->m_flipX ? this->getWidth() - 1 - x : x; - float ny = this->m_flipY ? this->getHeight() - 1 - y : y; + float nx = this->m_flipX ? ((int)this->getWidth() - 1) - x : x; + float ny = this->m_flipY ? ((int)this->getHeight() - 1) - y : y; this->m_inputOperation->readSampled(output, nx, ny, sampler); } @@ -55,16 +55,18 @@ bool FlipOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper rcti newInput; if (this->m_flipX) { - newInput.xmax = (this->getWidth() - 1 - input->xmin) + 1; - newInput.xmin = (this->getWidth() - 1 - input->xmax) - 1; + const int w = (int)this->getWidth() - 1; + newInput.xmax = (w - input->xmin) + 1; + newInput.xmin = (w - input->xmax) - 1; } else { newInput.xmin = input->xmin; newInput.xmax = input->xmax; } if (this->m_flipY) { - newInput.ymax = (this->getHeight() - 1 - input->ymin) + 1; - newInput.ymin = (this->getHeight() - 1 - input->ymax) - 1; + const int h = (int)this->getHeight() - 1; + newInput.ymax = (h - input->ymin) + 1; + newInput.ymin = (h - input->ymax) - 1; } else { newInput.ymin = input->ymin; |