aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/skottie/Skottie.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-03-22 12:20:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-03-22 16:43:05 +0000
commit69526b023cc9cdced1ae1df74002b11cd6709b12 (patch)
treead11cdb6ffc446c48f39a41f88c3db680f4712f9 /experimental/skottie/Skottie.cpp
parent1a605cd396620d30a8f2b11bf57439fce5927a00 (diff)
[sksg] Simplify TrimEffect
Move the Lottie-specific bits to Skottie and keep TrimEffect as a thin SkTrimPathEffect wrapper. TBR= Change-Id: Iecc6624d01ba61eb96a2056ef8e9e24e731f8979 Reviewed-on: https://skia-review.googlesource.com/115923 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental/skottie/Skottie.cpp')
-rw-r--r--experimental/skottie/Skottie.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/experimental/skottie/Skottie.cpp b/experimental/skottie/Skottie.cpp
index a7b6b23817..5a04e5a719 100644
--- a/experimental/skottie/Skottie.cpp
+++ b/experimental/skottie/Skottie.cpp
@@ -427,19 +427,21 @@ std::vector<sk_sp<sksg::GeometryNode>> AttachTrimGeometryEffect(
std::vector<sk_sp<sksg::GeometryNode>> trimmed;
trimmed.reserve(inputs.size());
for (const auto& i : inputs) {
- const auto trim = sksg::TrimEffect::Make(i);
- trimmed.push_back(trim);
+ const auto trimEffect = sksg::TrimEffect::Make(i);
+ trimmed.push_back(trimEffect);
+
+ const auto trimComposite = sk_make_sp<CompositeTrimEffect>(std::move(trimEffect));
BindProperty<ScalarValue>(jtrim["s"], &ctx->fAnimators,
- [trim](const ScalarValue& s) {
- trim->setStart(s * 0.01f);
+ [trimComposite](const ScalarValue& s) {
+ trimComposite->setStart(s);
});
BindProperty<ScalarValue>(jtrim["e"], &ctx->fAnimators,
- [trim](const ScalarValue& e) {
- trim->setEnd(e * 0.01f);
+ [trimComposite](const ScalarValue& e) {
+ trimComposite->setEnd(e);
});
BindProperty<ScalarValue>(jtrim["o"], &ctx->fAnimators,
- [trim](const ScalarValue& o) {
- trim->setOffset(o / 360);
+ [trimComposite](const ScalarValue& o) {
+ trimComposite->setOffset(o);
});
}