gdiplus: Set flatness more appropriately in GdipDrawPath.

Vincent Povirk vincent at codeweavers.com
Thu Jun 29 13:41:05 CDT 2017


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>
---
 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 025dfa5..7ef0d11 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -3722,6 +3722,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)
@@ -3763,9 +3764,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)
     {
-- 
2.7.4




More information about the wine-patches mailing list