Commit Graph

82 Commits

Author SHA1 Message Date
Florin Malita
8dad1ffd81 [sksg] Improved layer elision heuristic
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>
2020-02-07 23:20:34 +00:00
Florin Malita
b82c0ece7e [sksg] Clean up public headers
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>
2020-01-30 21:42:59 +00:00
Florin Malita
b67ca7473f [skottie] Switch SkMatrix44 -> SkM44
Change-Id: If58516a0dad5b51debf497b069713fb6f37999e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266940
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-27 21:42:56 +00:00
Florin Malita
d5c42c8c03 [skottie] Refactor property animators
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>
2020-01-16 22:43:12 +00:00
Mike Reed
d4d3b33624 Make converting from 4x4 to 3x3 explicit
Change-Id: I4d190d6831cb517d5e9f22b3f872013367bddc08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264856
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-01-16 22:15:30 +00:00
Mike Reed
cf0e3c63fd remove dead code around old SkPath enums
Change-Id: I8dc06da48e881d3a9c40b47c799afe27bdcce819
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257689
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-12-14 01:58:10 +00:00
Mike Reed
7d34dc7747 Revert "Revert "switch to new filltype for SkPath""
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>
2019-11-26 17:43:14 +00:00
Mike Reed
3e7af41224 Revert "switch to new filltype for SkPath"
This reverts commit 3a50981a83.

Reason for revert: chrome win build found compile-problem in xpsdevice

Original change's description:
> switch to new filltype for SkPath
> 
> Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Iacb3566da61c2512b9bd6b7e42b592febc85e031
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256530
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-26 03:34:30 +00:00
Mike Reed
3a50981a83 switch to new filltype for SkPath
Change-Id: I7793324a9acf4afb0eb38c1e20fbb38eac25d636
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256102
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-11-25 22:31:46 +00:00
Florin Malita
be7e7ddcb6 [sksg] Temporarily inline Path fillType accessors
(to facilitate SkPathFillType conversion)

Change-Id: I713cab5e4ecef51a251692bc745994ab0e71c43d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256219
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-25 15:02:06 +00:00
Mike Reed
30bc527fd6 Revert "Reland "Revert "Use flat version of path-direction enum"""
This reverts commit 7cda6f3743.

Reason for revert: legacy convexity code removed -- google3 should be ok

Original change's description:
> Reland "Revert "Use flat version of path-direction enum""
>
> 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>

TBR=reed@google.com

Change-Id: I3529139bb391c4f62ce5cd0744cdf38a13b71d78
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255984
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-22 19:09:54 +00:00
Mike Reed
7cda6f3743 Reland "Revert "Use flat version of path-direction enum""
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>
2019-11-22 11:03:34 +00:00
Mike Reed
1792b19485 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>
2019-11-22 00:51:22 +00:00
Mike Reed
0dacc6b7d3 Revert "Use flat version of path-direction enum"
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>
2019-11-21 22:10:32 +00:00
Mike Reed
e0fbe94351 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>
2019-11-21 21:45:20 +00:00
Florin Malita
49081f6792 [skottie] Use SkColor4f for gradient color stops
TBR=
Change-Id: I941a2b876f87183c5750bb3cf68fc0cd7f0e56a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252799
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-05 18:26:22 +00:00
Florin Malita
59e72b71b5 [skottie] Luma matte support
Expand matte support to include normal/inverted luma modes [1].

[1] https://helpx.adobe.com/after-effects/using/alpha-channels-masks-mattes.html#track_mattes_and_traveling_mattes

TBR=
Bug: skia:9390
Change-Id: Ie6555852e70449e4343944c70d2f9b8a98bb33cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248701
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-16 13:17:51 +00:00
Mike Reed
4241f5e0a8 Revert "add guard to switch to SkPathTypes"
This reverts commit e1af44498b.

Reason for revert: breaking google3?

Original change's description:
> add guard to switch to SkPathTypes
> 
> Change-Id: I44d8b5ae8a5172d11a6d4cd9d994373dd3816d6f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241278
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=robertphillips@google.com,kjlubick@google.com,fmalita@chromium.org,reed@google.com

Change-Id: If1fffb6310921ee6f213af000da793afcf62ab0b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241560
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-09-14 19:13:44 +00:00
Mike Reed
e1af44498b add guard to switch to SkPathTypes
Change-Id: I44d8b5ae8a5172d11a6d4cd9d994373dd3816d6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241278
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-09-14 01:26:38 +00:00
Florin Malita
3c8f9cb45d [skottie] Harden motion blur
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>
2019-08-27 00:21:12 +00:00
Michael Ludwig
297587ba1a Update skottie/sksg to use new filter factories
Bug: skia:9280
Change-Id: I944c2985a6ebdd23a11729069a0ece2c49c4f4b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230887
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-08-02 14:51:42 +00:00
Florin Malita
5f240186ec [skottie] Ref-counted animators
Change-Id: I022c655c3f72551ccf6d35ba013fba6461e89a5c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229389
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-23 22:40:14 +00:00
Florin Malita
00d4f535c9 [skottie] Expose SG inval controller on seek()
- 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>
2019-07-22 16:33:15 +00:00
Florin Malita
ccacfa02d2 [skottie] Caching motion tile
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>
2019-07-10 19:13:41 +00:00
Florin Malita
9c47e15e23 [skottie] Linear Wipe effect
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>
2019-06-19 13:22:53 +00:00
Florin Malita
514bae628e [sksg] RenderNode visibility control
Add accessors for enabling/disabling rendering, and remove old-style
OpacityEffect workarounds.

