Vincent Povirk : gdiplus: Set flatness more appropriately in GdipDrawPath.

Alexandre Julliard julliard at winehq.org
Thu Jun 29 15:23:25 CDT 2017


Module: wine
Branch: master
Commit: 6ec3cd9434488ba5bc0fd271a47b7d46827477c5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6ec3cd9434488ba5bc0fd271a47b7d46827477c5

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Jun 29 13:41:05 2017 -0500

gdiplus: Set flatness more appropriately in GdipDrawPath.

If the path is going to be scaled before rendering, 1.0 does not make
sense as an error value.

Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/graphics.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 815ffb0..a6df52c 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3715,6 +3715,7 @@ static GpStatus SOFTWARE_GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *
     GpStatus stat;
     GpPath *wide_path;
     GpMatrix *transform=NULL;
+    REAL flatness=1.0;
 
     /* Check if the final pen thickness in pixels is too thin. */
     if (pen->unit == UnitPixel)
@@ -3756,9 +3757,24 @@ static GpStatus SOFTWARE_GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *
             stat = get_graphics_transform(graphics, CoordinateSpaceDevice,
                 CoordinateSpaceWorld, transform);
     }
+    else
+    {
+        /* Set flatness based on the final coordinate space */
+        GpMatrix t;
+
+        stat = get_graphics_transform(graphics, CoordinateSpaceDevice,
+            CoordinateSpaceWorld, &t);
+
+        if (stat != Ok)
+            return stat;
+
+        flatness = 1.0/sqrt(fmax(
+            t.matrix[0] * t.matrix[0] + t.matrix[1] * t.matrix[1],
+            t.matrix[2] * t.matrix[2] + t.matrix[3] * t.matrix[3]));
+    }
 
     if (stat == Ok)
-        stat = GdipWidenPath(wide_path, pen, transform, 1.0);
+        stat = GdipWidenPath(wide_path, pen, transform, flatness);
 
     if (pen->unit == UnitPixel)
     {




More information about the wine-cvs mailing list