Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Unified Diff: src/core/SkPath.cpp

Issue 1703943003: add interp path (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698