Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/gdiplus/graphicspath.c | 25 ++++++++++--------------- dlls/gdiplus/tests/graphicspath.c | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 12ecd344cb..9454a9dfbf 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -222,7 +222,9 @@ GpStatus extend_current_figure(GpPath *path, INT count, REAL x1, REAL y1, INT *o GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, REAL startAngle, REAL sweepAngle) { - INT count, old_count, i; + GpPointF *ptf; + GpStatus status; + INT count;
TRACE("(%p, %.2f, %.2f, %.2f, %.2f, %.2f, %.2f)\n", path, x1, y1, x2, y2, startAngle, sweepAngle); @@ -231,26 +233,19 @@ GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x1, REAL y1, REAL x2, return InvalidParameter;
count = arc2polybezier(NULL, x1, y1, x2, y2, startAngle, sweepAngle); - if(count == 0) return Ok; - if(!lengthen_path(path, count)) - return OutOfMemory;
- old_count = path->pathdata.Count; - arc2polybezier(&path->pathdata.Points[old_count], x1, y1, x2, y2, - startAngle, sweepAngle); + ptf = heap_alloc_zero(sizeof(GpPointF)*count); + if(!ptf) + return OutOfMemory;
- for(i = 0; i < count; i++){ - path->pathdata.Types[old_count + i] = PathPointTypeBezier; - } + arc2polybezier(ptf, x1, y1, x2, y2, startAngle, sweepAngle);
- path->pathdata.Types[old_count] = - (path->newfigure ? PathPointTypeStart : PathPointTypeLine); - path->newfigure = FALSE; - path->pathdata.Count += count; + status = GdipAddPathBeziers(path, ptf, count);
- return Ok; + heap_free(ptf); + return status; }
/******************************************************************************* diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index b3ee72f29b..a02500bc1d 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -435,6 +435,13 @@ static path_test_t arc_path[] = { {450.9, 824.1, PathPointTypeBezier, 0, 0}, /*36*/ {540.4, 676.9, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 1} /*37*/ }; +static path_test_t arc_path2[] = { + {1.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/ + {1.0, 0.5, PathPointTypeLine, 0, 0}, /*1*/ + {1.0, 0.776142, PathPointTypeBezier, 0, 0}, /*2*/ + {0.776142, 1.0, PathPointTypeBezier, 0, 0}, /*3*/ + {0.5, 1.0, PathPointTypeBezier, 0, 0} /*4*/ + };
static void test_arc(void) { @@ -463,6 +470,13 @@ static void test_arc(void)
ok_path(path, arc_path, ARRAY_SIZE(arc_path), FALSE);
+ GdipResetPath(path); + GdipAddPathLine(path, 1.0, 0.0, 1.0, 0.5); + status = GdipAddPathArc(path, 0.0, 0.0, 1.0, 1.0, 0.0, 90.0); + expect(Ok, status); + + ok_path_fudge(path, arc_path2, ARRAY_SIZE(arc_path2), FALSE, 0.000005); + GdipDeletePath(path); }