aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-01-22 23:13:10 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-23 04:42:45 +0000
commit055b0f5cb0b1eba1cfa7736642dd5b08e97e2045 (patch)
treec3b8c561858b20ef372a32b8d52fa9d350ed146f /experimental
parent731dd8dac2350ac03b787bbe6ae7ce07a66fb305 (diff)
[skottie] Improved trim path support
|offset| is an angular value in [0..360]. TBR= Change-Id: I10a91bec7e8f43db1f54c8b5358dd0604c974998 Reviewed-on: https://skia-review.googlesource.com/98560 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental')
-rw-r--r--experimental/skottie/Skottie.cpp3
-rw-r--r--experimental/sksg/geometry/SkSGTrimEffect.cpp6
2 files changed, 4 insertions, 5 deletions
diff --git a/experimental/skottie/Skottie.cpp b/experimental/skottie/Skottie.cpp
index becf3bf470..da3023d2e4 100644
--- a/experimental/skottie/Skottie.cpp
+++ b/experimental/skottie/Skottie.cpp
@@ -471,10 +471,9 @@ std::vector<sk_sp<sksg::GeometryNode>> AttachTrimGeometryEffect(
[](sksg::TrimEffect* node, const ScalarValue& e) {
node->setEnd(e * 0.01f);
});
- // TODO: "offset" doesn't currently work the same as BM - figure out what's going on.
BindProperty<ScalarValue>(jtrim["o"], ctx, trim,
[](sksg::TrimEffect* node, const ScalarValue& o) {
- node->setOffset(o * 0.01f);
+ node->setOffset(o / 360);
});
}
diff --git a/experimental/sksg/geometry/SkSGTrimEffect.cpp b/experimental/sksg/geometry/SkSGTrimEffect.cpp
index f3118221d5..afcc7e46b6 100644
--- a/experimental/sksg/geometry/SkSGTrimEffect.cpp
+++ b/experimental/sksg/geometry/SkSGTrimEffect.cpp
@@ -35,9 +35,9 @@ void TrimEffect::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
pathLen += measure.getLength();
} while (measure.nextContour());
- const auto start = SkScalarPin(fStart , 0, 1) * pathLen,
- end = SkScalarPin(fEnd , 0, 1) * pathLen,
- offset = SkScalarPin(fOffset, 0, 1) * pathLen,
+ const auto start = pathLen * fStart,
+ end = pathLen * fEnd,
+ offset = pathLen * fOffset,
len = end - start;
if (len <= 0) {