diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-07-19 19:36:18 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-07-19 23:05:39 +0300 |
commit | 300fe84bf0ad28b08ec3b5615d15d6b7352e3f7a (patch) | |
tree | 6fccb72c39d0e4f946793a2c79a3786fa782985c /source/blender/compositor | |
parent | b848d5cdf5b6783f8f83ce6b3c063e62829b8245 (diff) |
Compositor: Full frame Viewer node
Adds full frame implementation to this node operation.
No functional changes.
No performance changes.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D11698
Diffstat (limited to 'source/blender/compositor')
-rw-r--r-- | source/blender/compositor/operations/COM_ViewerOperation.cc | 32 | ||||
-rw-r--r-- | source/blender/compositor/operations/COM_ViewerOperation.h | 12 |
2 files changed, 39 insertions, 5 deletions
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index 860f56e23fa..e47396e14a1 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -191,10 +191,11 @@ void ViewerOperation::initImage() BLI_thread_unlock(LOCK_DRAW_IMAGE); } -void ViewerOperation::updateImage(rcti *rect) +void ViewerOperation::updateImage(const rcti *rect) { + float *buffer = m_outputBuffer; IMB_partial_display_buffer_update(this->m_ibuf, - this->m_outputBuffer, + buffer, nullptr, getWidth(), 0, @@ -218,4 +219,31 @@ eCompositorPriority ViewerOperation::getRenderPriority() const return eCompositorPriority::Low; } +void ViewerOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output), + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + if (!m_outputBuffer) { + return; + } + + MemoryBuffer output_buffer( + m_outputBuffer, COM_DATA_TYPE_COLOR_CHANNELS, getWidth(), getHeight()); + const MemoryBuffer *input_image = inputs[0]; + output_buffer.copy_from(input_image, area); + if (this->m_useAlphaInput) { + const MemoryBuffer *input_alpha = inputs[1]; + output_buffer.copy_from(input_alpha, area, 0, COM_DATA_TYPE_VALUE_CHANNELS, 3); + } + + if (m_depthBuffer) { + MemoryBuffer depth_buffer( + m_depthBuffer, COM_DATA_TYPE_VALUE_CHANNELS, getWidth(), getHeight()); + const MemoryBuffer *input_depth = inputs[2]; + depth_buffer.copy_from(input_depth, area); + } + + updateImage(&area); +} + } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h index c0f13ff79fc..ed05a7a282d 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.h +++ b/source/blender/compositor/operations/COM_ViewerOperation.h @@ -20,15 +20,17 @@ #include "BKE_global.h" #include "BLI_rect.h" -#include "COM_NodeOperation.h" +#include "COM_MultiThreadedOperation.h" #include "DNA_image_types.h" namespace blender::compositor { -class ViewerOperation : public NodeOperation { +class ViewerOperation : public MultiThreadedOperation { private: + /* TODO(manzanilla): To be removed together with tiled implementation. */ float *m_outputBuffer; float *m_depthBuffer; + Image *m_image; ImageUser *m_imageUser; bool m_active; @@ -125,8 +127,12 @@ class ViewerOperation : public NodeOperation { this->m_displaySettings = displaySettings; } + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; + private: - void updateImage(rcti *rect); + void updateImage(const rcti *rect); void initImage(); }; |