From: Bartosz Kosiorek gang65@poczta.onet.pl
Fixes Reverse_Pie test in Mono: https://github.com/madewokherd/mono/blob/develop/mcs/class/System.Drawing/Te... --- dlls/gdiplus/graphicspath.c | 16 ++++++++++------ dlls/gdiplus/tests/graphicspath.c | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index cbf8e74340b..75f08869818 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -1749,20 +1749,24 @@ GpStatus WINGDIPAPI GdipReversePath(GpPath* path) }
for(i = 0; i < count; i++){ - /* find next start point */ if(path->pathdata.Types[count-i-1] == PathPointTypeStart){ INT j; for(j = start; j <= i; j++){ + /* copy points coordinate of subpath in reverse order */ revpath.Points[j] = path->pathdata.Points[count-j-1]; - revpath.Types[j] = path->pathdata.Types[count-j-1]; + /* copy points type shifted by one (j + 1), as the first point type is always PathPointTypeStart */ + if (j < i) + revpath.Types[j + 1] = path->pathdata.Types[count - j - 1]; } - /* mark start point */ + /* first point of subpath is always Start point */ revpath.Types[start] = PathPointTypeStart; - /* set 'figure' endpoint type */ + /* check if subpath contains more than 1 point */ if(i-start > 1){ - revpath.Types[i] = path->pathdata.Types[count-start-1] & ~PathPointTypePathTypeMask; - revpath.Types[i] |= revpath.Types[i-1]; + /* add e.g. PathPointTypeCloseSubpath type to endpoint, if existing in original subpath */ + revpath.Types[i] |= path->pathdata.Types[count - start - 1] & ~PathPointTypePathTypeMask; + /* remove e.g. PathPointTypeCloseSubpath type from second point */ + revpath.Types[start + 1] &= PathPointTypePathTypeMask; } else revpath.Types[i] = path->pathdata.Types[start]; diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index af9ee3ba853..187d47d1603 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -1165,7 +1165,7 @@ static path_test_t reverse_pie_path[] = { {3.88, 4.79, PathPointTypeStart, 0, 0}, /*0*/ {3.93, 4.62, PathPointTypeBezier, 0, 0}, /*1*/ {3.96, 4.44, PathPointTypeBezier, 0, 0}, /*2*/ - {3.99, 4.26, PathPointTypeBezier, 0, 1}, /*3*/ + {3.99, 4.26, PathPointTypeBezier, 0, 0}, /*3*/ {2.5, 4.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0} /*4*/ };