Commit Graph

28 Commits

Author SHA1 Message Date
Kevin Lubick
95d599c0a0 [canvaskit] Introduce self-documenting pointer types
Change-Id: I72dfe6098dae699d85cf87b6432e27cf845c832d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412659
Reviewed-by: Mike Reed <reed@google.com>
2021-05-27 12:30:54 +00:00
Florin Malita
baab5aff09 [skottie/wasm] Plumb text properties in WASM bindings
Only text string + size for now, we can surface more if needed.

Change-Id: I4b40c1bb5e27ea5fc4ed20a1214c4eeb04bf1ca8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382279
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-03-10 18:34:04 +00:00
Florin Malita
4f14135f5e [skottie/ck] Expose logs in JS API
Plumb a JS logger object, and forward errors/warnings to its methods:

  onError(err_str, json_node_str)
  onWarning(wrn_str, json_node_str)

Change-Id: I796aeb313c4a693accafe04edf80178b227ab118
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370937
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-02-17 17:57:16 +00:00
Jorge Betancourt
1352d0e47d [canvaskit] perform audio asset lookup by layer id
Change-Id: Iac56d11a76be8d90df1159631a02f1713ece1bd8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368938
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-02-11 17:11:00 +00:00
Jorge Betancourt
0e604ca7b0 [canvaskit] add audio asset support to skottie-bindings
Change-Id: If4c36f0261a18ed068cd745a4c454c127d0e96bd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360916
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-02-10 17:19:12 +00:00
Kevin Lubick
ed96264ad7 [canvaskit] Replace Point value_array with Float32Array
Using value_array (and value_object), while convenient,
adds a measurable overhead. This removes the Point value_object
and replaces it as a return value with Float32Array
(similar to rects). For inputs of a single point, I just
split it into x and y. For inputs with two points, I used
a _scratchFourFloats (formerly _scratchRect) bit of memory.

Two subtle decisions here:
 - Why not use scratch memory for a single point? The cost of
   having one extra param is a small/negligible price to pay
   for less complex code.
 - Why not accept Malloc objects? Again, simplicity. Accommodating
   Malloc would make the code harder to read and require more
   checks. I don't know if anyone wants to have malloced points;
   if they do, we can probably accommodate that.

Change-Id: I1b1c29f62e01c2f1c8c1218f58e3bad642214322
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362097
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-02 15:22:07 +00:00
Kevin Lubick
f8823b5726 Reland "[canvaskit] Change SkRects to be arrays, not objects."
This is a reland of bdc214a50e

The CPU version of SkottieWasm is timing out for reasons unknown,
but the GPU version is happy. I think we can get rid of the CPU
version of the job since it has been more or less superseded by
the SkottieFrames one (and the latter is more stable).

Original change's description:
> [canvaskit] Change SkRects to be arrays, not objects.
>
> This changes several APIs, so there are lots of breaking
> notes in the Changelog.
>
> This made the "draw 100 colored regions" benchmark about
> 20% faster (1ms -> .8ms).
>
> In theory, rendering should stay the same.
>
> Change-Id: Ib80b15e2d980ad5d568fff4460d2b529766c1b36
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312491
> Reviewed-by: Nathaniel Nifong <nifong@google.com>

Change-Id: I674aba85ecfb30b72e94cbaf89b2d97bfae3b7a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315142
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-09-03 14:31:38 +00:00
Michael Ludwig
1f49ceb404 Revert "[canvaskit] Change SkRects to be arrays, not objects."
Revert submission 314622

Reason for revert: breaking wasm bots
Reverted Changes:
Ia1ba13814:[canvaskit] Replace RRect objects with TypedArrays...
Ib80b15e2d:[canvaskit] Change SkRects to be arrays, not objec...
I790b2d6fc:[canvaskit] Add drawRect4f as example 'fast path' ...

Change-Id: Ie6e4c57ba412ca9ff8e4446b06681b51029da2d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/314893
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-09-02 21:21:36 +00:00
Kevin Lubick
bdc214a50e [canvaskit] Change SkRects to be arrays, not objects.
This changes several APIs, so there are lots of breaking
notes in the Changelog.

This made the "draw 100 colored regions" benchmark about
20% faster (1ms -> .8ms).

In theory, rendering should stay the same.

Change-Id: Ib80b15e2d980ad5d568fff4460d2b529766c1b36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312491
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-09-02 20:10:30 +00:00
Florin Malita
3f45e4b322 [skottie] Custom prop manager updates
Currently we use a hard-coded name prefix ('$') and the properties are
"namespaced" (the tree hierarchy is part of the key name).

This doesn't work well for most clients looking to test property
manipulation, as they would rather handle similarly named props in
bulk.

E.g. instead of

  precomp1.layer1.Group1.COLOR_01
  precomp1.layer1.Group1.COLOR_02
  precomp1.layer2.Group1.COLOR_01
  precomp1.layer2.Group2.COLOR_02

the UI should simply present

  COLOR_01
  COLOR_02

To support this, introduce a new operation mode for
CustomPropertyManager (kCollapseProperties), and keep the old behavior
around as kNamespacedProperties.

Also drop filtering for markers as anyone interested in markers would
want to see all of them.

Plumb these options all the way into CK (to be added to the player
later).

Change-Id: I57ec78c669f3870939d48fbfc492b97f63ea600d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/312301
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-08-20 19:59:22 +00:00
Florin Malita
2871ab0727 [skottie-wasm] Add support for nested animation playback
Plumb the newly added [1] ExternalAnimationPrecompInterceptor.

