[Bf-blender-cvs] [cf385ca] master: Fix flip node making unsigned int out-of-range
Campbell Barton
noreply at git.blender.org
Wed Mar 11 05:44:03 CET 2015
Commit: cf385caf926f06ce54131dac387be39c8665d680
Author: Campbell Barton
Date: Wed Mar 11 15:39:58 2015 +1100
Branches: master
https://developer.blender.org/rBcf385caf926f06ce54131dac387be39c8665d680
Fix flip node making unsigned int out-of-range
===================================================================
M source/blender/compositor/operations/COM_FlipOperation.cpp
===================================================================
diff --git a/source/blender/compositor/operations/COM_FlipOperation.cpp b/source/blender/compositor/operations/COM_FlipOperation.cpp
index 3de2ae9..7ff7d69 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;
More information about the Bf-blender-cvs
mailing list