[4/4] gdiplus: Implement GdipWidenPath for closed figures.

Vincent Povirk madewokherd at gmail.com
Thu Apr 26 08:54:07 CDT 2012


-------------- next part --------------
From 07e39f8b589326f6d94832ef86396d2dea8eb04a Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Tue, 24 Apr 2012 16:43:06 -0500
Subject: [PATCH 4/8] gdiplus: Implement GdipWidenPath for closed figures.

---
 dlls/gdiplus/graphicspath.c |   44 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 8096507..d37512e 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -1739,6 +1739,48 @@ static void widen_open_figure(GpPath *path, GpPen *pen, int start, int end,
     (*last_point)->type |= PathPointTypeCloseSubpath;
 }
 
+static void widen_closed_figure(GpPath *path, GpPen *pen, int start, int end,
+    path_list_node_t **last_point)
+{
+    int i;
+    path_list_node_t *prev_point;
+
+    if (end <= start+1)
+        return;
+
+    /* left outline */
+    prev_point = *last_point;
+
+    widen_joint(&path->pathdata.Points[end], &path->pathdata.Points[start],
+        &path->pathdata.Points[start+1], pen, last_point);
+
+    for (i=start+1; i<end; i++)
+        widen_joint(&path->pathdata.Points[i-1], &path->pathdata.Points[i],
+            &path->pathdata.Points[i+1], pen, last_point);
+
+    widen_joint(&path->pathdata.Points[end-1], &path->pathdata.Points[end],
+        &path->pathdata.Points[start], pen, last_point);
+
+    prev_point->next->type = PathPointTypeStart;
+    (*last_point)->type |= PathPointTypeCloseSubpath;
+
+    /* right outline */
+    prev_point = *last_point;
+
+    widen_joint(&path->pathdata.Points[start], &path->pathdata.Points[end],
+        &path->pathdata.Points[end-1], pen, last_point);
+
+    for (i=end-1; i>start; i--)
+        widen_joint(&path->pathdata.Points[i+1], &path->pathdata.Points[i],
+            &path->pathdata.Points[i-1], pen, last_point);
+
+    widen_joint(&path->pathdata.Points[start+1], &path->pathdata.Points[start],
+        &path->pathdata.Points[end], pen, last_point);
+
+    prev_point->next->type = PathPointTypeStart;
+    (*last_point)->type |= PathPointTypeCloseSubpath;
+}
+
 GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
     REAL flatness)
 {
@@ -1795,7 +1837,7 @@ GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix,
 
             if ((type&PathPointTypeCloseSubpath) == PathPointTypeCloseSubpath)
             {
-                FIXME("closed figures unimplemented\n");
+                widen_closed_figure(flat_path, pen, subpath_start, i, &last_point);
             }
             else if (i == flat_path->pathdata.Count-1 ||
                 (flat_path->pathdata.Types[i+1]&PathPointTypePathTypeMask) == PathPointTypeStart)
-- 
1.7.9.5


More information about the wine-patches mailing list