Image warping when scaling
When scaling an image using target.crop, as you adjust the rectangle, the aspect ratio of the output doesn't stay consistent and the image looks warped.
Examples:
I looked around the code and found something that might be the problem at https://code.videolan.org/videolan/libplacebo/-/blob/master/src/renderer.c#L1762. I think dividing by stretch causes the image rect to be incorrect.
diff --git a/src/renderer.c b/src/renderer.c
index 7f7efe8..f033733 100644
--- a/src/renderer.c
+++ b/src/renderer.c
@@ -1759,8 +1759,8 @@ static bool pass_read_image(struct pass_state *pass)
.rect = {
off_x,
off_y,
- off_x + pl_rect_w(ref->img.rect) / stretch_x,
- off_y + pl_rect_h(ref->img.rect) / stretch_y,
+ off_x + pl_rect_w(ref->img.rect),
+ off_y + pl_rect_h(ref->img.rect),
},
};
With this patch I get behavior that I would expect, but I'm not sure if there is something I'm missing.
Edited by Andrew Opalach