From 4c75f776690cfec51ad3ca686805be6edf21b514 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 24 Feb 2015 12:42:31 +0500 Subject: Fix T43784: Compositing scale node border error This was still the known issue with pixel center, original commit didn't cover all the cases by the looks of it. Should be all fine now, but much more intense testing is welcome. --- source/blender/compositor/operations/COM_CompositorOperation.cpp | 2 +- source/blender/compositor/operations/COM_ViewerOperation.cpp | 6 +++--- source/blender/compositor/operations/COM_WriteBufferOperation.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source/blender/compositor') diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index e3438bcbd15..c2c6a129d56 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -185,7 +185,7 @@ void CompositorOperation::executeRegion(rcti *rect, unsigned int tileNumber) for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2 && (!breaked); x++) { - int input_x = x + dx, input_y = y + dy; + float input_x = (float)x + dx + 0.5f, input_y = (float)y + dy + 0.5f; this->m_imageInput->readSampled(color, input_x, input_y, COM_PS_NEAREST); if (this->m_useAlphaInput) { diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cpp b/source/blender/compositor/operations/COM_ViewerOperation.cpp index 53c0acd781a..defad164567 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cpp +++ b/source/blender/compositor/operations/COM_ViewerOperation.cpp @@ -100,12 +100,12 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int tileNumber) for (y = y1; y < y2 && (!breaked); y++) { for (x = x1; x < x2; x++) { - this->m_imageInput->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST); + this->m_imageInput->readSampled(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST); if (this->m_useAlphaInput) { - this->m_alphaInput->readSampled(alpha, x, y, COM_PS_NEAREST); + this->m_alphaInput->readSampled(alpha, (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST); buffer[offset4 + 3] = alpha[0]; } - this->m_depthInput->readSampled(depth, x, y, COM_PS_NEAREST); + this->m_depthInput->readSampled(depth, (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST); depthbuffer[offset] = depth[0]; offset ++; diff --git a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp index fccff2a33bf..58bded75fdb 100644 --- a/source/blender/compositor/operations/COM_WriteBufferOperation.cpp +++ b/source/blender/compositor/operations/COM_WriteBufferOperation.cpp @@ -74,7 +74,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber) for (y = y1; y < y2 && (!breaked); y++) { int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels; for (x = x1; x < x2; x++) { - this->m_input->read(&(buffer[offset4]), x, y, data); + this->m_input->read(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, data); offset4 += num_channels; } if (isBreaked()) { @@ -99,7 +99,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber) for (y = y1; y < y2 && (!breaked); y++) { int offset4 = (y * memoryBuffer->getWidth() + x1) * num_channels; for (x = x1; x < x2; x++) { - this->m_input->readSampled(&(buffer[offset4]), x, y, COM_PS_NEAREST); + this->m_input->readSampled(&(buffer[offset4]), (float)x + 0.5f, (float)y + 0.5f, COM_PS_NEAREST); offset4 += num_channels; } if (isBreaked()) { -- cgit v1.2.3