Commit Graph

99 Commits

Author SHA1 Message Date
Florin Malita
8ac81b7fb5 [skottie] Add a custom property manager util class
To facilitate demo code consolidation, introduce a custom property
manager which filters for node names starting with '$' and treats all
properties sharing the same name unitarily.

Update the Colorize GM to use this new helper.

Also revisit the PropertyObserver interface:

 * aliases for client-facing value types
 * introduce a new (decomposed) TransformPropertyValue, to replace component-wise setters
 * consolidate the PropertyHandle interface to only expose get()/set()

Bug: skia:
Change-Id: I9aa9ee80c1fb57bbfbacab0fc3f017da909b24d9
Reviewed-on: https://skia-review.googlesource.com/c/173220
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-11-28 17:12:07 +00:00
Florin Malita
a8316554cb [skottie] Make animated image support generally available
Consolidate some helpers under skottie_utils, and update all related
tools to support animated images.

TBR=
Change-Id: If08e97143a11d9a414f3230a49ab4284c508b9d0
Reviewed-on: https://skia-review.googlesource.com/c/169342
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-11-10 19:52:19 +00:00
Mike Reed
9edbf42e75 Revert[4] "hide nested hinting enum"
This reverts commit 8e12cc6dfe.

Bug: skia:
Change-Id: Ice5e3480adad75ab77d97f7366495015f36b15a6
Reviewed-on: https://skia-review.googlesource.com/c/169520
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-08 16:33:04 +00:00
Mike Klein
8e12cc6dfe Reland "Revert "hide nested hinting enum""
This reverts commit f49563bf92.

Reason for revert: Google3 also.

Original change's description:
> Revert "Revert "hide nested hinting enum""
> 
> This reverts commit 6bd19df9fa.
> 
> Restores original CL, but adds guards for flutter.
> 
> Bug: skia:
> Change-Id: I380b4ea87d293355026d734249aa2b8c397da144
> Reviewed-on: https://skia-review.googlesource.com/c/169345
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I26a07555df56ce92e86b114ecf4ab64643e71ed1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/169441
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-07 23:56:24 +00:00
Mike Reed
f49563bf92 Revert "Revert "hide nested hinting enum""
This reverts commit 6bd19df9fa.

Restores original CL, but adds guards for flutter.

Bug: skia:
Change-Id: I380b4ea87d293355026d734249aa2b8c397da144
Reviewed-on: https://skia-review.googlesource.com/c/169345
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-11-07 22:47:53 +00:00
Mike Reed
6bd19df9fa Revert "hide nested hinting enum"
This reverts commit fbebecee0e.

Reason for revert: need staging guard for flutter

Original change's description:
> hide nested hinting enum
> 
> Bug: skia:2664
> Bug: skia:8527
> Change-Id: I8f4b832d5524fb792bcc608d6bd515229881b048
> Reviewed-on: https://skia-review.googlesource.com/c/168270
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: I19496daa059932574f36ac47061068a81d5524c3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:2664, skia:8527
Reviewed-on: https://skia-review.googlesource.com/c/169344
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-07 22:06:01 +00:00
Mike Reed
fbebecee0e hide nested hinting enum
Bug: skia:2664
Bug: skia:8527
Change-Id: I8f4b832d5524fb792bcc608d6bd515229881b048
Reviewed-on: https://skia-review.googlesource.com/c/168270
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-11-07 21:42:28 +00:00
Florin Malita
5d3deb7301 [skottie] Preserve image aspect ratio
When the intrinsic image dimensions don't match the declared asset size,
use an aspect-preserving matrix for scaling.

Bug: skia:
TBR=
Change-Id: Ie361f464fdbc2c32cb898c9f97103521162b46a7
Reviewed-on: https://skia-review.googlesource.com/c/168274
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Florin Malita <fmalita@chromium.org>
2018-11-06 17:24:58 +00:00
Florin Malita
0a8b4e1acb [skottie] Add support for explicit text line breaks
To support wacky explicit AE line breaking:

  * add sksg::TextBlob (SG node backed by externally-built text blobs)
  * add skottie::TextAdapter logic to handle \r line breaks and construct
    the blob explicitly

Change-Id: I2eed9adf28a8c3c1f7de5bbec3d32abd7ddbd484
Reviewed-on: https://skia-review.googlesource.com/c/167384
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-11-04 15:19:46 +00:00
Mike Reed
3a42ec0ee7 hide the SkPaint::Align enum entirely
Bug: skia:2664
Change-Id: I080b015dbcb3a3cd73bb6847f3243a996d5f7b7d
Reviewed-on: https://skia-review.googlesource.com/c/166282
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-10-30 17:26:47 +00:00
Mike Klein
408ef21c79 Revert "replace SkNVRefCnt with SkRefCnt"
This reverts commit 0fb1ee98cf.