[1] https://skia-review.googlesource.com/c/skia/+/288130

Change-Id: I8e000692fdae8dd006405db98b6814e047f77276
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288356
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-05-07 12:31:57 +00:00
Nathaniel Nifong
1bedbeb081 Pass 4f colors to private functions with float pointers
Change-Id: I4534a246c37870750298d39edcbc869781dc1008
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/286880
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-05 13:17:28 +00:00
Nathaniel Nifong
e5d3254ece Reland "Switch to using a Float32Array (bound as value array) for color."
This is a reland of 4e79b6730d

Original change's description:
> Switch to using a Float32Array (bound as value array) for color.
> 
> Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

Change-Id: If6b9097b2fcd6b9dbf75c6dd22138e0b2531e70d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278780
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-26 14:41:29 +00:00
Robert Phillips
cb77eab343 Revert "Switch to using a Float32Array (bound as value array) for color."
This reverts commit 4e79b6730d.

Reason for revert: Bad canvaskit GM images

Original change's description:
> Switch to using a Float32Array (bound as value array) for color.
> 
> Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

TBR=kjlubick@google.com,nifong@google.com

Change-Id: I2f5e995ccee415a49f813b5ba61c095acbc445b5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278766
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-24 14:20:04 +00:00
Nathaniel Nifong
4e79b6730d Switch to using a Float32Array (bound as value array) for color.
Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-24 13:32:55 +00:00
Mike Klein
f46d5ca492 use std::make_unique
Change-Id: I7c672ff6b8eb95ec8c1123a5bfdb202e1644f494
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259281
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-12-12 22:32:45 +00:00
Brian Osman
d12f2786e2 Use ResourceProvider in particles
Currently just for image drawable, but going to use this for
references to other kinds of data in bindings, too.

Change-Id: Ic6673530013337bbaadd2d3f1c040626ec24ffb8
Bug: skia:9513
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256776
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-27 16:45:23 +00:00
Brian Osman
849f4d6571 Copy SkottieUtils' classes into skresources
For now, we'll have two copies. Once clients are using the skresources
versions exclusively, we can remove the originals from skottie.

Change-Id: I3152f526b0505b8374bdd9b4513a80bddc702ccc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256416
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-26 14:25:44 +00:00
Florin Malita
74f2fb558f [skottie-wasm] Disable image pre-decoding
After [1], we can rely the image decode cache to amortize large image
decoding.

[1] https://skia-review.googlesource.com/c/buildbot/+/256364

TBR=
Change-Id: I01d7e923aed927ecbf8c0584bac4e62901628523
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256456
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-26 02:09:46 +00:00
Florin Malita
587f7365d5 [skottie] Expose native frame rate and seekFrame() in WASM
Change-Id: I003ed90170abf287451a5df51a9aa54285236e63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249891
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-22 14:13:37 +00:00
Florin Malita
cfbc4d496d [skottie] Add DataURI image support in utils/tools
BodyMovin can export inline (dataURI) images.

Change-Id: I821a2e225359f8ac37d4d2c9479d4ff5d78f924e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249516
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-21 18:02:39 +00:00
Florin Malita
16e8b6efe8 [canvaskit] Return damage rect from ManagedAnimation::seek()
This is useful to avoid redrawing unnecessarily when the animation
doesn't progress.

Bug: skia:9267
Change-Id: Id4184ae8308b8abd959fbfd1768e3e22d1efe0a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229006
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-22 18:29:05 +00:00
Florin Malita
00d4f535c9 [skottie] Expose SG inval controller on seek()
- shift the revalidation phase from Scene::render() to Scene::animate()
 - pass an optional inval controller to Scene::animate() and Animation::seek()
 - hoist the showInval logic out of SkSG, into clients

This allows clients to track dirty regions and detect cases where no updates are needed.

Bug: skia:9267
Change-Id: I3d35bf58b6eee9bfeb6e127ba58e2b96713b772d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229001
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-07-22 16:33:15 +00:00
Florin Malita
eb24735ec5 [skottie] Pass asset IDs to ResourceProvider::loadImageAsset
Also use explicit IDs as keys for the image asset cache.

Change-Id: I359ff026063318ace524d1205b4f0b3e7a6e1d5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227783
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Isabel Ren <isabelren@google.com>
2019-07-17 01:08:05 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Florin Malita
774aeba9d0 [skottie] Add support for pre-decoding images at load time
Some animations use humongous images which thrash Skia's resource caches
at raster time.

To avoid that, we can

1) force decoding upfront, when the animation is loaded

2) clamp the image size to something reasonable (2K^2)

Add a flag to support this operation mode, and enable for Skottie/WASM.

Change-Id: Id2f127a5200b812b87e588904393d82c80452aa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206179
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-04-05 16:30:22 +00:00
Kevin Lubick
ee91c07a76 [canvaskit] adding drawAtlas to canvas API
Also re-works colors in the JS part to be unsigned,
so there's less chance for oopsies when passing them
to the C++ side.

Change-Id: I3f56d22e873e1407c402606444c50b76dd34ffd4
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204543
Reviewed-by: Mike Reed <reed@google.com>
2019-04-04 13:03:35 +00:00
Kevin Lubick
3f67f411d8 [canvaskit] Move from experimental to modules
Bug: skia:
Change-Id: I2ffd54cf81c974f3a80103e1726a06067cc90d82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200044
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-11 21:09:52 +00:00