The most interesting part is using variadic calls to push all verb data
in one native -> JS go. This speeds up SkPathToVerbsArgsArray and
SkPathToCmdArray by 30-35%.
Other misc changes:
* use SkPath::RawIter instead of Iter
* add a VisitPath helper to cut down on boiler plate
* use uintptr_t for pointer arguments (just in case we get to wasm64
some day)
Change-Id: Ia0240f0e00e81db78eb1e9b48b31abbb3e33bfaf
Reviewed-on: https://skia-review.googlesource.com/140984
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
See shell.html::entrypoint() for the JS side of things.
See wasm_main.cpp for the C++ side of things
(EMSCRIPTEN_BINDINGS at the bottom is what glues the two parts
together - in general the strings are for JS and the not strings
are the C++)
To build this yourself, follow the getting started instructions:
https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
and download this patch. Then, update compile.sh to point at your
sdk and run it (e.g. $SKIA_ROOT/experimental/wasm/compile.sh)
Then navigate a browser (e.g. Chrome) to
http://localhost:8000/out/wasm/pathkit.html
So far, can compile with compile.sh, but not really with
GN/ninja (the compilation into many object files and a link
at the end seems to mess emscripten up)
Bug: skia:
Change-Id: If6b300e2b102469e17841265c7866f1a81094d70
Reviewed-on: https://skia-review.googlesource.com/137422
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit 2a2f675926.
Reason for revert: this appears to be what is holding up the Chrome roll.
Original change's description:
> SkTypes: extract SkTo
>
> Change-Id: I8de790d5013db2105ad885fa2683303d7c250b09
> Reviewed-on: https://skia-review.googlesource.com/133620
> Reviewed-by: Mike Klein <mtklein@google.com>
TBR=mtklein@google.com,halcanary@google.com
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Change-Id: Iafd738aedfb679a23c061a51afe4b98a8d4cdfae
Reviewed-on: https://skia-review.googlesource.com/134504
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
* relocate all SkSG-related files under modules/sksg/
* fix various tidbits to make non-sksg builds possible
* drop obsolete SampleSGInval.cpp
Change-Id: I54e6c5bb1a09f45030fa8d607b3eb3f7cba78957
Reviewed-on: https://skia-review.googlesource.com/130025
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
- limit the maximum number of points
- round instead of trunc (more accurate when interpolating)
- reserve the path verb/pts space upfront
Bug: oss-fuzz:8223
Change-Id: Ib6fb83e56c05b16e292789be81f1a48a9c529211
Reviewed-on: https://skia-review.googlesource.com/128017
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This is safe because count == 0 will produce an empty path.
Bug: oss-fuzz:8213
Change-Id: Ie3b546c614ba22eef1ba16a182016c2edd0bd641
Reviewed-on: https://skia-review.googlesource.com/127323
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
BindProperty can already check for no-op static props, so let's use it.
TBR=
Change-Id: If1c327871702b57ad9e6db9a8b112c6775cb7f53
Reviewed-on: https://skia-review.googlesource.com/127140
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Rapidjson's array [] operator asserts the index is valid (instead of
returning a null value when out-of-range) -> we must check.
Bug: skia:7918
Change-Id: Ice4a6e6670a824da0d423da4a6f92414cd0dc252
Reviewed-on: https://skia-review.googlesource.com/126441
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
- pull latest RapidJSON under third_party/externals/rapidjson
(note: and older RS version is already pulled as part of angle2,
and it is also checked in G3)
- add a thin Json porting layer (SkottieJson) to isolate RS
idiosyncrasies
- convert Skottie to use the new helpers
- parse the DOM in-place (based on local experiments this is the
fastest method)
Ta-da: Skottie now parses JSON ~10x faster!
Change-Id: Ida9099638f88ed025fee83055c8cd8680ee27176
Reviewed-on: https://skia-review.googlesource.com/125744
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
For straight lines, Lottie exports control points conincident with the
vertices. We can detect this case and emit more efficient lineTo's.
One wrinkle: we can only apply this power-reduction post-interpolation
(otherwise the path verbs and point count would not be guaranteed to
match). Hence we store explicit shape data and defer the SkPath
conversion.
TBR=
Change-Id: I7818be464eabee6096d2078440843243a55c6e98
Reviewed-on: https://skia-review.googlesource.com/124800
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
When the mask stack contains exactly one opaque mask path, we can apply as
a clip.
TBR=
Change-Id: Iadff7534bfa4925557bfbddd59529113f4958d0d
Reviewed-on: https://skia-review.googlesource.com/124000
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Change-Id: Ib0042cf412fe3c5fa600b7ae644d16740457535e
Reviewed-on: https://skia-review.googlesource.com/121354
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Split into Adapter and Value CUs.
No real changes, just shuffling things around.
TBR=
Change-Id: I50eaeb3950f4c59e7d7027955b3f49ca2a346e59
Reviewed-on: https://skia-review.googlesource.com/116186
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Bug: skia:7688
Change-Id: I5b4f9b3aba7d696d09c1c2f0634c8c866e5ba99d
Reviewed-on: https://skia-review.googlesource.com/115077
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
Commit-Queue: Heather Miller <hcm@google.com>
Apply the effect at revalidation time, and cache the result.
TBR=
Change-Id: I166fc0e4e2869bea51e5e45e5a2a50df2f034691
Reviewed-on: https://skia-review.googlesource.com/112801
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
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>
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>
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>
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>
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>
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>