Commit Graph

969 Commits

Author SHA1 Message Date
Florin Malita
1022f74375 [skottie] Nested animation support
Extend composition layers to support referencing external .json
animations ("$"<PATH> syntax).

This is a custom extension (not supported in BM/Lottie).

Also make skottie::Animation ref-counted, to facilitate sharing.

TBR=

Change-Id: I062d031e5868d759f3930dea9b261f9b3ec81684
Reviewed-on: https://skia-review.googlesource.com/109806
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-23 19:15:26 +00:00
Florin Malita
97b3d2bcdb [sksg] Add 'plane' geometry node
SG geometry corresponding to SkCanvas::drawPaint().

TBR=

Change-Id: I3b368adda187fb92f524756496a3694c03a3113d
Reviewed-on: https://skia-review.googlesource.com/108562
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-20 17:08:53 +00:00
Florin Malita
c9649ce7d0 Guard ignored SVG attribute logging with SK_VERBOSE_SVG_PARSING
Change-Id: I01bb8c70dfcd3180aaf620f987b99ae0286cc48c
Reviewed-on: https://skia-review.googlesource.com/108160
Reviewed-by: Cary Clark <caryclark@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-16 19:13:26 +00:00
Cary Clark
48b56688e8 report ignore attr once only
bots like this one
https://chromium-swarm.appspot.com/task?id=3bb84dda02fc0e10
fill its log with this debug message, so just
write it once

R=fmalita@chromium.org
Bug: skia:
Change-Id: Ia82d89aa23c3a5984080f5d9efdc03ff18b6515e
Reviewed-on: https://skia-review.googlesource.com/108100
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-02-16 18:43:06 +00:00
Jim Van Verth
18c46b553a Delete GLFWTest
Change-Id: Ia303259e0e157d6066428183002748752fad3a7c
Reviewed-on: https://skia-review.googlesource.com/105606
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2018-02-08 22:45:20 +00:00
Florin Malita
796cda11e4 [skottie] FMA-friendlier lerp
TBR=

Change-Id: Id43e463da99bb0478c48ba48a909cead817e4498
Reviewed-on: https://skia-review.googlesource.com/103600
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-05 16:07:46 +00:00
Florin Malita
f8393c8619 [skottie] Split-position support
TBR=

Change-Id: I82433bc9a73f89956c2b25146e1521412d125945
Reviewed-on: https://skia-review.googlesource.com/102622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-02-01 17:48:08 +00:00
Florin Malita
21d0e8b0a6 [skottie] Clamp SkCubicMap results to [0,1]
Looks like SkCubicMap can produce slightly out-of-range values.

That's prolly some unimportant precision artifact, but since we're
asserting t is in [0,1] down the line it'd be nice to not crash in debug.

TBR=

Change-Id: I048b691d1c0f0977556d5b25893a6dab2b9986cc
Reviewed-on: https://skia-review.googlesource.com/102480
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 22:47:15 +00:00
Florin Malita
51012ce332 [sksg] Initial text support
Use the new node type for SkottieSlide2 labels.

TBR=

Change-Id: Icd6a4faf1c281bd83a2331c0072d1a6ed71acc09
Reviewed-on: https://skia-review.googlesource.com/102441
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-31 22:36:05 +00:00
Florin Malita
aa71c899fd [skottie] Anti-alias masks
TBR=

Change-Id: I16eca80b515fde8ad87a79c01ffd0ea2b3e31259
Reviewed-on: https://skia-review.googlesource.com/101740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-30 14:47:45 +00:00
Florin Malita
38ea40eb75 [skottie] Layer clip support
TBR=

Change-Id: Ibf65efc69031f8f6e19f4f28cccab29c357e704d
Reviewed-on: https://skia-review.googlesource.com/101540
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 21:57:44 +00:00
Florin Malita
eb87d67a83 [skottie] Time start, time stretch
Pre-compositions (only) can have their timelines adjusted via bias and
scale.

TBR=

