Fix flip node making unsigned int out-of-range

This commit is contained in:
Campbell Barton
2015-03-11 15:39:58 +11:00
parent 62faffc800
commit cf385caf92

View File

@@ -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;