aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathRef.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-02-18 04:11:48 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-18 04:11:49 -0800
commit8e7b19d0f04f286ec283747ec128e9696c842858 (patch)
tree61cc65ef71e223b93f09775d6e603161ed5f2360 /src/core/SkPathRef.cpp
parentc5eddd7d8d67a6e931973a729c5868c155cb751f (diff)
add interp path
Add path methods to determine if a pair of paths can be interpolated, and to interpolate them. R=reed@google.com, robertphillips@google.com BUG=skia:4549 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1703943003 Review URL: https://codereview.chromium.org/1703943003
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r--src/core/SkPathRef.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index 49a04999ac..b18055136f 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -299,6 +299,19 @@ void SkPathRef::copy(const SkPathRef& ref,
SkDEBUGCODE(this->validate();)
}
+
+void SkPathRef::interpolate(const SkPathRef& ending, SkScalar weight, SkPathRef* out) const {
+ const SkScalar* inValues = &ending.getPoints()->fX;
+ SkScalar* outValues = &out->getPoints()->fX;
+ int count = out->countPoints() * 2;
+ for (int index = 0; index < count; ++index) {
+ outValues[index] = outValues[index] * weight + inValues[index] * (1 - weight);
+ }
+ out->fBoundsIsDirty = true;
+ out->fIsOval = false;
+ out->fIsRRect = false;
+}
+
SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb,
int numVbs,
SkScalar** weights) {