diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-07-22 19:35:08 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-07-22 19:51:51 +0300 |
commit | 1a91c5732032621ff58677178a93f5e6a9d2b8f8 (patch) | |
tree | 9e44fd40a7442c767996083e80844458db968151 /source/blender/compositor/operations/COM_ViewerOperation.cc | |
parent | b1bf4c2a056958165058552e5e95039c7de726c2 (diff) |
Compositor: Fix crash when using empty input sources
It's the case of Image or Movie Clip node when not selecting any
source or an empty one.
Render methods expect an output buffer with size, only render
operations with resolution.
Diffstat (limited to 'source/blender/compositor/operations/COM_ViewerOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_ViewerOperation.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc index e47396e14a1..37a45ac32cb 100644 --- a/source/blender/compositor/operations/COM_ViewerOperation.cc +++ b/source/blender/compositor/operations/COM_ViewerOperation.cc @@ -246,4 +246,17 @@ void ViewerOperation::update_memory_buffer_partial(MemoryBuffer *UNUSED(output), updateImage(&area); } +void ViewerOperation::clear_display_buffer() +{ + BLI_assert(isActiveViewerOutput()); + initImage(); + size_t buf_bytes = (size_t)m_ibuf->y * m_ibuf->x * COM_DATA_TYPE_COLOR_CHANNELS * sizeof(float); + if (buf_bytes > 0) { + memset(m_outputBuffer, 0, buf_bytes); + rcti display_area; + BLI_rcti_init(&display_area, 0, m_ibuf->x, 0, m_ibuf->y); + updateImage(&display_area); + } +} + } // namespace blender::compositor |