avoid degenerate point in addPath extend mode
SkPath::addPath(... SkPath::kExtend_AddPathMode) duplicates the last point if the added path first point is the same, resulting in: path.xVerbTo(..., pt); path.lineTo(pt); The extra point has no effect in filling or stroking. Pathops uses extend mode a lot; fixing this avoids the output of Op() and Simplify() requiring another pass through Simplify() to reduce the path to its minimum. R=reed@google.com,robertphillips@google.com Bug: skia:8227 Change-Id: I7d660b6dc45e37221abf351dd291b90c303943ec Reviewed-on: https://skia-review.googlesource.com/147810 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
This commit is contained in:
parent
98900b52ba
commit
54ff302cdc
@ -1592,7 +1592,11 @@ SkPath& SkPath::addPath(const SkPath& path, const SkMatrix& matrix, AddPathMode
|
||||
proc(matrix, &pts[0], &pts[0], 1);
|
||||
if (firstVerb && mode == kExtend_AddPathMode && !isEmpty()) {
|
||||
injectMoveToIfNeeded(); // In case last contour is closed
|
||||
this->lineTo(pts[0]);
|
||||
SkPoint lastPt;
|
||||
// don't add lineTo if it is degenerate
|
||||
if (fLastMoveToIndex < 0 || !this->getLastPt(&lastPt) || lastPt != pts[0]) {
|
||||
this->lineTo(pts[0]);
|
||||
}
|
||||
} else {
|
||||
this->moveTo(pts[0]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user