diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_IDMaskOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_IDMaskOperation.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cc b/source/blender/compositor/operations/COM_IDMaskOperation.cc index 1bb247e9bc5..38f8b7e075f 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cc +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cc @@ -42,4 +42,22 @@ void IDMaskOperation::executePixel(float output[4], int x, int y, void *data) output[0] = (roundf(buffer[buffer_index]) == this->m_objectIndex) ? 1.0f : 0.0f; } +void IDMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + const MemoryBuffer *input = inputs[0]; + const int width = BLI_rcti_size_x(&area); + for (int y = area.ymin; y < area.ymax; y++) { + float *out = output->get_elem(area.xmin, y); + const float *in = input->get_elem(area.xmin, y); + const float *row_end = out + width * output->elem_stride; + while (out < row_end) { + out[0] = (roundf(in[0]) == m_objectIndex) ? 1.0f : 0.0f; + in += input->elem_stride; + out += output->elem_stride; + } + } +} + } // namespace blender::compositor |