When per-character 3D is enabled, text properties can be animated in
3 dimensions.
- position and scale become 3-value vectors
- in addition to existing "r" (really rz), rotation gains "rx" and "ry"
- instead of specializing for 3D, expand the existing structures to
handle both 3D and 2D modes
- also ensure that sksg::Transform does not flatten to SkMatrix
Change-Id: I426a7ee1ff38c1702deb85e9f1db80f6069f36d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272648
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
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>
We allow animating the mask filters, so we can end up with null filters
sometimes.
TBR=
Change-Id: Id93aa033407f58bfeb5e059210141c936c356701
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256697
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
MotionBlurEffect makes use of many abilities some consider to be
unnatural. Notably, it mutates the state of its subtree at render time
(gasp) to sample various time points.
Mutation triggers scene graph invalidation, which bubbles up the
ancestor chain. While we immediately revalidate the subtree, we
cannot do the same for ancestors (no full scene knowledge). This means
post-rendering, we leave some SG nodes dirty - which triggers various
debug asserts).
The easiest fix is to temporarily suppress invalidation bubbling at the
MotionBlurEffect node level (this is safe, because we always revalidate
the subtree).
Also add a post-render assert for tighter state validation.
Change-Id: I376b7a8880f71d85e595c419334b42bc4720ac65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243420
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
We're currently letting render context overrides (opacity, color
filters, blend mode, etc) spill down the descendent/mask content
tree.
This is not ideal, as mask content isolation breaks atomicity
assumptions for deferred overrides. Case in point: motion blur uses
SkBlendMode::kPlus to accumulate content "layers" - but since mask
content gets rendered into a separate layer, it fails to produce the
expected result.
The fix is to realize all context overrides on the top-level mask layer
(we already allocate this layer, so there's no reason to defer
downstream anyway).
Change-Id: Icbb7e403f90feecfae5846697f559a03d8aa4097
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239036
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
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>
gm, slides, and samples no longer need to know about the implementation
details of AnimTimer.
This
virtual bool onAnimate(const AnimTimer&);
becomes this:
virtual bool onAnimate(double /*nanoseconds*/);
which is much easier to reason about.
AnimTimer itself is now part of viewer.
Change-Id: Ib70bf7a0798b1991f25204ae84f70463cdbeb358
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226838
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@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>
... but keep the apis for now
Bug: skia:4872
Bug: skia:9012
Change-Id: I3a9b0c9194be6897c0e59b7edd972b7218168183
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211343
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
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>
Idea: transition callers to this, so we can later typedef SkColorFilter
and SkShader to the same thing.
Bug: skia:8937
Change-Id: I000c882e11622091aa44c141aa6ddd1216414f46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206685
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: 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>
Change-Id: I700b7c0461475062ac66712cc29070f150cf777d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202315
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>