Index: src/core/SkPath.cpp |
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
index 04c807b64415492aa4b3ee617391a22c2800ea78..175c780ecd3c1ac7b390a6bdcd97bc7cc3c57684 100644 |
--- a/src/core/SkPath.cpp |
+++ b/src/core/SkPath.cpp |
@@ -1443,14 +1443,14 @@ void SkPath::arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, |
/////////////////////////////////////////////////////////////////////////////// |
-void SkPath::addPath(const SkPath& path, SkScalar dx, SkScalar dy) { |
+void SkPath::addPath(const SkPath& path, SkScalar dx, SkScalar dy, AddPathMode mode) { |
SkMatrix matrix; |
matrix.setTranslate(dx, dy); |
- this->addPath(path, matrix); |
+ this->addPath(path, matrix, mode); |
} |
-void SkPath::addPath(const SkPath& path, const SkMatrix& matrix) { |
+void SkPath::addPath(const SkPath& path, const SkMatrix& matrix, AddPathMode mode) { |
SkPathRef::Editor(&fPathRef, path.countVerbs(), path.countPoints()); |
RawIter iter(path); |
@@ -1458,12 +1458,17 @@ void SkPath::addPath(const SkPath& path, const SkMatrix& matrix) { |
Verb verb; |
SkMatrix::MapPtsProc proc = matrix.getMapPtsProc(); |
- |
+ bool firstVerb = true; |
while ((verb = iter.next(pts)) != kDone_Verb) { |
switch (verb) { |
case kMove_Verb: |
proc(matrix, &pts[0], &pts[0], 1); |
- this->moveTo(pts[0]); |
+ if (firstVerb && mode == kExtend_AddPathMode && !isEmpty()) { |
+ injectMoveToIfNeeded(); // In case last contour is closed |
+ this->lineTo(pts[0]); |
+ } else { |
+ this->moveTo(pts[0]); |
+ } |
break; |
case kLine_Verb: |
proc(matrix, &pts[1], &pts[1], 1); |
@@ -1487,6 +1492,7 @@ void SkPath::addPath(const SkPath& path, const SkMatrix& matrix) { |
default: |
SkDEBUGFAIL("unknown verb"); |
} |
+ firstVerb = false; |
} |
} |