Index: src/core/SkPath.cpp |
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
index dcc3e0202dc0cf8e0c1e88532b290f7a07930a63..67508149a264f5904298193c86901469781586e5 100644 |
--- a/src/core/SkPath.cpp |
+++ b/src/core/SkPath.cpp |
@@ -193,6 +193,33 @@ void SkPath::swap(SkPath& that) { |
} |
} |
+bool SkPath::isInterpolatable(const SkPath& compare) const { |
+ int count = fPathRef->countVerbs(); |
+ if (count != compare.fPathRef->countVerbs()) { |
+ return false; |
+ } |
+ if (!count) { |
+ return true; |
+ } |
+ if (memcmp(fPathRef->verbsMemBegin(), compare.fPathRef->verbsMemBegin(), |
+ count)) { |
+ return false; |
+ } |
+ return !SkToBool(memcmp(fPathRef->conicWeights(), compare.fPathRef->conicWeights(), |
+ fPathRef->countWeights() * sizeof(*fPathRef->conicWeights()))); |
+} |
+ |
+bool SkPath::interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const { |
+ int verbCount = fPathRef->countVerbs(); |
+ if (verbCount != ending.fPathRef->countVerbs()) { |
+ return false; |
+ } |
+ out->reset(); |
+ out->addPath(*this); |
+ fPathRef->interpolate(*ending.fPathRef, weight, out->fPathRef); |
+ return true; |
+} |
+ |
static inline bool check_edge_against_rect(const SkPoint& p0, |
const SkPoint& p1, |
const SkRect& rect, |