From 7b5af23604867e3b8f1a328424dbea08b3141934 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 24 Apr 2012 16:43:06 -0500 Subject: [PATCH] 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 8096507661d..d37512ec73d 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; ipathdata.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)