Reason for revert: looks like this increased size by ~8K.

Original change's description:
> replace SkNVRefCnt with SkRefCnt
> 
> SkNVRefCnt trades a small amount of code size (vtable) and runtime
> (vptr) memory usage for a larger amount of code size (templating).  It
> was written back in a time when all we were really thinking about was
> runtime memory usage, so I'm curious to see where performance, code
> size, and memory usage all move if it's removed.
> 
> Looking at the types I've changed here, my guess is that performance and
> memory usage will be basically unchanged, and that code size will drop a
> bit.  Nothing else it's nicer to have only one ref-counting base class.
> 
> Change-Id: I7d56a2b9e2b9fb000ff97792159ea1ff4f5e6f13
> Reviewed-on: https://skia-review.googlesource.com/c/166203
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,bsalomon@google.com,mtklein@chromium.org

Change-Id: Ibcfcc4b523c466a535bea5ffa30d0fe2574c5bd7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/166360
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-30 15:23:06 +00:00
Mike Klein
0fb1ee98cf replace SkNVRefCnt with SkRefCnt
SkNVRefCnt trades a small amount of code size (vtable) and runtime
(vptr) memory usage for a larger amount of code size (templating).  It
was written back in a time when all we were really thinking about was
runtime memory usage, so I'm curious to see where performance, code
size, and memory usage all move if it's removed.

Looking at the types I've changed here, my guess is that performance and
memory usage will be basically unchanged, and that code size will drop a
bit.  Nothing else it's nicer to have only one ref-counting base class.

Change-Id: I7d56a2b9e2b9fb000ff97792159ea1ff4f5e6f13
Reviewed-on: https://skia-review.googlesource.com/c/166203
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-30 13:26:12 +00:00
Mike Klein
6ddd4421ee only build non-prod skottie/sksg code in our tree
This this is enough to get Fuchsia going?

Change-Id: Id6577ee6b4e3c2cbae5ec8c42f3e004712ea477c
Reviewed-on: https://skia-review.googlesource.com/c/163442
Reviewed-by: Sanjay Chouksey <sanjayc@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-18 17:50:51 +00:00
Florin Malita
928db927f7 [skottie] Clang-tidy fixes
Mostly const-relax to allow moving.  Also add an r-val overload for
Node attribute setters.

Change-Id: I15e5eeee95b7c2a460844fec5a5d312d59b612ca
Reviewed-on: https://skia-review.googlesource.com/c/163168
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-17 21:38:26 +00:00
Florin Malita
21119ace66 [skottie] Add support for fill effect opacity
Also, it turns out layer effect properties are keyed by their
index in the property array, and not by "ty".  Update the
implementation to reflect this.


Change-Id: I72c6cf83f60ee1f8240222c7e2be2d567555a772
Reviewed-on: https://skia-review.googlesource.com/c/161840
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-10-12 17:38:28 +00:00
Florin Malita
4963a64bc1 [skottie] Fix image loading in Viewer
With the switch to ImageAsset, I forgot to update the default/local
resource loader.

TBR=
Change-Id: I1ab898a896162718df04094a31648bf8e876d91b
Reviewed-on: https://skia-review.googlesource.com/c/161546
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-10-11 20:47:32 +00:00
Florin Malita
d9c56b41d4 [skottie] Support external annotations
Add a callback mechanism for passing opaque/external annotation string
dictionaries to the embedder.

Change-Id: I2b053d6697cdd51a310ced687e2ba454ab39a24a
Reviewed-on: https://skia-review.googlesource.com/c/160900
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-10-09 20:22:08 +00:00
Florin Malita
2c06e14697 [skottie] Optional path control points
Make parsing the in/out Bezier control points optional (default [0,0]).

Change-Id: Id1ef43cea133fab3a112e653d4ce2ab21b91effb
Reviewed-on: https://skia-review.googlesource.com/c/159980
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-10-05 16:07:01 +00:00
Florin Malita
9059c23946 [skottie] Remove temporary ResourceProvider::load() fallback
All clients are now using loadImageAsset().

TBR=
Change-Id: I3d7800fc9a294b01aaa8e21a39703e01fa866a40
Reviewed-on: https://skia-review.googlesource.com/c/159946
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Florin Malita <fmalita@chromium.org>
2018-10-05 15:32:25 +00:00
Mike Klein
e749c2f30c looks like Animation can use SkNVRefCnt?
It's not otherwise virtual, so this'll make it a pointer smaller.
Just happened to notice this when debugging WASM bindings with Kevin.

