From 73a722ce97ad935f936a4c7512b6724c41e0ce4e Mon Sep 17 00:00:00 2001 From: Florin Malita Date: Tue, 5 Nov 2019 08:46:05 -0500 Subject: [PATCH] [skottie] Fix trim path mode interpretation "m": 1 -> parallel trim "m": 2 -> serial trim (we had these backwards) TBR= Bug: skia:9599 Change-Id: Ib764c04a96c3a1e627553d8b8588028a411b5240 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252796 Reviewed-by: Florin Malita Commit-Queue: Florin Malita --- modules/skottie/src/layers/ShapeLayer.cpp | 8 ++++---- resources/skottie/skottie-trimpath-modes.json | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 resources/skottie/skottie-trimpath-modes.json diff --git a/modules/skottie/src/layers/ShapeLayer.cpp b/modules/skottie/src/layers/ShapeLayer.cpp index 06a5c568cd..7396696cda 100644 --- a/modules/skottie/src/layers/ShapeLayer.cpp +++ b/modules/skottie/src/layers/ShapeLayer.cpp @@ -292,15 +292,15 @@ std::vector> AttachTrimGeometryEffect( std::vector>&& geos) { enum class Mode { - kMerged, // "m": 1 - kSeparate, // "m": 2 - } gModes[] = { Mode::kMerged, Mode::kSeparate }; + kParallel, // "m": 1 (Trim Multiple Shapes: Simultaneously) + kSerial, // "m": 2 (Trim Multiple Shapes: Individually) + } gModes[] = { Mode::kParallel, Mode::kSerial}; const auto mode = gModes[SkTMin(ParseDefault(jtrim["m"], 1) - 1, SK_ARRAY_COUNT(gModes) - 1)]; std::vector> inputs; - if (mode == Mode::kMerged) { + if (mode == Mode::kSerial) { inputs.push_back(Merge(std::move(geos), sksg::Merge::Mode::kMerge)); } else { inputs = std::move(geos); diff --git a/resources/skottie/skottie-trimpath-modes.json b/resources/skottie/skottie-trimpath-modes.json new file mode 100644 index 0000000000..2a98463747 --- /dev/null +++ b/resources/skottie/skottie-trimpath-modes.json @@ -0,0 +1 @@ +{"v":"5.5.5","fr":60,"ip":0,"op":601,"w":500,"h":500,"nm":"trim path","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,125,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[400,200],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"d":1,"ty":"el","s":{"a":0,"k":[350,150],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"sr","sy":1,"d":1,"pt":{"a":0,"k":5,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"ir":{"a":0,"k":26,"ix":6},"is":{"a":0,"k":0,"ix":8},"or":{"a":0,"k":54,"ix":7},"os":{"a":0,"k":0,"ix":9},"ix":3,"nm":"Polystar Path 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":600,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":4,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.400428920984,0.433624386787,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":15,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":601,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,375,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":0,"k":[400,200],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"d":1,"ty":"el","s":{"a":0,"k":[350,150],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"sr","sy":1,"d":1,"pt":{"a":0,"k":5,"ix":3},"p":{"a":0,"k":[0,0],"ix":4},"r":{"a":0,"k":0,"ix":5},"ir":{"a":0,"k":26,"ix":6},"is":{"a":0,"k":0,"ix":8},"or":{"a":0,"k":54,"ix":7},"os":{"a":0,"k":0,"ix":9},"ix":3,"nm":"Polystar Path 1","mn":"ADBE Vector Shape - Star","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":600,"s":[100]}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":2,"ix":4,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":4,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.400428920984,0.433624386787,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":15,"ix":5},"lc":1,"lj":1,"ml":4,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":601,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":1,"nm":"White Solid 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[250,250,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"sw":500,"sh":500,"sc":"#ffffff","ip":0,"op":601,"st":0,"bm":0}],"markers":[]} \ No newline at end of file