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

Unified Diff: src/core/SkPath.cpp

Issue 1703943003: add interp path (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test to error if conics don't match 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
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698