Change-Id: I9fc051048a9c9cd65927be5a7bbf3fd19ea7df33
Reviewed-on: https://skia-review.googlesource.com/c/159301
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-10-03 21:07:29 +00:00
Florin Malita
62c6bd910a [skottie] Multi-frame image support
Extend the image asset provider API to support animated/multi-frame images.

Add a GM based on SkAnimCodecPlayer + animated public domain GIF
(source: https://giphy.com/explore/public-domain).

Bug: skia:
Change-Id: Iaa596e01a7626ca6574db1ebc90632f5a9a02bdc
Reviewed-on: https://skia-review.googlesource.com/159162
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-10-03 19:02:35 +00:00
Florin Malita
57b9d4071b [skottie] External logger support
Add a skottie::Logger interface, allowing clients to register for log events
from the animation builder.

Convert existing log messages to the new machinery.

Change-Id: If9083f89b27f197bfc0d8d81860bbacb6b764be3
Reviewed-on: https://skia-review.googlesource.com/c/158580
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-10-02 18:17:35 +00:00
Florin Malita
97b150e73b [skottie] External font loader tweaks
More general ResourceProvider font loading API:

1) font name argument
2) invoked unconditionally (regardless of whether an URL is present)

This provides more font control to the embedder.

Change-Id: I95557c75c2e0fe41ff68ee1b6cec8929405a74fc
Reviewed-on: https://skia-review.googlesource.com/157424
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-27 16:22:25 +00:00
Florin Malita
17282da3aa [skottie] Add a property setter sample/GM
skottie_colorize: press 'c' to cycle through stroke/fill colors.
Change-Id: I7fa9dcd67822df37e97cafabe088c4b9ded9c622
TBR=
Reviewed-on: https://skia-review.googlesource.com/156882
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-26 16:43:49 +00:00
Florin Malita
a85f3a138c Reland: [skottie] Initial property setters
Introduce a PropertyObserver to receive property notifications for layer
and shape nodes.

Properties are communicated using strongly-typed "handles", which act
as impedance adapters between the AE/BM model and the internal Skottie
model.

Reviewed-by: Mike Reed <reed@google.com>
Change-Id: Id155076faa8595f6b4d81672559f01c2e0c7455a
TBR=
Reviewed-on: https://skia-review.googlesource.com/156626
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-24 21:46:07 +00:00
Brian Salomon
39e1d13d35 Revert "[skottie] Initial property setters"
This reverts commit 7903957247.

Reason for revert: breaking SAN bots

Original change's description:
> [skottie] Initial property setters
> 
> Introduce a PropertyObserver to receive property notifications for layer
> and shape nodes.
> 
> Properties are communicated using strongly-typed "handles", which act
> as impedance adapters between the AE/BM model and the internal Skottie
> model.
> 
> Bug: skia:
> Change-Id: Ieb9be1ff843673f1f4fe900d3774c36956b7c941
> Reviewed-on: https://skia-review.googlesource.com/156186
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ic737766e305bb8dff10a817fa37f16fdfa051c93
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/156620
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-09-24 20:46:34 +00:00
Florin Malita
7903957247 [skottie] Initial property setters
Introduce a PropertyObserver to receive property notifications for layer
and shape nodes.

Properties are communicated using strongly-typed "handles", which act
as impedance adapters between the AE/BM model and the internal Skottie
model.

Bug: skia:
Change-Id: Ieb9be1ff843673f1f4fe900d3774c36956b7c941
Reviewed-on: https://skia-review.googlesource.com/156186
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-09-24 19:03:06 +00:00
Florin Malita
268707284d [skottie] GM exercising external font loading
Sets up a fake web font loader which serves a local/resource font to
the sample text animation.

Also rename resources/skotty/skotty_* -> resources/skottie/skottie_*.

Change-Id: I4af5b24fc3cc5c63c78801979f9be56744047134
Reviewed-on: https://skia-review.googlesource.com/155881
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-20 19:05:35 +00:00
Florin Malita
4054351369 [skottie] Add support for external font loading
Web fonts are quite common in Lottie text assets.  Expand the
ResourceProvider interface to allow loading of external (web) font data.

Fonts are passed back to Skottie as opaque SkData, and instantiated
using SkFontMgr::makeFromData().

