remember to injectmoveto before arcTo

Bug: skia:9077
Change-Id: Iee1862fb3ebf2c0801794598ccf8a6977fa3ba1b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285841
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2020-04-28 15:17:48 -04:00 committed by Skia Commit-Bot
parent 2becdde074
commit 3c411f58c4
2 changed files with 20 additions and 0 deletions

View File

@ -660,3 +660,21 @@ DEF_SIMPLE_GM(path_stroke_clip_crbug1070835, canvas, 25, 50) {
surf->draw(orig, 0, 0, nullptr);
}
DEF_SIMPLE_GM(path_arcto_skbug_9077, canvas, 200, 200) {
SkPaint p;
p.setColor(SK_ColorRED);
p.setAntiAlias(true);
p.setStyle(SkPaint::kStroke_Style);
p.setStrokeWidth(2);
SkPath path;
SkPoint pts[] = { {20, 20}, {100, 20}, {100, 60}, {130, 150}, {180, 160} };
SkScalar radius = 60;
path.moveTo(pts[0]);
path.lineTo(pts[1]);
path.lineTo(pts[2]);
path.close();
path.arcTo(pts[3], pts[4], radius);
canvas->drawPath(path, p);
}

View File

@ -1308,6 +1308,8 @@ SkPath& SkPath::addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAn
for the arc go behind pt1 and/or p2...
*/
SkPath& SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius) {
this->injectMoveToIfNeeded();
if (radius == 0) {
return this->lineTo(x1, y1);
}