Fix #119973: Flip node produces artifacts

The Flip node produces artifacts if not connected directly to an input.
This due to a wrong calculation of depending area of interest, which is
a regressed introduced in 70a8a9e.

This is fixed by reverting the removal of the area of interest
calculation method in the aforementioned commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/120149
This commit is contained in:
Habib Gahbiche
2024-04-04 10:53:32 +02:00
committed by Omar Emara
parent 810bfcc30a
commit dcb81a434d
2 changed files with 31 additions and 0 deletions
@@ -34,6 +34,34 @@ void FlipOperation::execute_pixel_sampled(float output[4], float x, float y, Pix
input_operation_->read_sampled(output, nx, ny, sampler);
}
bool FlipOperation::determine_depending_area_of_interest(rcti *input,
ReadBufferOperation *read_operation,
rcti *output)
{
rcti new_input;
if (flip_x_) {
const int w = int(this->get_width()) - 1;
new_input.xmax = (w - input->xmin) + 1;
new_input.xmin = (w - input->xmax) - 1;
}
else {
new_input.xmin = input->xmin;
new_input.xmax = input->xmax;
}
if (flip_y_) {
const int h = int(this->get_height()) - 1;
new_input.ymax = (h - input->ymin) + 1;
new_input.ymin = (h - input->ymax) - 1;
}
else {
new_input.ymin = input->ymin;
new_input.ymax = input->ymax;
}
return NodeOperation::determine_depending_area_of_interest(&new_input, read_operation, output);
}
void FlipOperation::update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs)
@@ -16,6 +16,9 @@ class FlipOperation : public MultiThreadedOperation {
public:
FlipOperation();
bool determine_depending_area_of_interest(rcti *input,
ReadBufferOperation *read_operation,
rcti *output) override;
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
void init_execution() override;