From f64d02ecb1a55ade0674ae9df2e472c12d36d78a Mon Sep 17 00:00:00 2001 From: Habib Gahbiche Date: Mon, 11 Mar 2024 22:08:49 +0100 Subject: [PATCH] Fix CPU Compositor: Translate node with wrapping enabled produces corrupt image Rendering with F12 causes some inconsistencies between canvases and areas of interest. This is due to some corrections of composite node canvas to fit to the render size, which are not necessary for the Viewer Node. This patch fixes the issue by considering the input image as a whole before translating. Note: this is still consistent with immediate realization of transform nodes in GPU compositor, where nodes are to be evaluated from left to right. Pull Request: https://projects.blender.org/blender/blender/pulls/119276 --- .../compositor/operations/COM_TranslateOperation.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/blender/compositor/operations/COM_TranslateOperation.cc b/source/blender/compositor/operations/COM_TranslateOperation.cc index e69527a0cc3..827994d8195 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.cc +++ b/source/blender/compositor/operations/COM_TranslateOperation.cc @@ -51,10 +51,23 @@ void TranslateOperation::get_area_of_interest(const int input_idx, const int delta_x = this->get_delta_x(); BLI_rcti_translate(&r_input_area, -delta_x, 0); } + else if (x_extend_mode_ == MemoryBufferExtend::Repeat) { + /* The region of interest should consider the whole input image to avoid cropping effects, + * e.g. by prior scaling or rotating. Note: this is still consistent with immediate + * realization of transform nodes in GPU compositor, where nodes are to be evaluated from + * left to right. */ + const int in_width = get_width(); + BLI_rcti_resize_x(&r_input_area, in_width); + } + if (y_extend_mode_ == MemoryBufferExtend::Clip) { const int delta_y = this->get_delta_y(); BLI_rcti_translate(&r_input_area, 0, -delta_y); } + else if (y_extend_mode_ == MemoryBufferExtend::Repeat) { + const int in_height = get_height(); + BLI_rcti_resize_y(&r_input_area, in_height); + } } else { r_input_area = output_area;