diff options
Diffstat (limited to 'source/blender/compositor')
-rw-r--r-- | source/blender/compositor/COM_defines.h | 1 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MovieClipOperation.cc | 24 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_MovieClipOperation.h | 12 |
3 files changed, 35 insertions, 2 deletions
diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h index 0e97bafbb0b..900f29db44c 100644 --- a/source/blender/compositor/COM_defines.h +++ b/source/blender/compositor/COM_defines.h @@ -66,6 +66,7 @@ constexpr int COM_DATA_TYPE_VALUE_CHANNELS = COM_data_type_num_channels(DataType constexpr int COM_DATA_TYPE_VECTOR_CHANNELS = COM_data_type_num_channels(DataType::Vector); constexpr int COM_DATA_TYPE_COLOR_CHANNELS = COM_data_type_num_channels(DataType::Color); +constexpr float COM_COLOR_TRANSPARENT[4] = {0.0f, 0.0f, 0.0f, 0.0f}; constexpr float COM_VECTOR_ZERO[3] = {0.0f, 0.0f, 0.0f}; constexpr float COM_VALUE_ZERO[1] = {0.0f}; constexpr float COM_VALUE_ONE[1] = {1.0f}; diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.cc b/source/blender/compositor/operations/COM_MovieClipOperation.cc index d93a75407c4..e520b928edf 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.cc +++ b/source/blender/compositor/operations/COM_MovieClipOperation.cc @@ -116,6 +116,18 @@ void MovieClipBaseOperation::executePixelSampled(float output[4], } } +void MovieClipBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + if (m_movieClipBuffer) { + output->copy_from(m_movieClipBuffer, area); + } + else { + output->fill(area, COM_COLOR_TRANSPARENT); + } +} + MovieClipOperation::MovieClipOperation() : MovieClipBaseOperation() { this->addOutputSocket(DataType::Color); @@ -136,4 +148,16 @@ void MovieClipAlphaOperation::executePixelSampled(float output[4], output[0] = result[3]; } +void MovieClipAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + if (m_movieClipBuffer) { + output->copy_from(m_movieClipBuffer, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0); + } + else { + output->fill(area, COM_VALUE_ZERO); + } +} + } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_MovieClipOperation.h b/source/blender/compositor/operations/COM_MovieClipOperation.h index c853ea43762..0a0c4c00f81 100644 --- a/source/blender/compositor/operations/COM_MovieClipOperation.h +++ b/source/blender/compositor/operations/COM_MovieClipOperation.h @@ -19,7 +19,7 @@ #pragma once #include "BLI_listbase.h" -#include "COM_NodeOperation.h" +#include "COM_MultiThreadedOperation.h" #include "DNA_movieclip_types.h" #include "IMB_imbuf_types.h" @@ -28,7 +28,7 @@ namespace blender::compositor { /** * Base class for movie clip */ -class MovieClipBaseOperation : public NodeOperation { +class MovieClipBaseOperation : public MultiThreadedOperation { protected: MovieClip *m_movieClip; MovieClipUser *m_movieClipUser; @@ -67,6 +67,10 @@ class MovieClipBaseOperation : public NodeOperation { this->m_framenumber = framenumber; } void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; class MovieClipOperation : public MovieClipBaseOperation { @@ -78,6 +82,10 @@ class MovieClipAlphaOperation : public MovieClipBaseOperation { public: MovieClipAlphaOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; } // namespace blender::compositor |