Change-Id: Ia4c994bd60e6a3bd47c90172c267ed5f897a38e4
Reviewed-on: https://skia-review.googlesource.com/155601
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-09-20 02:01:28 +00:00
Florin Malita
beb8300d19 [skottie] Fix NaN |t| in CompTimeMapper::onTick
Catch infinite time scale values at construction time.

Bug: skia:8381
Change-Id: I538c5bd0a75b080856ec39b3e94e2a303bb9a289
Reviewed-on: https://skia-review.googlesource.com/155167
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-09-18 14:59:31 +00:00
Florin Malita
217d4a556b [skottie] UBSAN divide-by-zero workaround
Use sk_ieee_float_divide to silence UBSAN.

(note: the result is already checked to be finite)

Bug: skia:10041
Change-Id: I97d1d6f84926b7162ed636be7afd052ca42d8e81
Reviewed-on: https://skia-review.googlesource.com/155165
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-18 14:28:53 +00:00
Florin Malita
f2ade42f3c [skottie] Shrink SkPaths
TBR=
Bug: skia:8340
Change-Id: Iafd5f60c3802e999da4f3629975aa317ae722243
Reviewed-on: https://skia-review.googlesource.com/153561
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-11 20:59:20 +00:00
Florin Malita
a61f0f73dc [skottie] Add support for explicit image asset sizing
TBR=
Change-Id: Ie1c8a30ebc6a7c647265f05fe39b39b53758f016
Reviewed-on: https://skia-review.googlesource.com/153004
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-10 15:44:42 +00:00
Florin Malita
cd9d074578 [skottie] More efficient group sizing
Replace sksg::Group::shrink_to_fit() with a factory accepting an
externally-built children array.

This provides more control for clients (e.g. reserve() instead of
shrink_to_fit()).

Change-Id: Iad587435e0e9da15251a9d3bc2510ca945950b5d
Reviewed-on: https://skia-review.googlesource.com/152861
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-09-10 14:17:30 +00:00
Florin Malita
40c7c64572 [skottie] Skip group nodes for single-draw shapes
Pulling this off requires deferring the group creation until after we've
resolved all the draws.  Doable, but somewhat tricky due to the
interaction with the dangling/uncommitted animator logic.

TBR=
Bug: skia:8340
Change-Id: Id00c841152bd80330751db45f6b26462efc844a5
Reviewed-on: https://skia-review.googlesource.com/152860
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-09 00:30:27 +00:00
Florin Malita
ca858b68c3 [sksg] Switch containers from SkT(D)Array to std::vector
Skia's containers grow too aggressively, stick to STL containers for
reduced head overhead.

Also introduce Group::shrink_to_fit() to be used when clients know they
are done adding children to a group.

TBR=
Bug: skia:8340
Change-Id: I842db2e80c7cfb65a462e4859af6e63496863a5c
Reviewed-on: https://skia-review.googlesource.com/151161
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-02 18:04:29 +00:00
Florin Malita
be5e865433 [skottie] Lazily-initialized default font manager
Only initialize a default font manager when needed.

Change-Id: I3473804d426f1f4981f3727d3539303fb670cdd1
Reviewed-on: https://skia-review.googlesource.com/150840
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-31 18:07:47 +00:00
Florin Malita
ab706d85e0 [skottie] SkTArray begone
SkTArray is not a good choice for tigh allocations:

  - its minimum allocation count is 8
  - reserve(sz) doesn't adjust capacity to the exact value, but padds
    the same way as normal growth (max(sz, 8, 50%))
  - no shrink_to_fit() function to trim unneeded capacity

Since keyframed properties with a small number of frames are quite
common in Lottie, this adds significant heap overhead.

Switch to std::vector(), reserve() to the estimated frame count and
shrink_to_fit() when done parsing.

Bug: skia:8340

Change-Id: Id575e2da2fd17537948c2b38485a8accdb9f7a8b
Reviewed-on: https://skia-review.googlesource.com/150905
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-31 15:14:27 +00:00
Kevin Lubick
ef0fee0496 [Skottie] Fallback to portable font manager
The -Lottie bot runs with --nonativeFonts so, for some animations that
request a specific font (e.g. Helvetica), this would fail, but not
fallback to an actual font manager.

This makes sure we at least have some text, even if it's the "wrong"
font.

Bug: skia:8298
Change-Id: Ibce7fda5b0a82fc3a708ab1cf5a7a394484ca89e
Reviewed-on: https://skia-review.googlesource.com/150468
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-08-30 18:09:59 +00:00
Florin Malita
a225a6b631 [skottie] Fix precomp time remapping vs time start/stretch interaction
In the presence of time remapping, time start/stretch values appear to
be ignored.

