Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/operations/COM_ViewerOperation.cc
| Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | if (m_doDepthBuffer) { | ||||
| this->m_depthBuffer = ibuf->zbuf_float; | this->m_depthBuffer = ibuf->zbuf_float; | ||||
| } | } | ||||
| BKE_image_release_ibuf(this->m_image, this->m_ibuf, lock); | BKE_image_release_ibuf(this->m_image, this->m_ibuf, lock); | ||||
| BLI_thread_unlock(LOCK_DRAW_IMAGE); | 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, | IMB_partial_display_buffer_update(this->m_ibuf, | ||||
| this->m_outputBuffer, | buffer, | ||||
| nullptr, | nullptr, | ||||
| getWidth(), | getWidth(), | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| this->m_viewSettings, | this->m_viewSettings, | ||||
| this->m_displaySettings, | this->m_displaySettings, | ||||
| rect->xmin, | rect->xmin, | ||||
| rect->ymin, | rect->ymin, | ||||
| rect->xmax, | rect->xmax, | ||||
| rect->ymax); | rect->ymax); | ||||
| this->m_image->gpuflag |= IMA_GPU_REFRESH; | this->m_image->gpuflag |= IMA_GPU_REFRESH; | ||||
| this->updateDraw(); | this->updateDraw(); | ||||
| } | } | ||||
| eCompositorPriority ViewerOperation::getRenderPriority() const | eCompositorPriority ViewerOperation::getRenderPriority() const | ||||
| { | { | ||||
| if (this->isActiveViewerOutput()) { | if (this->isActiveViewerOutput()) { | ||||
| return eCompositorPriority::High; | return eCompositorPriority::High; | ||||
| } | } | ||||
| return eCompositorPriority::Low; | 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); | |||||
| } | |||||
| 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 | } // namespace blender::compositor | ||||