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
This commit is contained in:
Habib Gahbiche
2024-03-11 22:08:49 +01:00
parent 054ef616ce
commit f64d02ecb1

View File

@@ -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;