Need and 'in range' operator.
Change-Id: I57cd6631376a6e857054b4712a70b2aa75a53223
Reviewed-on: https://skia-review.googlesource.com/c/192823
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
It isn't used anymore.
Change-Id: I4079ff9944aa2483a0cd42130d0e69fb98935731
Reviewed-on: https://skia-review.googlesource.com/c/192820
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
This allows for SkTypefaces not backed by OpenType data to get minimal
shaping through HarfBuzz.
Change-Id: I0e4d69627500e0aff40c8989d3734597bfa1f8d6
Reviewed-on: https://skia-review.googlesource.com/c/192681
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Still some code hanging on from optimizing for SkTextBlob.
Bug: skia:8420
Change-Id: I947a9ff691fb1fbcb82934c5597e5db11c12f013
Reviewed-on: https://skia-review.googlesource.com/c/192683
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Effects now have a duration, and can be played looped
or one-shot. Added a second list of affectors that are
applied at spawn vs. update.
Effects grab and store the SkRandom at construction,
so it no longer needs to be passed to update().
Bug: skia:
Change-Id: Ib54d60466e162e4d4b70fa64c1215fc01680d47a
Reviewed-on: https://skia-review.googlesource.com/c/191722
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This supports arrays of any type, and removes all of the special case
code for arrays of SkReflected objects. (This is extracted from my
rewrite of SkCurve, which needed something like this to work).
Bug: skia:
Change-Id: I55ab942f7922335dca0685d28b3b122bc4d53daa
Reviewed-on: https://skia-review.googlesource.com/c/192620
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
New tests that use skshaper should hide behind SK_USING_SKSHAPER define.
Change-Id: Ifcd726d931e3eb1ff209085a63e8129c9cd5596d
Reviewed-on: https://skia-review.googlesource.com/c/192026
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
In the event that no fallback font can be found to handle a character,
just keep using the current font.
Change-Id: I93c852dc8ee5eaa868e48a5ce3e8298a642b15c7
Reviewed-on: https://skia-review.googlesource.com/c/191661
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
This adds a new "Particles" slide to viewer, that allows
editing, loading, and saving particle effects. All of the
particle system code is in modules/particles.
There are many rough edges and some not-yet-finished changes
to generalize the model[1]. A rough overview:
- SkReflected.h implements a lightweight reflection system
for classes derived from SkReflected. Adding a new class
involves deriving from SkReflected, adding a macro to the
class declaration, and implementing visitFields(), which
simply calls a virtual on an SkFieldVisitor for each field.
Currently, emitters and affectors use this mechanism.
- SkParticleSerialization.h demonstrates two useful field
visitors - for serializing to and from JSON. The driver
code that uses those is directly in ParticlesSlide.
- SkParticleData.h and SkCurve.h define a variety of helper
types for talking about particles, both for parameterizing
individual values, and communicating about the state of a
particle among the effect, affectors, and emitters.
- SkParticleEffect.h defines the static data definition of
an effect (SkParticleEffectParams), as well as a running
instance of an effect (SkParticleEffect). The effect has
simple update() and draw() methods.
- ParticlesSlide.cpp adds a third field visitor to generate
GUIs for interactively editing the running effect.
---
1: The critical change I'd like to make is to remove all
special case behavior over time and at spawn (setting sprite
frames, size over time, color over time, etc...). Integration
is the only fixed function behavior. Everything else is driven
by two lists of affectors. One is applied at spawn time, using
the effect's lifetime to evaluate curves. This allows spawning
particles with different colors as the effect ages out, for
example. The second list is applied every frame to update
existing particles, and is driven by the particle's lifetime.
This allows particles to change color after being spawned, for
example.
With a small set of affectors using a single expressive curve
primitive (keyframed list of cubic curve segments), we can
have affectors that update color, size, velocity, position,
sprite frame, etc., and implement many complex behaviors.
Bug: skia:
Change-Id: Id9402bef22825d55d021c5a2f9e5e41791aabaf4
Reviewed-on: https://skia-review.googlesource.com/c/181404
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
This essentially resurects the old SkTextBox code into a primitive
shaper.
Change-Id: Ia4d1a5ab3d1c7d410962b49ac3891298655c7dc4
Reviewed-on: https://skia-review.googlesource.com/c/191562
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
will flesh out more over time.
Bug: skia:
Change-Id: If5eaf0a7c404b9209b93871eb3ac3d74da8c65dd
Reviewed-on: https://skia-review.googlesource.com/c/191003
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Introduce RenderNode::nodeAt(const SkPoint&) as the entry point for the hit-testing API.
This is backed by a onNodeAt() virtual, which gets dispatched throughout the render DAG,
and normally stops at the first leaf Draw node in encounters.
To support the implementation, introduce a GeometryNode::contains(const SkPoint&) API.
This is backed by a onContains() virtual, overridden in each concrete geometry class.
Expose nodeAt() on sksg::Scene, and add some basic unit tests.
Change-Id: I0c8abd9d1e51ecf2d8b4dd699f325cd636e21084
Reviewed-on: https://skia-review.googlesource.com/c/191296
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Image filters cannot let descendent damage pass through, as they may
transform their inputs arbitrarily.
Introduce the notion of "damage override" SG nodes (nodes which block
descendent damage and replace it with their own), and update
ImageFilterEffect to opt in for this behavior.
Also make InvalidationController damage dispatch optional (such that we
don't accumulate inval rects unnecessarily).
TBR=
Change-Id: Ie9f7d32ecdcc77dbe6ea009aed9ce269b3649a04
Reviewed-on: https://skia-review.googlesource.com/c/191005
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit 1f43a4359d.
Reason for revert: Android build failures.
Original change's description:
> [skottie] Add drop shadow support
>
> Introduce the machinery required for general image filters in SkSG +
> a concrete drop shadow image filter effect.
>
> Wire it all up with Skottie to support drop-shadow layer effects.
>
> Change-Id: I98e9669852f58ba6481439a7fda4a56ec6c59b8a
> Reviewed-on: https://skia-review.googlesource.com/c/190426
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
TBR=fmalita@chromium.org,reed@google.com
Change-Id: I31d38ed4d4a15b77d1d1218b2677a891978332cb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/190981
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Introduce the machinery required for general image filters in SkSG +
a concrete drop shadow image filter effect.
Wire it all up with Skottie to support drop-shadow layer effects.
Change-Id: I98e9669852f58ba6481439a7fda4a56ec6c59b8a
Reviewed-on: https://skia-review.googlesource.com/c/190426
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This is useful, for example, when trying to test a hardware feature
that isn't supported in the current context.
Bug: skia:8731
Change-Id: I9a363159300c92e4039bfd05400238c27002efb1
Reviewed-on: https://skia-review.googlesource.com/c/189133
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Update the text adapter to shape using SkShaper.
Bug: skia:
Change-Id: Ie6ea579a1f58b2f6ba6101dcdfad8ae9809de808
Reviewed-on: https://skia-review.googlesource.com/c/183387
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
This informs HarfBuzz when we are at the beginning or end of a
paragraph so that it can handle a few rules in a special way.
Change-Id: I66a306f1ff7ddb2c1546b0fd9c0cee94cb9f7006
Reviewed-on: https://skia-review.googlesource.com/c/189850
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
There are currently two consistent ways to do line breaking. The 'ok'
way where the entire line is shaped and the resulting glyphs broken
into lines based on hopeful cluster breaks. This has the one nice
property of preserving all shaping done by the font. The 'correct' way
is to shape to each break opportunity and pick the best one, then
continue to do so for each line. This has the nice property of not
shaping incorrectly.
Fortunately, the actual implementation can be hidden behind a common
interface. Keep both of them to ensure this continues to be the case.
Change-Id: I68086731c9c2eea00b26f1447e3ec17aba799ab3
Reviewed-on: https://skia-review.googlesource.com/c/156641
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
For targets that depend on ICU, only define if `skia_use_icu` is set.
Move declare_args/skia_use_icu into skia.gni. Other variables that need
to work like that can move there later.
icu/BUILD.gn defines SK_USING_THIRD_PARTY_ICU if needed.
SkShaper_harfbuzz.cpp SkPDFSubsetFont.cpp respects
SK_USING_THIRD_PARTY_ICU when calling SkLoadICU().
sfntly/BUILD.gn, harfbuzz/BUILD.gn, icu/icu.gni uses $_src variable to
reduce verbosity. icu/icu.gni adds more headersto sources.
Change-Id: I9e000b9b19902d9f5c0c64e989bf42466aa8a299
Reviewed-on: https://skia-review.googlesource.com/c/189304
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Bug: skia:8731
Change-Id: If73216bd427a1ce773fa41044a45c1bbd7ea08e9
Reviewed-on: https://skia-review.googlesource.com/c/189124
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Geometry effects (trim-path, etc) are sensitive to the SkPath conversion
direction and starting point.
Introduce SkSG{Rect,RRect) direction and initial point attributes, and
update Skottie to initialize these according to the AE model.
TBR=
Bug: skia:8303, skia:8328, skia:8299
Change-Id: I5ec82d747e015067c7fc416c9eded6eea73d759a
Reviewed-on: https://skia-review.googlesource.com/c/185689
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Preps for building in Chromium & G3.
Change-Id: I4eb802f27aac7d3652c3b3ce427dcc758d6c31fe
Reviewed-on: https://skia-review.googlesource.com/c/185000
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Refactor the scene graph transform hierarchy to support 4x4 matrices:
* rename current Transform to TransformEffect (operates as a render tree effect)
* introduce a new Transform abstract base class, to replace current Matrix
* refactor existing Matrix as a Transform specialization
* introduce a new Matrix44 Transform specialization
* refactor the existing composition helper (ComposedMatrix) as Concat,
a Transform specialization (using composition instead of Matrix inheritance)
Change-Id: Ic3c1b499e10a0a229a7a76d4bef3dbc6a8b49194
Reviewed-on: https://skia-review.googlesource.com/c/182666
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
ToCmds/MakePathFromCmds taken from PathKit, as were the tests
for those methods.
Bug: skia:
Change-Id: I9c52c04fe61e8934543a10f84ebf8b01b449f7f4
Reviewed-on: https://skia-review.googlesource.com/c/181565
Reviewed-by: Kevin Lubick <kjlubick@google.com>
I think this would only commonly happen for cases which files aren't
being loaded (debug asmjs), but could happen if multiple ready() calls
are made (which is discouraged).
Bug: skia:
Change-Id: If848aad8603f997661502563136ac590cc9a6d5a
Reviewed-on: https://skia-review.googlesource.com/c/181409
Reviewed-by: Kevin Lubick <kjlubick@google.com>
trying to reduce casts at call-sites
Bug: skia:
Change-Id: I7c74cfd89111f7a197cbb1d77b499e2adc193579
Reviewed-on: https://skia-review.googlesource.com/c/180363
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This should make reproducing certain fuzzes easier between oss-fuzz
and a typical dev's desktop.
This was the most straight-forward way I could think of to
accomplish this. An ideal solution would "compile" a set of
fonts that was not the test set and embed it, but I lack the
domain knowledge to craft such a set.
If this method works ok, we can explore making the font set
more robust and varied.
Bug: 818769
Change-Id: I03eb2bc316caf7aec3ffa88e59ff29d76c8557ec
Reviewed-on: https://skia-review.googlesource.com/c/177800
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Tweak SkShaper to call out for each line, instead of bundling everything
as a text blob.
Change-Id: Ic522f88afcf31cefd873dc8b5cde1ac2e107c64f
Reviewed-on: https://skia-review.googlesource.com/c/176592
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Add a MarkerObserver interface (to replace the current
AnnotationObserver), and update CustomPropertyManager to intercept both
properties and markers.
TBR=
Change-Id: If79de419066916bc596316f0a551c75564069239
Reviewed-on: https://skia-review.googlesource.com/c/173766
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
Made addPath take one more arg to allow for append/expand
(which makes emulating the HTML canvas easier).
Add Gold test for various lineTo/pathTo, etc.
Make CanvasKit.Color() choose a better value for alpha
when omitted (was 0, should be 1).
Add some parsing logic to deal with colors/font sizes.
Fonts are going to be rather complex it seems.
Moves some arc-related logic to the JS side, (although
this should preserve the behavior of CanvasKit.arc() to
behave like the Canvas implementation)
Make Examples and tests to a side-by-side comparison to
HTML canvas where applicable.
Add a Changelog for PathKit. There was a bug (I thought), but
turns out I was wrong. The Changelog will be for future
bug fixes.
Bug: skia:
Change-Id: I1bd603fdb518232604b098e24543e3453015b504
Reviewed-on: https://skia-review.googlesource.com/c/170446
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Change-Id: Ie7966e22282ef25861cc775bd0904c113ded76c1
Reviewed-on: https://skia-review.googlesource.com/c/171523
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
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>
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>
This should make the logs in the bots more actionable by showing
the error and trace.
This also fixes the API change causing mysterious red.
Bug: skia:
Change-Id: I38df2bb4557041f8bdfefcae5c8d95b58e770033
Reviewed-on: https://skia-review.googlesource.com/c/168180
Reviewed-by: Kevin Lubick <kjlubick@google.com>
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>
This also does some clean up to how we name enums - the caps felt a bit
obnoxious. CAPS are reserved now for constants (like colors).
Small bug fix with leaking memory on discrete path effects
This also adds a few more things from PathKit
Bug: skia:
Change-Id: Iad7e21ac36d35a36a8b255dc82b1dcc886344db1
Reviewed-on: https://skia-review.googlesource.com/c/166804
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
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>
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>
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>
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>
Also make a CPU only and GPU only build (although
the latter still has a lot of CPU logic).
Bug: skia:
Change-Id: I857c2300021c2adb5344865c28e4ad3e8d332954
Reviewed-on: https://skia-review.googlesource.com/c/162022
Reviewed-by: Kevin Lubick <kjlubick@google.com>
We have a similar ingestion strategy to Gold.
I tried to use something off the shelf like benchmark.js
but passing the PathKit context into the benchmarks was
non-trivial. Plus, making a basic benchmarking tool
ended up being not too hard.
We should be able to re-use the docker container/aggregator
for CanvasKit too.
Bug: skia:
Change-Id: I613dfc58ea57c31cf71566a8ac55f8df9272ad25
Reviewed-on: https://skia-review.googlesource.com/c/161620
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Stephan Altmueller <stephana@google.com>
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>
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>
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>
Building CanvasKit uses very similar logic to PathKit, so there
was a fair amount of copy/paste/customize.
Fixes the name of skia.js/wasm -> canvaskit.js/wasm and
adds a package.json to formally track versions.
Also move PathKit helper scripts to align better.
Docs-Preview: https://skia.org/?cl=160463
Bug: skia:
Change-Id: Ie75b30592dcc4d520dca41f6f5579006aaa8849b
Reviewed-on: https://skia-review.googlesource.com/c/160463
Reviewed-by: Eric Boren <borenet@google.com>
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>
- plumb a RenderContext RenderNode::render() argument to track pending
opacity
- defer opacity application until we can determine whether a layer is
required (group with multiple children) or the opacity can be pushed
onto the draw paint (for single/atomic draws)
Bug: skia:
Change-Id: I962ba08bad780395d5d738307bde986e9efa502b
Reviewed-on: https://skia-review.googlesource.com/146445
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
* reserve SkPath storage to avoid incremental allocations
* refactor eval() to avoid copying data when interpolation is not
triggered
Change-Id: I467affbbfd652e8fa2a486acab7d6c7b9165d49f
Reviewed-on: https://skia-review.googlesource.com/146166
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
push -> push_back
add some aliases to match std::vector: count, reserve, ...
Bug: skia:
Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
Reviewed-on: https://skia-review.googlesource.com/145884
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
This makes it easier to see what ties this module to Skia.
Change-Id: I392ae4f89fb1afe9193bdb2fda95036f4f5623ed
Reviewed-on: https://skia-review.googlesource.com/145882
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This allows correct shaping across any run breaks.
Change-Id: Ib305bd974ccee2471b1dfe8bd895fb28e475177f
Reviewed-on: https://skia-review.googlesource.com/145726
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>