From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/gdiplus/graphicspath.c | 32 +++++++++++++++++++++---------- dlls/gdiplus/tests/graphicspath.c | 8 ++++---- 2 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 1ffabcbba86..c2be46f1260 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -562,15 +562,23 @@ GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points,
tension = tension * TENSION_CONST;
- calc_curve_bezier_endp(points[offset].X, points[offset].Y, points[offset + 1].X, points[offset + 1].Y, - tension, &x1, &y1); - pt[0].X = points[offset].X; pt[0].Y = points[offset].Y; - pt[1].X = x1; - pt[1].Y = y1; + if (offset > 0) + { + calc_curve_bezier(&(points[offset - 1]), tension, &x1, &y1, &x2, &y2); + pt[1].X = x2; + pt[1].Y = y2; + } + else + { + calc_curve_bezier_endp(points[offset].X, points[offset].Y, + points[offset + 1].X, points[offset + 1].Y, tension, &x1, &y1); + pt[1].X = x1; + pt[1].Y = y1; + }
- for(i = 0; i < nseg-1; i++){ + for (i = 0; i < nseg - 1; i++){ calc_curve_bezier(&(points[offset + i]), tension, &x1, &y1, &x2, &y2);
pt[3*i+2].X = x1; @@ -581,13 +589,17 @@ GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, pt[3*i+4].Y = y2; }
- calc_curve_bezier_endp(points[offset + nseg].X, points[offset + nseg].Y, - points[offset + nseg - 1].X, points[offset + nseg - 1].Y, tension, &x1, &y1); + if (offset + nseg + 1 < count) + /* If there are one more point in points table then use it for curve calculation */ + calc_curve_bezier(&(points[offset + nseg - 1]), tension, &x1, &y1, &x2, &y2); + else + calc_curve_bezier_endp(points[offset + nseg].X, points[offset + nseg].Y, + points[offset + nseg - 1].X, points[offset + nseg - 1].Y, tension, &x1, &y1);
- pt[len_pt-2].X = x1; - pt[len_pt-2].Y = y1; pt[len_pt-1].X = points[offset + nseg].X; pt[len_pt-1].Y = points[offset + nseg].Y; + pt[len_pt-2].X = x1; + pt[len_pt-2].Y = y1;
stat = extend_current_figure(path, pt, len_pt, PathPointTypeBezier);
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index bf9b5a4246e..8eea57ec769 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -935,7 +935,7 @@ static path_test_t addcurve_path2[] = { }; static path_test_t addcurve_path3[] = { {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/ - {13.3, 16.7, PathPointTypeBezier, 0, 1}, /*1*/ + {13.3, 16.7, PathPointTypeBezier, 0, 0}, /*1*/ {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*2*/ {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*3*/ {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*4*/ @@ -945,13 +945,13 @@ static path_test_t addcurve_path3[] = { static path_test_t addcurve_path4[] = { {0.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/ {3.33, 3.33, PathPointTypeBezier, 0, 0}, /*1*/ - {6.66, 3.33, PathPointTypeBezier, 0, 1}, /*2*/ + {6.66, 3.33, PathPointTypeBezier, 0, 0}, /*2*/ {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*3*/ }; static path_test_t addcurve_path5[] = { {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/ - {13.3, 16.6, PathPointTypeBezier, 0, 1}, /*1*/ - {3.33, 20.0, PathPointTypeBezier, 0, 1}, /*2*/ + {13.3, 16.6, PathPointTypeBezier, 0, 0}, /*1*/ + {3.33, 20.0, PathPointTypeBezier, 0, 0}, /*2*/ {10.0, 20.0, PathPointTypeBezier, 0, 0} /*3*/ };