Commit Graph

125 Commits

Author SHA1 Message Date
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
bee88d433d [sksg] Fix inval tracking in Group::removeChild()
TBR=
Change-Id: If3536f8be9d379402cde18c0482108fcf5ae01bb
Reviewed-on: https://skia-review.googlesource.com/158822
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-10-02 17:27:34 +00:00
Kevin Lubick
cbcff385c1 Have pathkit use libpathkit.a for faster builds
Of note, it is very important for the -DSK_RELEASE/-DSK_DEBUG
to match between libskia.a and the WASM bindings, otherwise
things like SKDEBUGCODE are sometimes compiled in and sometimes
not, which can cause headaches like sizeof() mismatching between
.cpp files and .h files.

Bug: skia:
Change-Id: Id6ef58c44a7c10014a243b36708e0891514f6008
Reviewed-on: https://skia-review.googlesource.com/158341
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-02 13:27:29 +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
Kevin Lubick
217056c048 [CanvasKit] Implement some basic Canvas/Surface things.
drawText is having issues in a release build.  Skottie sometimes
asserts in debug mode. This possibly has something to do with
memory alignment - like https://skia-review.googlesource.com/c/skia/+/155980
helped fix.

Patchset 9 shows off integrating Skia drawing to
an HTML canvas using Ganesh.

To see it locally, set up https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
and then set $EMSDK to be that directory.  Then run

   make clean
   make local-example

and navigate to http://localhost:8000/skia-wasm/example.html

Patchset 20 shows off Skottie animating directly to a Canvas.

Docs-Preview: https://skia.org/?cl=153882
Bug: skia:
Change-Id: I2ad2f4ffac00925ee901982ccbaeb7aa63b1ea23
Reviewed-on: https://skia-review.googlesource.com/153882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-09-21 12:03:55 +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
Mike Klein
0191ed8e87 Make listener lists threadsafe with a mutex.
PS1 reverts commit 6c8d242b14.
PS2 uses an SkMutex for thread safety.

Change-Id: I9318f92cc028844b3dc5a99a00282c2762057895
Reviewed-on: https://skia-review.googlesource.com/155060
Reviewed-by: Mike Klein <mtklein@google.com>
2018-09-18 15:46:26 +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
16322637c4 [sksg] Trim down sksg::Matrix size
Matrix nodes are most often not composed outside of the DAG.  Split into
a basic Matrix class and a (private) ComposedMatrix subclass.

TBR=
Bug: skia:8340
Change-Id: I3c182e10ae5fa20d0639c1031523dba3956b75bb
Reviewed-on: https://skia-review.googlesource.com/153883
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-12 15:28:18 +00:00
Florin Malita
97df5dcb37 [sksg] Stop caching full SkPaints in Paint nodes
Create on the fly, when needed.

TBR=
Bug: skia:8340
Change-Id: I4c319821a6d6e84e0ec37e8858c4a89ba1668626
Reviewed-on: https://skia-review.googlesource.com/153141
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-09-11 21:14:25 +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
Kevin Lubick
774be5aa96 [PathKit] Add cubicYFromX
Docs-Preview: https://skia.org/?cl=152385
Bug: skia:8216
Change-Id: I0020e8d2d4e6e7c7de5c71ddf923a618659cde2c
Reviewed-on: https://skia-review.googlesource.com/152385
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-09-07 18:01:40 +00:00
Ben Wagner
a900ad5400 Make fallback font iterator in shaper cache fallback.
Most of the time when doing fallback there is a simple ping pong between
the requested font and a given fallback font. Use the fallback entry as
a cache of one. This greatly speeds up the example layout.

In the future more work will be done on caching.

Change-Id: I3efe819d6d08d096715cf505cc8d894a282a745b
Reviewed-on: https://skia-review.googlesource.com/151100
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2018-09-04 18:00:56 +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
be5091c1fb [PathKit] Remove experimental- from package names
On the demo page, we use the skia-cdn bucket to hopefully
have better performance than unpkg.

Additionally, on the demo page, we default to using the
WASM version if supported by the browser.

Docs-Preview: https://skia.org/?cl=150904
Bug: skia:8216
Change-Id: I901016e95b8d66803053680691aac4d314821d18
Reviewed-on: https://skia-review.googlesource.com/150904
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-08-31 15:11:04 +00:00
Kevin Lubick
c7d057103e [PathKit] Move from experimental to modules
Add in Code of Conduct and Contributing.md as well.

Docs-Preview: https://skia.org/?cl=150901
Bug: skia:8216
Change-Id: Ia881124f653617ad0b7b91f40ba21de2c13220a6
Reviewed-on: https://skia-review.googlesource.com/150901
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-08-31 14:18:16 +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
Florin Malita
12e3df13cf [skottie] Harden interpolation checks for shapes
The "closed" shape property cannot be interpolated -- so ensure we catch
different values in interpolation pre-checks.

Bug: skiai:8264
Change-Id: If2c7e09c1227b0013acba3833c314e0646715d52
Reviewed-on: https://skia-review.googlesource.com/147967
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-20 13:51:28 +00:00
Florin Malita
f9c5063fc4 [skottie] Initial text layer plumbing
Still loads to do. For now just draws trivial text nodes using a default fontmgr.

Change-Id: I7343b648726d2c4f376f43437f6ae1377ad8ba86
Reviewed-on: https://skia-review.googlesource.com/147465
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-17 16:59:54 +00:00
Florin Malita
77af386c13 [sksg] Explicit text alignment
Work around for https://bugs.chromium.org/p/skia/issues/detail?id=8252

Change-Id: Icae3f69f07a2c95302cfbb3833185517f43d326e
Reviewed-on: https://skia-review.googlesource.com/147218
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2018-08-15 21:54:05 +00:00
Florin Malita
d19fed1e29 [skottie] Eliminate some temp SkString allocations
Use the SkJSON conversion idiom instead of ParseDefault<SkString>.

Change-Id: Ieeadb86891602eaef2ecf5b68a4eb17b4897e8f7
Reviewed-on: https://skia-review.googlesource.com/147103
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-08-14 17:25:20 +00:00
Florin Malita
679d05c48a [sksg] Simplify ScopedRenderContext
ScopedRenderContext tries really hard to avoid unnecessary RenderContext
initializations.

This is most likely unneeded because

  a) the structure is quite lightweight

and

  b) all ScopedRenderContext instantiation sites imediately call setters
     which require a writable context (assuming no-op args are uncommon)

Let's get rid of that over-engineered gunk.

Bug: skia:
Change-Id: Ieedc20c63c66b4d43744359e881c20639654040c
Reviewed-on: https://skia-review.googlesource.com/146761
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-10 17:54:29 +00:00
Florin Malita
73154babe5 [skottie] Avoid UB while parsing 1-based indices
Current impl can underflow int due to unchecked arithmetic.

Add a Parse<size_t> specialization and convert call sites which use
inline arithmetic.  Underflowing unsigned types should be well defined
and caught in later tests.

Bug: oss-fuzz:9798
Change-Id: Iaebe8aad4009e2511fe1d8733d336f5f119bb384
Reviewed-on: https://skia-review.googlesource.com/146648
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-09 22:05:32 +00:00
Florin Malita
e1c9d3c9e2 [skottie] Optimize color filter layerization
Use the deferred paint override mechanism, similar to opacity.

Change-Id: I78fa7f5d73ef333480ec72b0cb663819b1de2404
Reviewed-on: https://skia-review.googlesource.com/146527
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-09 21:03:12 +00:00