Fixed potential image resampling conditions by using exact pixel coordinates
From: Wei Xie xiewei@uniontech.com
Fixed potential image resampling conditions by using exact pixel coordinates --- dlls/gdiplus/graphics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 8fa0d689cbe..6dd5a83092f 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -3260,8 +3260,8 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image graphics->scale, image->xres, image->yres, bitmap->format, imageAttributes ? imageAttributes->outside_color : 0);
- if (ptf[1].Y != ptf[0].Y || ptf[2].X != ptf[0].X || - ptf[1].X - ptf[0].X != srcwidth || ptf[2].Y - ptf[0].Y != srcheight || + if (pti[1].y != pti[0].y || pti[2].x != pti[0].x|| + pti[1].x - pti[0].x != gdip_round(srcwidth) || pti[2].y - pti[0].y != gdip_round(srcheight) || srcx < 0 || srcy < 0 || srcx + srcwidth > bitmap->width || srcy + srcheight > bitmap->height) do_resampling = TRUE;
I'm not sure about this. We may still want to rescale the image even if the coordinates are within 1 pixel. Maybe we could use a smaller delta?
[test_draw_image_resampling.cpp](/uploads/283a7f5a477eb2ea2496c371639e32a1/test_draw_image_resampling.cpp)
Using this program to compare the execution results of wine and Windows, it can be seen that the difference below Windows is 0.1 should not be resampled.
{width=408 height=104}
{width=413 height=92}