Change-Id: I519fa1d7cf210f7f152dcabcbe004119a2cf08d9
Reviewed-on: https://skia-review.googlesource.com/101460
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 21:12:13 +00:00
Florin Malita
cca86f386c [skottie] Hierarchical animators
Instead of a flat animator space, introduce animator groups.

This allows us to encapsulate layer animators and only dispatch ticks
when their owning layer is active.

TBR=

Change-Id: I1fc8a55abf68a712b71969bb1a11275dbe54c236
Reviewed-on: https://skia-review.googlesource.com/101201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 16:16:21 +00:00
Florin Malita
dd22cf96d3 Revert "[skottie] Cache attached assets"
This reverts commit ba3ed69a4e.

Reason for revert:

Looks like asset references can manipulate the timeline (preComps),
so we do need distinct instances for each ref.

May revisit in the future for cases where all instances share the same timeline.

Original change's description:
> [skottie] Cache attached assets
> 
> This avoids redundant instantiations for assets referenced multiple
> times.
> 
> TBR=
> 
> Change-Id: I8f61f73e695f0d567e55ef077c7d3fb344399f12
> Reviewed-on: https://skia-review.googlesource.com/101002
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org

Change-Id: I3e537ace9dfbf69a11f421992db033a0f8ad2aa9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/101220
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 15:42:10 +00:00
Florin Malita
5effc281c7 [skottie] Reduce parser verbosity
TBR=

Change-Id: I9a949cfb9e7625b93988d9fc251c8696ae99007a
Reviewed-on: https://skia-review.googlesource.com/101080
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 15:00:49 +00:00
Florin Malita
ba3ed69a4e [skottie] Cache attached assets
This avoids redundant instantiations for assets referenced multiple
times.

TBR=

Change-Id: I8f61f73e695f0d567e55ef077c7d3fb344399f12
Reviewed-on: https://skia-review.googlesource.com/101002
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-29 04:59:58 +00:00
Florin Malita
4a49068faf [skottie] Simplify layer matrix caching
Switch to SkTHashMap, unify the cache based on layer index.

TBR=

Change-Id: I7e7622571156d67b4fe5ef91ee9a9a49b089c78f
Reviewed-on: https://skia-review.googlesource.com/101001
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-28 19:47:18 +00:00
Florin Malita
75f4c40588 [skottie] Switch animators to SkTArray
TBR=

Change-Id: I8acc02f176e7dffd344456ad4cc39936e9a9618f
Reviewed-on: https://skia-review.googlesource.com/101000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-28 17:56:28 +00:00
Florin Malita
1eb98dba2f [skottie] Add 'rz' rotation support
TBR=

Change-Id: I6dd82e5dc516faac091e5173688d2bc977e4fcaa
Reviewed-on: https://skia-review.googlesource.com/100280
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-26 20:34:00 +00:00
Florin Malita
fc807c885b [skottie] Refactor animators
Separate storage for values, cubic maps, repeated values deduplication.

TBR=

Change-Id: Ibfbcea91ef1d7b1da937b4af44079e7612d410cb
Reviewed-on: https://skia-review.googlesource.com/99981
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-26 13:13:24 +00:00
Florin Malita
cf8ed52895 [skottie] Parser cleanup
Consolidate parsing utils into their own CU.

TBR=

Change-Id: Idbf6db5220135ba91df6ebefce3a241c6ec4af15
Reviewed-on: https://skia-review.googlesource.com/99721
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-25 21:23:18 +00:00
Florin Malita
a55a591e5a [skottie] Cache the last keyframe
We can avoid searching on every tick.

TBR=

Change-Id: Ifc3ff40f1f5ec2bf865c09a8e784223aa8a96674
Reviewed-on: https://skia-review.googlesource.com/99580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-25 00:37:11 +00:00
Florin Malita
2518a0a328 [skottie] Animator scrubbing
Use std::function and lambda closures to capture node type info.

Reduces the template degree.

TBR=

Change-Id: Id81ff3e2e1fca5c8acaaf2d0fc67e608d6f3d606
Reviewed-on: https://skia-review.googlesource.com/99261
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 23:53:51 +00:00
Florin Malita
2d5fb12526 [skottie] Clamp keyframe values
We can skip interpolation if |t| is out of range or the interval is
constant ("hold").

