We can skip effect layers when none of the child nodes overlap (treat as
atomic draws, with effects applied on their paint).
The initial heuristic was simply checking for more than one child.
This version relaxes the heuristic to check each child bounds against
the union of preceding siblings.
Change-Id: I2dc6d30d945697f410100db0c46a8a8377d5b569
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269482
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Change-Id: I0a6627f9b8d47e51c82c89ff1df75c3add8e8035
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267919
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Currently, property animators use lambda captures (std::function<>) to push
values to adapters and then to the scene graph. Some downsides:
* complex lambda captures are expensive in terms of object code size
* adapters with multiple animated properties don't synchronize/quiesce: each individual property tick triggers a SG
synchronization, possibly with inconsistent state (as animator running
order is unspecified)
* there is no enforced scoping, resulting in fragile constructs when SG
fragments are discarded
This CL introduces a simplified and more robust animator pattern:
* property animators are scoped to explicit containers
* instead of capturing arbitrary value functors, animators only capture
a pointer to the target value
Some implementation details:
* keyframe/interpolation logic is pretty much unchanged (just relocated)
* introduced AnimatablePropertyContainer - a base class for animatable
adapters
* legacy binding functions are refactored based on the new mechanism
(they now/transitionally inject adapter objects)
* converted a handful of effects, to exercise trivial refactoring patterns
* converted the text animator goo, to exercise non-trivial refactoring:
- detecting value changes is now trickier (no more lambda magic)
- value adjustments must be hoisted into adapter logic (no more lambda magic)
- all dependent animated values (selectors, etc) must be scoped to the
text adapter to avoid lifetime issues
TBR=
Change-Id: Ia5821982f251de0de58fd3f87812219ff7fcc726
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263938
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
This reverts commit 3e7af41224.
Change-Id: Id4f66b3956f4bdbe690db20fc478b7365ee89717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256676
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
This reverts commit 1792b19485.
Reason for revert: need to update legacy_convexity, still used by google3
Original change's description:
> Revert "Revert "Use flat version of path-direction enum""
>
> This reverts commit 0dacc6b7d3.
>
> Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
> Auto-Submit: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=reed@google.com
Change-Id: I0ecea0eb8a237298c6b908cc4bfd1cacdfc5b900
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255976
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This reverts commit 0dacc6b7d3.
Change-Id: Ie103e9f36b07e4ee256a3688a4decf3a6dd74314
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255832
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This reverts commit e0fbe94351.
Reason for revert: need to add guard flag to flutter
Original change's description:
> Use flat version of path-direction enum
>
> Bug: skia:9663
> Change-Id: I00077d9f2b14b3e983e6a46ef6f560cabdb1678d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242557
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
TBR=fmalita@chromium.org,reed@google.com
Change-Id: If47173d9b203b2d3a175af290a15d986accb4703
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9663
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255831
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
1) don't attempt to attach the effect when the layer is null
2) sksg::onRender can receive a null context - handle it gracefully
TBR=
Change-Id: I4fae08b15d448849c7c99b17df6811ad31f190c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237276
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
- 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>
Update MotionTileEffect to avoid rebuilding shaders redundantly,
at render time:
1) build all shaders at revalidation time
2) cache the layer content picture separately, and only rebuild when
the layer content changes
To support #2, add some SG helpers for querying subtree inval state.
With this change, we avoid all render time allocations.
Notry: true
Change-Id: I55a1f95752704af6a667b266e725492de6640387
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226512
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Add SkMaskFilter scene graph nodes and implement AE's linear wipe effect
as a gradient shader mask filter.
Change-Id: I3b2d8677c894d27249cfae7e3ea6b1248b53546b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221776
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Parent camera layer transforms apply to the camera itself, thus
T_camera' = T_camera x Inv(T_parent)
To support this composition:
- introduce sksg::Transform::MakeInverse()
- allow selectable pre/post parent composition in
AnimationBuilder::attachMatrix3D()
Change-Id: Ie70b36e4e9bb1b32e60893df5695bdc6c0dc0d00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210422
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
Introduce sksg::LevelsColorFilter and hook into Skottie's effects builder.
Limitations:
- BM/Lottie does not export animated paramaters (static values only)
- BM/Lottie only exports the first modified channel
Change-Id: I9ef389478c2eaa0d13794abe6a8089a8b3c0c62e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206269
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Currently, shader effects are applied via layers for non-atomic draw fragments.
This is incorrect, as shaders on layer paints are ignored.
Update to always propagate the shader to leaf node paints.
Change-Id: I59f5a5b874e87827f61844969550600fa39e22a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205931
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Two issues:
1) Empirically (per AE's model), only solid layers transform the effect space.
All other layer types implement their effects ignoring the layer xform.
2) Due to the effect deferral mechanism in sksg, shader effects are
sometimes applied with a different transform than intended.
To address #1, tweak the layer builder logic to attach the effects
before/after the transform node, depending on the layer type.
For #2, track the CTM active when the shader effect is attached and undo
any intervening transformations via a local matrix when the shader is
actually applied to SkPaint.
Change-Id: I29b5a4df3b223e7da9dfc36b0d7d40055d192ac0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205922
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Implement gradient ramp using SG shader effects.
A couple of quirks:
- since the gradient type (linear/radial) is animatiable (?!),
update sksg::ShaderEffect to allow resetting the shader
- gradient ramp doesn't have an assigned/stable JSON effect type,
but the data is present; introduce a name-based effect lookup method
(used as a fallback when the type is not recognized)
Change-Id: I02bbd6c75c3af175b64c1df502aa52b7c0875162
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205342
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Currently, gradients are PaintNode subclasses - which limits their
applicability to leaf DAG nodes.
In order to support generalized gradient/shader effects:
* introduce a new Shader base class
* refactor gradients as Shader subclasses
* introduce ShaderPaint (to support current Gradient-as-paint use)
* introduce ShaderEffect (to support future Gradient-as-effect use)
Tangentially:
* rename SkSGPaintNode.h -> SkSGPaint.h
* consolidate sksg::Color into SkSGPaint.h
Change-Id: I94ba949f4504c09cfde4a4f030d927411fdd66a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205263
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Introduce sksg::BlendModeEffect and use to wrap Skottie layers based on
their "bm" property.
Depending on the presence of non-trivial layer blend modes and the nature
of the destination buffer (fully transparent vs. unknown/pre-filled), we
may now need to render animation frames into a separate layer for correct
compositing.
Track the presence of non-trivial layer blend modes such that we only incur
this extra layer overhead when needed. Also allow clients to pass a "drawing
to fully transparent buffer" hint such that we can avoid the extra layer even
when blend modes are present.
Change-Id: Iaf645878666da4349d0bef8890bbecad23a0aa9b
Reviewed-on: https://skia-review.googlesource.com/c/194840
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Generalize sksg::TintColorFilter into GradientColorfilter, to support
multiple color interpolation ranges.
Keep the two-color/single-matrix (tint) specialization, and use a table
color filter for the general case.
Change-Id: Idf42833462127c29fb69fe94337a1d1478b77dd9
Reviewed-on: https://skia-review.googlesource.com/c/194024
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Introduce a TintColorFilter scene graph node, and hook into Skottie.
Change-Id: I350dec9ebcdc0bfc68d2874703112f1b20b51d75
Reviewed-on: https://skia-review.googlesource.com/c/193662
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@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>