[PATCH 1/2] gdiplus: Fix rounding dst_area borders for GdipDrawImagePointsRect().

Jan Havran havran.jan at email.cz
Sun Mar 24 09:48:29 CDT 2019


Signed-off-by: Jan Havran <havran.jan at email.cz>
---
 dlls/gdiplus/graphics.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 3216a3ea43..82f0cc79f5 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -302,6 +302,16 @@ static void round_points(POINT *pti, GpPointF *ptf, INT count)
     }
 }
 
+static void ceil_points(POINT *pti, GpPointF *ptf, INT count)
+{
+    int i;
+
+    for(i = 0; i < count; i++){
+        pti[i].x = ceilr(ptf[i].X);
+        pti[i].y = ceilr(ptf[i].Y);
+    }
+}
+
 static void gdi_alpha_blend(GpGraphics *graphics, INT dst_x, INT dst_y, INT dst_width, INT dst_height,
                             HDC hdc, INT src_x, INT src_y, INT src_width, INT src_height)
 {
@@ -3013,7 +3023,20 @@ GpStatus WINGDIPAPI GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image
     if (!srcwidth || !srcheight || (ptf[3].X == ptf[0].X && ptf[3].Y == ptf[0].Y))
         return Ok;
     gdip_transform_points(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceWorld, ptf, 4);
-    round_points(pti, ptf, 4);
+
+    switch (graphics->pixeloffset)
+    {
+    default:
+    case PixelOffsetModeNone:
+    case PixelOffsetModeHighSpeed:
+        ceil_points(pti, ptf, 4);
+        break;
+
+    case PixelOffsetModeHalf:
+    case PixelOffsetModeHighQuality:
+        round_points(pti, ptf, 4);
+        break;
+    }
 
     TRACE("%s %s %s %s\n", wine_dbgstr_point(&pti[0]), wine_dbgstr_point(&pti[1]),
         wine_dbgstr_point(&pti[2]), wine_dbgstr_point(&pti[3]));
-- 
2.21.0




More information about the wine-devel mailing list