TBR=
Change-Id: I0602d36557f46592ab673201ed2b4a96d40dc461
Reviewed-on: https://skia-review.googlesource.com/99420
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 19:52:49 +00:00
Florin Malita
7b3415cb10 [skottie] "hold" keyframe support
TBR=

Change-Id: I5388bc5a5d24b3bbe3962b2da646719e95efe858
Reviewed-on: https://skia-review.googlesource.com/99281
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-24 16:37:20 +00:00
Florin Malita
25366fad43 [skottie] Initial mask support
TBR=

Change-Id: Ibf4baeb17f98e1ed359f04deefe2f1c09414540d
Reviewed-on: https://skia-review.googlesource.com/98840
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 18:59:20 +00:00
Florin Malita
ca4439f6fd [skottie] Discard orphaned geometry animators
TBR=
NOTRY=true
Change-Id: I8e4de99c8ebc3ec28509753b59a287d896e65aea
Reviewed-on: https://skia-review.googlesource.com/98705
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-01-23 16:22:38 +00:00
Florin Malita
ad335bbfaf [skottie] Improved animation params parsing
Some BM versions wrap the Bezier animation params into arrays.

TBR=
Change-Id: I376b1ed2079105066413b513c3df33a61440cf41
Reviewed-on: https://skia-review.googlesource.com/98580
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-23 04:46:45 +00:00
Florin Malita
055b0f5cb0 [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>
2018-01-23 04:42:45 +00:00
Florin Malita
35efaa8fd7 [sksg] Animator, Scene
Relocate some reusable logic from Skottie

TBR=
Change-Id: I8764e666c9f1127ed895ee1d16cd66d052469ac5
Reviewed-on: https://skia-review.googlesource.com/98160
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-22 18:31:17 +00:00
Florin Malita
3ba3fa72ae [sksg] Refactor inval registration
... to avoid having too many Node friends.

TBR=
Change-Id: I8f8ff570d94ea48017935066a3d51cd8265ec120
Reviewed-on: https://skia-review.googlesource.com/97980
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-22 15:50:49 +00:00
Florin Malita
07853659fa [sksg] Improved trim-path emulation
Skip zero-length trims, simplify dashing.

TBR=
Change-Id: I0b30d78a1eeb93131ba0bd915431ab21d05cc00a
Reviewed-on: https://skia-review.googlesource.com/97663
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 17:28:11 +00:00
Florin Malita
ee6de4b5fa [skottie] Only apply effects to non-empty geometry stacks
TBR=
Change-Id: Iaafd63c787b72cdf83b21bd39cc10d01612e435d
Reviewed-on: https://skia-review.googlesource.com/97662
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 16:46:51 +00:00
Florin Malita
739641580f [sksg] Skip zero-width strokes
Zero-width strokes imply hairline in Skia, but in other models (e.g.
Lottie) they are simply ignored.  The latter approach avoids
discontinuities when width -> 0, so let's make it the default for sksg.

TBR=
Change-Id: I957a873c0e6468e21372115ed18cc7316fd2e7d1
Reviewed-on: https://skia-review.googlesource.com/97661
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-21 16:13:11 +00:00
Florin Malita
16d0ad06b4 [skottie,sksg] Improved shape group semantics
* paints also apply to preceding nested geometries
  * path effects also apply to preceding nested geometries

TBR=
Change-Id: Ic72f8d032fb5823f506ff688630b786a23219f20
Reviewed-on: https://skia-review.googlesource.com/97222
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-19 20:44:56 +00:00
Mike Reed
8008df1080 handle large rects, rename helper
To fix gm/bigrect, needed to do adjust "largest" rect so it doesn't become empty when round-tripping with SkRect/SkIRect.
I renamed it after this.

Bug: skia:
Change-Id: I747782c8456da603cf298275d2300ea1996e7629
Reviewed-on: https://skia-review.googlesource.com/95563
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
2018-01-17 17:38:57 +00:00
Florin Malita
54f65c473f Skotty -> Skottie
Change-Id: If8b6516024c69b0fc256208874f6666a4e70e12c
Reviewed-on: https://skia-review.googlesource.com/95241
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-17 14:15:36 +00:00
Florin Malita
1586d85198 [skotty] Refactor paint opacity
Promote to a PaintNode attribute, drop color composite.

TBR=
Change-Id: Ia79d5f7e193a472d53ac4ff8beb7234d4dc26cef
Reviewed-on: https://skia-review.googlesource.com/94280
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-12 19:48:03 +00:00
Florin Malita
6aaee59c04 [skotty,sksg] Initial gradient support
TBR=
Change-Id: I61e4d46ac14660f4c9ea757be2278e4098131a6b
Reviewed-on: https://skia-review.googlesource.com/94121
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-12 19:20:55 +00:00
Florin Malita
5f9102f291 [skotty,sksg] Initial matte layer support
TBR=
Change-Id: I5b689f5d7b0d147fa200cf5bffe476077085cb19
Reviewed-on: https://skia-review.googlesource.com/93300
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-11 19:32:45 +00:00
Florin Malita
0401e7ed8e [skotty] Adjust Draw node bounds for paint
TBR=

Change-Id: I88b3fe9c0ed4be2244b82d78995d6e27fa022296
Reviewed-on: https://skia-review.googlesource.com/93301
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-11 19:22:35 +00:00
Florin Malita
0e66fbab10 [skotty] Initial solid layer support
TBR=
Change-Id: Ib78ff693a1c79873248563502635aed93a90f963
Reviewed-on: https://skia-review.googlesource.com/92624
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-01-09 23:08:18 +00:00
Florin Malita
dcbb2db6d9 [skotty] Color opacity support
TBR=
Change-Id: I21dd6dda211d17c5de1b815fd43eac713a8e8ccc
Reviewed-on: https://skia-review.googlesource.com/92840
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 19:11:27 +00:00
Florin Malita
db38573ca0 [skotty] Pre-initialize animated props
Force an initial tick on animation initialization.

This prevents inconsistent state flashing if the client starts rendering
before the first tick.

TBR=
Change-Id: Iaec3146b4085c980e6501d6a65dd8f2421a2895f
Reviewed-on: https://skia-review.googlesource.com/92740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 18:02:17 +00:00
Florin Malita
f959092453 [skotty] Animator scrubbing
Less boilerplate, less template bloat.

TBR=
Change-Id: Ie0ef4808f4bcd8af9b6cdf89732d214311bc6101
Reviewed-on: https://skia-review.googlesource.com/92701
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 17:31:27 +00:00
Florin Malita
a6dd752efa [skotty] Pass animation frame/time as float
No reason to punt through SkMSec, we just lose precision.

TBR=
Change-Id: I2f61e49658701a3b5a675f3dd44543fd9aa98708
Reviewed-on: https://skia-review.googlesource.com/92600
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 14:07:22 +00:00
Florin Malita
71cba8f311 [skotty] Layer in/out support
TBR=
Change-Id: I79a9f5f15c051fc2d08bc2d6788ff059ec2d36f0
Reviewed-on: https://skia-review.googlesource.com/92460
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 13:29:12 +00:00
Florin Malita
9e1c58cb6a [skotty] Animator cleanup pass
TBR=
Change-Id: I2849c1438a8b245f04a01977919b653f0a16492b
Reviewed-on: https://skia-review.googlesource.com/92380
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-09 00:42:41 +00:00
Florin Malita
c0034179a1 [skotty] Initial opacity support
TBR=

Change-Id: I62581d3a7a83af5ccf373f0f4edf66a2d7f06f07
Reviewed-on: https://skia-review.googlesource.com/92223
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 22:36:01 +00:00
Florin Malita
c59b03071f [skotty] Tag animating paths as volatile
Change-Id: Ib90634ef682dba49b99594b008a0615d04c61a49
Reviewed-on: https://skia-review.googlesource.com/92140
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-01-08 22:06:41 +00:00