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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-- 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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
What is left of the SkView system is used only by samples or viewer.
As a result, move it out of the Skia source tree and re-organize so it
is a bit easier to understand and use more shared code.
Move samplecode/ClockFaceView.cpp to samplecode/SampleTextEffects.cpp,
sice that's what's actually in it.
Move SkAnimTimer.h to tools/timer, since it's actually shared between gm
and samples.
Change-Id: I55dafd94c64e4f930ddbd19168e0f812af86c455
Reviewed-on: https://skia-review.googlesource.com/146161
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Move SkTextBlobBuilder::allocRunText* to private: for the time
being, to reduce the documented interface footprint.
No code is deleted; the functions may be restored when a
client is ready to call them.
Also, add SkTextBlob::MakeFromString to complement
SkTextBlob::MakeFromText.
R=halcanary@google.com,fmalita@google.com
TBR=reed@google.com
Bug: skia:6818
Change-Id: If09d4da4ce38b680d73f25d187e3d06eeb0ec652
Reviewed-on: https://skia-review.googlesource.com/146521
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Cary Clark <caryclark@skia.org>