Index: src/core/SkPath.cpp |
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
index dcc3e0202dc0cf8e0c1e88532b290f7a07930a63..84cfe4763afddc00014b78247580e2a23f19255c 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(), |
robertphillips
2016/02/17 21:08:49
line 'count' up with the '(' ?
caryclark
2016/02/17 21:39:21
Done.
|
+ count)) { |
+ return false; |
+ } |
robertphillips
2016/02/17 21:08:49
Shouldn't these be conicWeights not verbsMemBegin
caryclark
2016/02/17 21:39:21
Aack! I blame ctrl-v. (Done)
|
+ return !SkToBool(memcmp(fPathRef->verbsMemBegin(), compare.fPathRef->verbsMemBegin(), |
robertphillips
2016/02/17 21:08:49
just countWeights() ?
caryclark
2016/02/17 21:39:21
Done.
|
+ (char* ) fPathRef->conicWeightsEnd() - (char* ) 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, |