TBR=
Change-Id: I6a4dcc107f2d0fc6361f91ba4f4643e33da37d93
Reviewed-on: https://skia-review.googlesource.com/149701
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-27 20:01:59 +00:00
Florin Malita
9402c7dc37 [skottie] Add support for keyframed text nodes
-- introduce a new animatable value (TextValue)

 -- introduce a new adapter (TextAdapter) to translate Lottie text props to SG text props

 -- use existing animated property-bind machinery and the new constructs when parsing text layers

Change-Id: Ibbfb69daf5b0a3c9a5ce8d1ccdeedca5b5d0fa6f
Reviewed-on: https://skia-review.googlesource.com/149266
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-27 14:37:47 +00:00
Florin Malita
420696961c [skottie] Relax constant keyframe parsing
Constant keyframes currently requiere an "h" property/marker.

In order to support keyframed text parsing, relax this to consider any
keyframe missing an end value as constant.

TBR=
Change-Id: Idf332dc0174ee0ee6773708518a0bbc284f8860f
Reviewed-on: https://skia-review.googlesource.com/149265
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-26 18:40:16 +00:00
Florin Malita
471a946cf1 [skottie] Make AnimationBuilder available for value parsing
Plumb AnimationBuilder throught a bazillion layers to make it reachable
when parsing animatable values.

This is in preparation of keyframed text, which will require access to
the font set when parsing.

Refactor only, no functional changes.

TBR=
Change-Id: Ide2ef2ba66fbcc75fdcc785f987b364d45dff5b6
Reviewed-on: https://skia-review.googlesource.com/149264
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-26 00:39:48 +00:00
Florin Malita
4dddad2bf8 [skottie] Guard against missing solid layer color property
Bug: skia:8281
Change-Id: I4a5d5e37d3b1bb0995c20ad138e8e234869ed760
Reviewed-on: https://skia-review.googlesource.com/148999
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-08-23 20:35:11 +00:00
Florin Malita
906cdf3fcd [skottie] Ref-counted ResourceProvider
Update the ResourceProvider interface to inherit from SkRefCnt, to
clarify sharing/ownership semantics in the Skottie Builder API.  Now it
follows the same pattern as SkFontMgr.

Change-Id: I7ff8ad39023d9ecfe609e0180b5aabf776672d48
Reviewed-on: https://skia-review.googlesource.com/148991
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-23 20:04:46 +00:00
Florin Malita
a1c422c1d1 [skottie] Improved text rendering
* enable antialiasing
 * enable subpixel positioning
 * disable hinting

Change-Id: I7e861d9141411f64a9277ff6c3345c107c0868b2
Reviewed-on: https://skia-review.googlesource.com/148980
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-08-23 16:41:17 +00:00
Florin Malita
40c37426b3 [skottie] Plumb external SkFontMgr
Allow embedders to pass a font manager.

In order to avoid excessive factory API clutter, introduce an
Animation::Builder helper to wrap factory options.

Also clean up various bits:

  * hoist scene parsing out of the Animation ctor
  * store the animation duration explicitly (instead of unused fps)
  * plumb const SkFontMgr& internally (instead of a ref)

Change-Id: I3e180dfa85ba18c8462cfeb5a7385bef985ed6c4
Reviewed-on: https://skia-review.googlesource.com/148800
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-23 13:13:30 +00:00
Florin Malita
1b1dead00d [skottie] Split-up Skottie.cpp
Introduce more granular compilation units for major Skottie layer types.

TBR=
Change-Id: Iee2ef05cbcdda06467674824eb295ae6d7dc5bb9
Reviewed-on: https://skia-review.googlesource.com/148394
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-21 19:06:15 +00:00
Florin Malita
fa0441b952 [skottie/cleanup] Refactor parser state handling
* introduce AnimationBuilder to hold mostly immutable (modulo caching)
    state
  * split the scoped animator state into AnimatorScope

This will facilitate splitting the monolithic Skottie.cpp in follow-up
CLs.

Refactoring only, no functional changes.

TBR=
Change-Id: I0a8295e60be4559586fc4a9fea3dee4a7f5714d4
Reviewed-on: https://skia-review.googlesource.com/148390
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-21 17:55:29 +00:00
Florin Malita
cc9c45d2e0 [skottie] Pre-flight animation in-point, out-point
Bug: skia:8264
Change-Id: Icde0e9d76f51e96f7e5246f1f87e5fa6f32d0a14
Reviewed-on: https://skia-review.googlesource.com/148020
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-08-20 14:20:16 +00:00