TBR=
Change-Id: I783ada1cb460bce11948f9ca8d6d9d3efa8ca177
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221896
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-19 00:49:15 +00:00
Florin Malita
b97824d4d1 [skottie] Motion tile effect
Implement support for AE's Motion Tile effect [1].

This is the first effect which needs layer size information, so the CL includes
related plumbing.

Limitations: no phase support at this point.

[1] https://helpx.adobe.com/after-effects/using/stylize-effects.html#motion_tile_effect

Change-Id: I023bf8a9d3e3d2a48458fa94218f143e6aac4c9f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221244
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-17 18:20:15 +00:00
Ben Wagner
5785e4a165 Use SkFontHinting instead of macros.
Change-Id: Ie7f231295c27010f53f09e9879aa7df74ab2d09b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212507
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@skia.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-08 12:16:37 +00:00
Florin Malita
2253c22afb [skottie] Parented camera support
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>
2019-04-25 17:02:49 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
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>
2019-04-24 16:27:11 +00:00
Florin Malita
b72dee21c1 [skottie] Initial "Levels" effect support
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>
2019-04-10 20:40:10 +00:00
Florin Malita
b161a7d965 [skottie] Fix gradient ramp interaction with non-atomic draws
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>
2019-04-04 16:52:59 +00:00
Florin Malita
866e262a21 [skottie] Fix gradient ramp for non-solid layers
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>
2019-04-03 20:46:35 +00:00
Mike Reed
fae8fceb4a Use SkTileMode instead of nested enum
Add guard to transition clients

Change-Id: Ia7a3e8f95722f91e84af262168dadf89a78707da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205720
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 15:24:18 +00:00
Florin Malita
3d846c98ca [skottie] Initial gradient ramp effect support
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>
2019-04-02 14:24:56 +00:00
Florin Malita
fb4bce8322 [sksg] Refactor gradient implementation
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>
2019-04-01 18:43:43 +00:00
Florin Malita
cd6120c502 [skottie] Use kMedium_SkFilterQuality for image filtering
... to improve downscaling quality.

Also update the default sksg::Image filter quality to match SkPaint (kNone).

TBR=reed@google.com

Change-Id: I32788d3a214450cce362be0d178a2404ad255afa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200927
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-13 16:18:51 +00:00
Florin Malita
a720d76470 [skottie] Gaussian blur layer effect
Introduce a BlurImageFilter SG node + required Skottie glue.

NOTRY=true
Bug: skia:
Change-Id: If56a8a6fe565c318216251d80a3e37f4ff6603c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198255
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-03-08 17:59:17 +00:00
Florin Malita
bd64f18947 [skottie] Layer blend mode support
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>
2019-02-25 15:48:07 +00:00
Florin Malita
a753d1a347 Reland "[skottie] Add tritone layer effect support"
This reverts commit 42ee4028a9.

Original change's description:
> Revert "[skottie] Add tritone layer effect support"
> 
> This reverts commit 71c70ea13e.
> 
> Reason for revert: broke WASM builds
> 
> Original change's description:
> > [skottie] Add tritone layer effect support
> > 
> > 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>
> 
> TBR=fmalita@chromium.org,reed@google.com
> 
> Change-Id: Id5bd99701f74fbd4f54d0aca74e753b7ab88bdb3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/194429
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ie7fc28ff784b91f01108415e50677e8982ccf858
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/194430
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-22 23:11:02 +00:00
Florin Malita
42ee4028a9 Revert "[skottie] Add tritone layer effect support"
This reverts commit 71c70ea13e.

Reason for revert: broke WASM builds

Original change's description:
> [skottie] Add tritone layer effect support
> 
> 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>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Id5bd99701f74fbd4f54d0aca74e753b7ab88bdb3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/194429
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-22 21:51:13 +00:00
Florin Malita
71c70ea13e [skottie] Add tritone layer effect support
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>
2019-02-22 21:00:25 +00:00
Florin Malita
48cc589886 [skottie] Tint effect support
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>
2019-02-20 22:42:00 +00:00
Mike Reed
ec80d901b9 starter sample for playing with SG.
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>
2019-02-12 17:03:40 +00:00
Florin Malita
eb46bd892d [sksg] Hit-testing API
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>
2019-02-12 15:01:05 +00:00
Florin Malita
ef26fcb13f [sksg] Fix image filter content inval rect tracking
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>
2019-02-10 21:43:20 +00:00
Florin Malita
dafd65217b Reland "[skottie] Add drop shadow support"
This reverts commit 0b36acdad9.

Reason for revert: Cannot repro build failure - maybe flake?  Trying again.

Original change's description:
> Revert "[skottie] Add drop shadow support"
> 
> 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>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ic3f949f40ed4651715b6de906882f5f4522f91b9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/191040
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-10 01:49:55 +00:00
Florin Malita
0b36acdad9 Revert "[skottie] Add drop shadow support"
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>
2019-02-09 14:41:40 +00:00
Florin Malita
1f43a4359d [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>
2019-02-09 13:35:57 +00:00
Florin Malita
8ec9a60bdb [skottie] Initial repeater support
TBR=reed
Bug: skia:8399
Change-Id: Iadaf6b7b363e345d736efd3fd3a5f401963a457b
Reviewed-on: https://skia-review.googlesource.com/c/188631
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-02-02 04:30:51 +00:00