Index: src/core/SkPath.cpp |
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
index 04c807b64415492aa4b3ee617391a22c2800ea78..04f7420a393ebd337b52f5c54b834bcacc7076b0 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,16 @@ void SkPath::addPath(const SkPath& path, const SkMatrix& matrix) { |
Verb verb; |
SkMatrix::MapPtsProc proc = matrix.getMapPtsProc(); |
- |
+ bool firstVerb = true; |
reed1
2014/02/07 18:08:01
can we change this to:
bool firstVerb = (kExtend
|
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 == kJoin_AddPathMode) { |
+ this->lineTo(pts[0]); |
+ } else { |
+ this->moveTo(pts[0]); |
+ } |
break; |
case kLine_Verb: |
proc(matrix, &pts[1], &pts[1], 1); |
@@ -1487,6 +1491,7 @@ void SkPath::addPath(const SkPath& path, const SkMatrix& matrix) { |
default: |
SkDEBUGFAIL("unknown verb"); |
} |
+ firstVerb = false; |
} |
} |