aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/skottie/Skottie.cpp
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-04-30 21:49:41 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-01 02:27:34 +0000
commitc353ee211fc99c0bf2035f9e77f87fd67b3c19c5 (patch)
treed24124815de77799c3efe0f8fff4427c96b21bec /experimental/skottie/Skottie.cpp
parentd5750b6b33bfe9c6ced5a98d2782099ff620b07a (diff)
[skottie] Power-reduce paths (cubicTo -> lineTo)
For straight lines, Lottie exports control points conincident with the vertices. We can detect this case and emit more efficient lineTo's. One wrinkle: we can only apply this power-reduction post-interpolation (otherwise the path verbs and point count would not be guaranteed to match). Hence we store explicit shape data and defer the SkPath conversion. TBR= Change-Id: I7818be464eabee6096d2078440843243a55c6e98 Reviewed-on: https://skia-review.googlesource.com/124800 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.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/experimental/skottie/Skottie.cpp b/experimental/skottie/Skottie.cpp
index bb98ad75f0..1b5886eee0 100644
--- a/experimental/skottie/Skottie.cpp
+++ b/experimental/skottie/Skottie.cpp
@@ -149,7 +149,9 @@ sk_sp<sksg::RenderNode> AttachComposition(const Json::Value&, AttachContext* ctx
sk_sp<sksg::Path> AttachPath(const Json::Value& jpath, AttachContext* ctx) {
auto path_node = sksg::Path::Make();
return BindProperty<ShapeValue>(jpath, &ctx->fAnimators,
- [path_node](const ShapeValue& p) { path_node->setPath(p); })
+ [path_node](const ShapeValue& p) {
+ path_node->setPath(ValueTraits<ShapeValue>::As<SkPath>(p));
+ })
? path_node
: nullptr;
}