diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_IDMaskOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_IDMaskOperation.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cpp b/source/blender/compositor/operations/COM_IDMaskOperation.cpp index a021f07d2a7..05462d31ed2 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cpp +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cpp @@ -26,24 +26,23 @@ IDMaskOperation::IDMaskOperation() : NodeOperation() { this->addInputSocket(COM_DT_VALUE); this->addOutputSocket(COM_DT_VALUE); - this->m_inputProgram = NULL; -} -void IDMaskOperation::initExecution() -{ - this->m_inputProgram = this->getInputSocketReader(0); + this->setComplex(true); } -void IDMaskOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void *IDMaskOperation::initializeTileData(rcti *rect) { - float inputValue[4]; - - this->m_inputProgram->readSampled(inputValue, x, y, sampler); - const float a = (inputValue[0] == this->m_objectIndex) ? 1.0f : 0.0f; - output[0] = a; + void *buffer = getInputOperation(0)->initializeTileData(rect); + return buffer; } -void IDMaskOperation::deinitExecution() +void IDMaskOperation::executePixel(float output[4], + int x, + int y, + void *data) { - this->m_inputProgram = NULL; + MemoryBuffer *input_buffer = (MemoryBuffer *)data; + const int buffer_width = input_buffer->getWidth(); + float *buffer = input_buffer->getBuffer(); + int buffer_index = (y * buffer_width + x); + output[0] = (roundf(buffer[buffer_index]) == this->m_objectIndex) ? 1.0f : 0.0f; } - |