Commit Graph

577 Commits

Author SHA1 Message Date
Florin Malita
0147de41c4 [skottie] Lazy adapter sync
Expand the core animator logic to return whether the computed value is
changing on each tick.  Also rename tick/onTick -> seek/onSeek to better
reflect Skottie semantics.

This information allows us to skip adapter updates for static/hold
animation segments.

This effectively hoists some of the scene graph lazy-update logic to the
Skottie model level, and culls unneeded conversions (e.g. we were
converting ShapeValue -> SkPath on every tick, even when the shape was
not changing).

TBR=
Change-Id: I1ea4e19ae8f993d659826269de6b0465fec70189
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279816
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-30 16:06:02 +00:00
Florin Malita
bb7d95f0f0 [skottie] Cleanup: relocate Animator base class out of SkSG
Decouple animator semantics from the scene graph.

No functional changes, just shuffling code around.

TBR=
Change-Id: I9a4592c424d2f8eb45b1b5f3e1f4b885cfaff9f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-26 20:50:10 +00:00
Kevin Lubick
988ce0490a remove localmatrix parameter from Blend and Lerp compose shaders
Bug: skia:10080
Change-Id: I936d6d696c86c50d5b51dc84894127c38ad753d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279048
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-03-25 17:56:26 +00:00
Florin Malita
ae58199380 [skottie] Initial drop shadow style support
Plumb layer style parsing, and extend existing DropShadowAdapter to
support both drop shadow style and drop shadow effect.

Change-Id: Id99a419dacd06dc38dc4cf84ff4ecb92218c45f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279020
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-25 12:14:26 +00:00
Ben Wagner
9339266839 Infer NodeType in attachDiscardableAdapter.
This makes the call sites a bit simpler, doesn't materially change
anything in an optimized build, allows NRVO, and generally fixes a
number of warnings in gcc 9 about pessimizing-move.

Change-Id: I0ea5f57db163425da728630bfa6c1add7c416bd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278178
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-03-20 19:50:12 +00:00
Florin Malita
3a76975a7c [skottie] VectorValue specialization
Currently we're handling VectorValues via a generic animator => we use
vector<vector<float>> for storage.  That's kinda clunky, especially for
small-size vectors (3d values, colors).

Introduce a more efficient VectorKeyframeAnimator:

  - stores vector values in a contiguous/consolidated float array
  - keyframes reference value offsets in storage
  - fast/sk4f lerp impl

Change-Id: Ia9538068f2c722c2d2209f87e26564f0fe28ac31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277578
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-18 17:57:41 +00:00
Florin Malita
141ac68fa0 [skottie] Cleanup: split animators into separate CUs
No functional changes, just code reshuffle.

TBR=

Change-Id: Ia04add9d51d6e84903d010534434c9a60464a72a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277457
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-17 15:48:17 +00:00
Florin Malita
6509bc715f [skottie] Cleanup VectorValue use
Replace with Vec2Value where appropriate.

TBR=

Change-Id: I530b451d6d858621615e33791e610a562d9643ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276644
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-12 15:35:20 +00:00
Florin Malita
c02e77ce0a [skottie] Effects cleanup pass
1) switch 2D properties to new Vec2Value type
2) convert vebose binding code to more concise EffectBinder pattern

TBR=

Change-Id: If0244fea887c350dd3d59ddd50a7be75e058d799
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276639
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-12 14:03:00 +00:00
Florin Malita
06e5a15567 [skottie] Power reduce trivial spatial Berzier
A significant number of spatial keyframes have trivial Bezier control
points - e.g. located on the linear interpolation segment.  The
corresponding cubics have no effect and can be discarded.

Change-Id: I706546653c3621fd0d3eb9c285627ccd4d0bc549
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276410
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-11 18:12:17 +00:00
Florin Malita
6e7eac9fff [skottie] Simplify the separate-dimensions vector interpolator
No need for an intermediate adapter object - just bind individual/scalar
fields using existing mechanisms.

No functional side effects.

TBR=
Change-Id: I16be769e5fb92dba0ebb6ce3b0584c5cdcc2b92c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276215
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-10 19:55:50 +00:00
Florin Malita
92ec801a2b [skottie] 2D spatial interpolation support
AE discriminates [1] between basic 2-dimensional properties
(PropertyValueType.TwoD - e.g. scale), and spatial 2D properties
(PropertyValueType.TwoD_SPATIAL - e.g. position).

For the latter it provides additional keyframe controls (tangent in &
tangent out) to describe a non-linear interpolation path ("spatial
interpolation").  This composes on top of the usual temporal
interpolation (with its own optional cubic mapping).

To support spatial interpolation:

  - introduce a new Skottie value type (Vec2Value), to represent
    TwoD and TwoD_SPATIAL properties
  - introduce a KeyframeAnimator specialization for Vec2Value, which
    tracks per-keyframe tangent information
  - for spatial keyframes, instantiate/store an SkContourMeasure, and
    use instead of straight Vec2 LERP
  - switch interesting 2D properties to the new value type (transform
    position, anchor point, scale)

(we could look into separating TwoD/TwoD_SPATIAL if needed, but the new
specialization is already more efficient than the old
opaque-vector-with-late-binding approach)

[1] http://docs.aenhancers.com/properties/property/#property-propertyvaluetype

Change-Id: I0863fd970cec4c5ff15cf01b2fb5c6602a468179
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274283
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-10 17:50:55 +00:00
Florin Malita
4054061b0b [skottie] Defibrillate wipe effects
Since we can't use mask filters on layer paints any longer, refactor the
existing wipe effects to use explicit shader masking:

  - remove SkSG::MaskFilterEffect - it no longer works
  - replace with SkSG::MaskShaderEffect
    - for atomic draws, apply the shader to the draw paint as
      SkShader::Blend(kSrcIn, mask_shader)
    - for isolated content, apply the mask as an extra pass
      drawPaint(kDstIn, mask_shader) before restoring the layer
  - refactor VenetianBlindsEffect, LinearWipeEffect and RadialWipeEffect
    to use mask shaders
  - additionally, refactor the RadialWipeEffect gradient to avoid using
    a local shader matrix (does not compose correctly within the new
    framework)

Everyone clear... do not touch the patient... BZZZT!

TBR=

Change-Id: I3a88da97a17b3b68812480cad5298b8778b6847c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275694
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-09 18:41:08 +00:00
Florin Malita
ea3ddc9aef [skottie] KeyframeAnimator builders
Split the keyframe parsing logic into separate builder helpers.

No functional impact, this will facilitate some upcoming changes.

TBR=

Change-Id: I62a02a0ad90ddef572208f8714f22ae0a0b97023
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276003
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-09 18:10:59 +00:00
Florin Malita
960f3d4cd1 [skottie] Text anchor point grouping support
Implement all AE grouping modes: character/word/line/all.

 -- character grouping was already supported (default mode)

 -- for word and line grouping, expand the existing domain mapping logic
    to also track cumulative advance and max(ascent) per span, then use
    this info to compute anchor point boxes

 -- for "all" grouping, the anchor point box coincides with the text box

(https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties)

TBR=
Change-Id: I8564f1349d167d82c31862d8f7e57615cdae0dcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-02 23:07:39 +00:00
Florin Malita
ed38d201de [skottie] Stroke dash support
AE supports dashing all strokes.  Dashes are specified as an arbitrary
number of intervals (alternating dash/gap) plus a start offset.

All values can be animated independently (but of course!).

  - implement a SkSG dash effect (based on SkDashPathEffect)
  - expand the shape builder logic to allow local geometry adjustments
    (kind of a bummer that dashing is a stroke/paint property as opposed
    to a geometry effect in AE)

Change-Id: Ic9ff35f2f9a552a3c26f9e1596ce58ad81f7ced5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274550
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-02 16:56:22 +00:00
Florin Malita
c4fae744d0 [skottie] Fix handling of time-reversed precomp layers
With time-reverse enabled

 - inPoint/outPoint are reversed
 - time stretch is negative

Bug: skia:9958
Change-Id: I5c1197251608aad4b0417cde6ca2600b1b2822fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273808
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2020-02-28 19:42:51 +00:00
Florin Malita
917dddece6 [skottie] Add support for text grouping alignment
AE allows relative adjustments for text animator transform anchor
points [1].

[1] https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties

Change-Id: If98d6b522e73a768ed2358d918867d2aefd09071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274044
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-28 18:59:05 +00:00
Florin Malita
4bd834b167 [skottie] Fix default character transform origin
By default, per-character AE transforms are anchored on the glyph
baseline, mid-advance.

To support:

  - extend SkottieShaper to track per-fragment ascent and advance
  - adjust the fragment transform origin for (advance/2,0)

As an optimization, we only track the anchor point in the presence
of origin-dependent animators (scale & rotation ATM).

(note: the ascent info is going to be used in a follow up CL to support
relative anchor point adjustments)

Change-Id: I883a957028e624522fdf68a6b2fc44384dee18fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273984
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-28 17:06:47 +00:00
Nathaniel Nifong
f106bc27a4 Add SK_NO_FONTS check around font uses in skottie
Prerequisite to cl/297131877

Change-Id: Icd58c69fd53b703e43d67f4a1a9bafe096943edc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273765
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-02-27 20:50:16 +00:00
Florin Malita
9642b31a71 [skottie] Add support for text animator blur
In adition to transforms/opacity/etc, text animators can target
per-glyph opacity.

Change-Id: I6ab63a6e49a64beaf63fc955f0b672a5b8ba84ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272886
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-24 14:01:16 +00:00
Florin Malita
178b860769 [skottie] Initial support for per-character 3D
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>
2020-02-21 21:14:02 +00:00
Mike Reed
46f5c5f08b Make SkM44 public
Need to migrate clients from private/ to core/ include
Unexperimentalize concat44() methods on SkCanvas

Change-Id: I64b8816722a9d93316cb8b8691d2d9a3e36f167f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272464
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-21 15:50:31 +00:00
Florin Malita
0de01c05b7 [skottie] Clip overflowing paragraph lines
AE discards lines with baselines outside the paragraph box.

This aligns Skottie's behavior with AE for default/top-alignment
(but not for any of the custom vertical alignment modes).

Bug: skia:9933
Change-Id: Id0318f0744bf89580774e89494faf19bfb6f6d14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272376
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-20 18:35:15 +00:00
Mike Reed
9d4e31d6cd rm Sk3D.h -- long live SkMat4
Change-Id: Ib83ee6567b1a32f34364b7ac66a659eaeced3249
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272037
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-20 13:15:33 +00:00
Florin Malita
a3e8266117 [skottie] Add warning for missing text/paragraph box
Text auto-scaling requires an explicit paragraph box.

Change-Id: If3ba91051cd5fa8456fc8530d7ed7ad4c663fff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272119
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-19 23:37:04 +00:00
Mike Klein
a9609ea8c5 turn on -Wreturn-std-move-in-c++11
This CL has a complicated back story, but it's concrete change is
simple, just turning the warning on and converting a bunch of

    return foo;

to

    return std::move(foo);

These changes are exclusively in places where RVO and NRVO do not apply,
so it should not conflict with warnings like -Wpessimizing-move.

Since C++11, when you return a named local and its type doesn't match
the declared return type exactly, there's an implicit std::move()
wrapped around the value (what I'm making explicit here) so the move
constructor gets an opportunity to take precedence over the copy
constructor.  You can read about this implicit move here under the
section "automatic move from local variables and parameters":
https://en.cppreference.com/w/cpp/language/return#Notes.

This situation comes up for us with smart pointers: a function declares
its return type as std::unique_ptr<Base> or sk_sp<Base>, and we return a
std::unique_ptr<Impl> or sk_sp<Impl>.  Those types don't match exactly,
so RVO and NRVO don't come into play.  They've always been going through
move constructors, and that's not changed here, just made explicit.

There was apparently once a bug in the C++11 standard and compilers
implementing that which made these copy instead of move, and then this
sort of code would do a little unnecessary ref/unref dance for sk_sp,
and would entirely fail to compile for uncopyable std::unique_ptr.
These explicit moves ostensibly will make our code more compatible with
those older compilers.

That compatibility alone is, I think, a terrible reason to land this CL.
Like, actively bad.  But... to balance that out, I think the explicit
std::move()s here actually help remind us that RVO/NRVO are not in play,
and remind us we're going to call the move constructor.  So that C++11
standard bug becomes kind of useful for us, in that Clang added this
warning to catch it, and its fix improves readability.

So really read this all as, "warn about implicit std::move() on return".
In the end I think it's just about readability.  I don't really hold any
hope out that we'll become compatible with those older compilers.

Bug: skia:9909
Change-Id: Id596e9261188b6f10e759906af6c95fe303f6ffe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271601
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-18 23:55:35 +00:00
Florin Malita
2e941d00c8 [skottie] Store scalar keyframe values inline
Generally, keyframe values live in dedicated storage, and are tracked in
keyframes based on their index.

This separation is not necessary for float values, as their storage size
is the same as their index's:

  - update keyframes to store value records (VRecs), which can hold
    either external value indices or inline floats

  - introduce a scalar animator specialization which operates on float
    VRecs and doesn't require dedicated value storage

Change-Id: Icd8f1608c28c761303bdc44a23f562a2d2810d4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270844
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-18 17:31:15 +00:00
Florin Malita
f3f225443b Undo suspect gn format
[1] formatted modules/skottie/BUILD.gn, as prompted by git cl upload,
but that doesn't sit well with a bot [2].

Let's try reverting.

[1] https://skia-review.googlesource.com/c/skia/+/270450
[2] https://logs.chromium.org/logs/skia/4a5923ca1d5a5511/+/steps/compare_diffs/0/logs/python.inline/0

Change-Id: I6ee74f5038b4f62f978cfe2fa77e7214d34d8b63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270836
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>
2020-02-13 22:17:23 +00:00
Florin Malita
b24f3b150c [skottie] Refactor keyframe encoding
For each Lottie keyframe, we currently store interpolation
*segments*:

 {
   t0, v0
   t1, v1
   cubic_mapper
 }

This is quite redundant:

 - kf(n).t1 == kf(n+1).t0 for all keyframes
 - kf(n).v1 == kf(n+1).v0 for all non-constant keyframes

Refactor to store single keyframe records:

  {
    t, v
    mapping
  }

To identify constant keyframes, since we no longer store
explicit hard stops, we now tag each record with a "mapping"
selector:

    0 -> constant keyframe
    1 -> linear keyframe
  > 1 -> cubic keyframe (adjusted cubic mapper index)


This reduces the storage size by 2/5, and yields overall cleaner
logic (as we're no longer back-filling info as we parse).

Also add a handful of unit tests to lock down limit semantics
(keyframe segments are left-inclusive/right-exclusive).

Change-Id: I3ab0e5568b83ab8536a7d326dbc07c4c455e978d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270450
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-13 18:54:32 +00:00
Shachar Langbeheim
be28d2e75e This change allows users of PropertyObserver to compose a full keypath for each of the modified properties.
Also this contains a demonstration of how to implement this in CustomPropertyManager.

Change-Id: If4770e47b87ed76c98a85de3c235ab27c913dbc0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269696
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-12 14:13:13 +00:00
Brian Osman
788b91678f Remove SkTMin and SkTMax
Use std::min and std::max everywhere.

SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.

Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 18:40:09 +00:00
Florin Malita
4a6a640299 [skottie] Add support for ADBE Pro Levels2 effect
Similar to existing ADBE Easy Levels2, but provides separate mapping
controls per channel.

Change-Id: Ibc58c58e1e8cb8793d6eb819998c1804ccbbf859
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-05 21:05:08 +00:00
Florin Malita
af99f3ee60 [skottie] Cleanup: finalize adapter conversion
Convert remaining bindProperty clients to adapters, and remove the
legacy API.

TBR=
Change-Id: I06eda513a75b55a1ba7eae328b0916e738c9ddd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268309
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-03 18:56:01 +00:00
Florin Malita
cc982ecbca [skottie] Cleanup: convert remaining effects to new adapter pattern
Also add a couple of tests for missing coverage.

TBR=
Change-Id: I420c71d73657c5d003fda94a4c43dde20a1a6b87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267556
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-30 15:30:08 +00:00
Florin Malita
f7d399a6ca [skottie] Cleanup: convert shape stroke/fill to new adapter pattern
TBR=
Change-Id: If4b9e591fdd4349b6a06ce86ba5284ab43634a03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267447
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-29 19:02:07 +00:00
Florin Malita
d960cc31b6 [skottie] Cleanup: remove unused header
SkottieAdapter.h is no longer used.

TBR=
Change-Id: I5a6f503c52168a4418540d344e47cdde101a9f90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267396
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-01-29 15:13:36 +00:00
Florin Malita
ad9110026b [skottie] Separate text resize options
The sk_vj text property (Skottie extension) is currently mixing
vertical alignment and resizing semantics into a single enum.  This
precludes certain valid combinations.

Split the resize options into a separate enum (ResizePolicy), and ensure
support for all combinations.

Before:

  "sk_vj": 0 -> Shaper::VAlign::kVisualTop
  "sk_vj": 1 -> Shaper::VAlign::kVisualCenter
  "sk_vj": 2 -> Shaper::VAlign::kVisualBottom
  "sk_vj": 3 -> Shaper::VAlign::kVisualResizeToFit
  "sk_vj": 4 -> Shaper::VAlign::kVisualDownscaleToFit


After:

  "sk_vj": 0 -> Shaper::VAlign::kVisualTop
  "sk_vj": 1 -> Shaper::VAlign::kVisualCenter
  "sk_vj": 2 -> Shaper::VAlign::kVisualBottom

  "sk_rs": 0 -> Shaper::ResizePolicy::kNone
  "sk_rs": 1 -> Shaper::ResizePolicy::kScaleToFit
  "sk_rs": 2 -> Shaper::ResizePolicy::kDownscaleToFit


Bug: skia:9809, skia:9810
Change-Id: I631ae1fa31a9bc9c6958bb480354138591d504ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267040
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Isabel Ren <isabelren@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-29 00:09:42 +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
e7bd58f512 [skottie] Cleanup: convert transform adapters to new pattern
Use discardable adapters for 2D-transforms, 3D-transforms, cameras
and transform effects.

Improvements:
  - ~4KB smaller object size
  - 3D rotation and orientation now compose correctly
    (instead of overriding each other)
  - streamlined no-op check discards no-effect transform nodes more
    aggressively (20% more nodes discarded)

TBR=
Change-Id: If75e53021871a15b7ea9e3ccb988c734a018f06d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266635
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-27 18:26:46 +00:00
Hal Canary
60ff65114c Fix build when (is_ios && !skia_enable_skottie)
Bug: skia:9726
Change-Id: I2ad05e28f8699fc7c5159145cc59065fc8bd5b93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265520
Reviewed-by: Hal Canary <halcanary@skia.org>
Commit-Queue: Hal Canary <halcanary@skia.org>
Auto-Submit: Hal Canary <halcanary@google.com>
2020-01-23 16:11:36 +00:00
Florin Malita
cbf31d0a0e [skottie] Cleanup: convert shape layer adapters to new pattern
Split off most shape layer components into own CUs (naming convention
following AE), and convert to new DiscardableAdapter pattern.

TBR=
Change-Id: Iba7800cff1998d3d7cf81dfd89b4193d02b59559
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265147
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-22 20:16:36 +00:00
Mike Reed
55f6fc3064 IWYU -- colorspace no longer includes matrix44
Change-Id: I659552466940b76a339caaf124700303806fd082
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265456
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-21 21:37:32 +00:00
Florin Malita
447a4e0982 [skottie] Ensure malformed scalar properties are initialized
In the newly introduced LegacyAnimatorAdapter, failure to parse may
leave the value default-constructed.  This is problematic for scalar
values (floats).

Catch this condition and initialize explicitly.

Bug: ossfuzz:20198, ossfuzz:20194
Change-Id: I86b8030da615d8cb1e1fe8d84873c8bc5cb222f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265397
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-21 14:11:38 +00:00
Florin Malita
e905233c8d [skottie] Cleanup: convert more effects to new animator pattern
TBR=
Change-Id: I9b538853766f31854bba4752cb0f7c20d61c148b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265076
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-17 16:52:13 +00:00
Florin Malita
7c7cd30550 [skottie] Add custom props rendering GM
Also fix a couple of custom props issues:

  - solid layer colors were not dispatched
  - text values were not sync'ed

TBR=
Change-Id: I827f8c1d8c8bb73b03f05de15e1c7c96753a631e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264936
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-17 13:53:02 +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
Florin Malita
a3936c8d29 [skottie] cleanup: move transform & camera adapters to own CUs
Shuffling code around, no functional changes.

TBR=
Change-Id: I9a045fa643fbcf52c58e1378d4d4c1566c0d35d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262225
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-01-06 18:16:14 +00:00
Florin Malita
c8bf7969ec [skottie] Drop legacy effect logging
All clients have been updated

TBR=
Change-Id: I29e89d43606945f13e9933d34218b61be71db63d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261279
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-20 16:30:19 +00:00
Florin Malita
e3f34a657b [skottie] Treat unknown effects as warnings
This used to be the case, but a recent change unintentionally switched
to errors.

TBR=
Change-Id: Ib92d2d04c667664921f47b48babdbe33e135b9ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261179
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-19 22:04:16 +00:00
Florin Malita
42725ae301 Reland "[skottie] Simplify effect builder lookup"
This reverts commit 187cd367d3.

Reason for revert: relanding with legacy enum support

Original change's description:
> Revert "[skottie] Simplify effect builder lookup"
> 
> This reverts commit ef363a9ce6.
> 
> Reason for revert: G3 unit tests failing
> 
> Original change's description:
> > [skottie] Simplify effect builder lookup
> > 
> > Layer effects fall into two categories:
> > 
> >   - effects that BM knows about: these get assigned a unique type enum
> >   - effects that BM doesn't know about: these are still exported, but
> >     get assigned a dummy type
> > 
> > To handle effects in the latter case, we rely on their canonical AE
> > name.
> > 
> > The list of supported effects has grown to the point where a) this
> > differentiation doesn't seem valuable anymore and b) the code is quite
> > repetitive.
> > 
> > Consoliate the lookup logic to rely solely on effect names + bsearch
> > table.
> > 
> > Change-Id: Ib5f9b064a373814865da9e8a26037209992e8b9b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259997
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Mike Reed <reed@google.com>
> > Reviewed-by: Mike Klein <mtklein@google.com>
> 
> TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com
> 
> Change-Id: I3b4c681c260c121e422ade7395c33a77e788ff43
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260196
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I2a4360dc8216b8b45e20c6568c0a1d3d069aa56c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260280
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-16 19:56:22 +00:00
Florin Malita
187cd367d3 Revert "[skottie] Simplify effect builder lookup"
This reverts commit ef363a9ce6.

Reason for revert: G3 unit tests failing

Original change's description:
> [skottie] Simplify effect builder lookup
> 
> Layer effects fall into two categories:
> 
>   - effects that BM knows about: these get assigned a unique type enum
>   - effects that BM doesn't know about: these are still exported, but
>     get assigned a dummy type
> 
> To handle effects in the latter case, we rely on their canonical AE
> name.
> 
> The list of supported effects has grown to the point where a) this
> differentiation doesn't seem valuable anymore and b) the code is quite
> repetitive.
> 
> Consoliate the lookup logic to rely solely on effect names + bsearch
> table.
> 
> Change-Id: Ib5f9b064a373814865da9e8a26037209992e8b9b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259997
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

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

Change-Id: I3b4c681c260c121e422ade7395c33a77e788ff43
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260196
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-15 03:01:25 +00:00
Florin Malita
ef363a9ce6 [skottie] Simplify effect builder lookup
Layer effects fall into two categories:

  - effects that BM knows about: these get assigned a unique type enum
  - effects that BM doesn't know about: these are still exported, but
    get assigned a dummy type

To handle effects in the latter case, we rely on their canonical AE
name.

The list of supported effects has grown to the point where a) this
differentiation doesn't seem valuable anymore and b) the code is quite
repetitive.

Consoliate the lookup logic to rely solely on effect names + bsearch
table.

Change-Id: Ib5f9b064a373814865da9e8a26037209992e8b9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259997
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-12-14 19:28:14 +00:00
Mike Klein
f46d5ca492 use std::make_unique
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>
2019-12-12 22:32:45 +00:00
Florin Malita
46a331b93f [skottie] Cascading track matte support
Currently, we treat track matte source layers (tagged with td:1) as single-shot mask triggers:
we apply once to the following layer, then move on.

But track mattes can cascade: a layer with a matte can itself be applied as a track matte for the
following layer.

Also, for matte/masking purposes, only the layer content is being considered (ignoring blend mode
and any masks applied to the matte itself).

To support this, refactor the layer attachment code:

  - instead of tracking the presence of a single-shot matte source, always track
    previous layer content trees
  - instead of triggering matte attachment in the presence of a matte source, trigger based on
    the matte *target* property (tt: X)
  - log errors on unknown matte modes

Change-Id: I6c71d4007e1e27d3f3a139344bbf367d7bc6e29d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259820
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-12 21:42:11 +00:00
Florin Malita
e1fa70000a [skottie] Invert effect support
https://helpx.adobe.com/after-effects/using/channel-effects.html#invert_effect

Change-Id: Iac8e291ab9cb57714c50f1e40cecb66b3dc64ee1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/259276
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-12-11 23:07:04 +00:00
Florin Malita
870374825b [skottie] Explicit seek(0) in tools
With recent deferred image loading changes, Skottie relies on clients
to always/explicitly seek() before drawing a frame.

Some of the existing tools are still attempt to draw before the first
seek() fires (the animation callback is not guaranteed to occur before
the first draw).  For these, add an explicit seek(0) after loading the
animation, to ensure valid state.

TBR=
Change-Id: Ie453559af2d96560602b5e6508c25169dffb484d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258805
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-09 16:35:02 +00:00
Mike Klein
3e01360677 GCC gets worried when we memset Stats
... because it has a constructor, implied by all the initializers.
Luckily, that constructor does exactly what our memset() does.

Change-Id: Ibe538e9d840de9e6fd07d673783709df17b7b4fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258447
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-12-06 01:48:51 +00:00
Florin Malita
cc92b27c78 [skottie] Optionally-deferred single-frame image loading
Normally, we load single-frame images upfront to avoid instantiating
an animator (as the image content is supposed to be constant).

In certain cases, deferred behavior is desirable (and the extra animator
overhead is minimal).

Generalize MultiFrameAnimator to handle single-frame assets, and add an
optional deferred mode for single-frame image loading
(Animation::Builder::Flags::kDeferImageLoading).

Bug: skia:9686
Change-Id: I4d166cd1a0bf34ccb8679e7553848c831a9193d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258000
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2019-12-05 21:46:59 +00:00
Florin Malita
6cc49538b3 [skottie] Fix precomposed camera sizing
Precomp layers can have a different size vs. main composition.

Instead of relying on the global animation (main comp) size, use the
current (pre)comp size when setting up cameras.

Change-Id: I54106375fb39dde2bfd11e14a38e5ec3e7190764
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258156
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-12-05 14:34:15 +00:00
Brian Salomon
4e1066f248 Remove SkSize& SkSize::operator=(const SkISize&)
Having it means you cannot write:

SkSize size;
float x, y;
size = {x , y};

clang allows it but GCC does not, claiming it is ambiguous between the
implicitly generated
SkSize& SkSize::operator=(const SkSize&)
  and
SkSize& SkSize::operator=(const SkISize&)

clang gives the same error if the former is explicitly declared default.

Change-Id: I3b64436ef6aa669b3d87e7f37057c5dcb4add987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257880
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-12-04 17:36:06 +00:00
Florin Malita
75368c3a02 [skottie] Deferred image frame resolution
Instead of always grabbing the first frame at load time, only do so for
single-frame images.

For multi-frame images, defer frame resolution until actually needed
(at seek time).

There's a slight complication in dealing with image scaling: since we
no longer know the intrinsic size of the frames upfront, we need to
set up a transform effect preemptively for multi-frame images, and
update on the fly when the frames are resolved.  This is not
necessarily bad, because theoretically frames could have different
sizes.

Bug: skia:9686
Change-Id: Ib831d0e2ecad061ba52bdd8721e7598ea38c1e6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257622
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-03 20:17:40 +00:00
Florin Malita
a4f1391bb9 Reland "[skottie] Remove defensive seek(0) from Animation ctor"
This reverts commit e0f374bf8f.

Reason for revert: including tracing fix
Original change's description:
> Revert "[skottie] Remove defensive seek(0) from Animation ctor"
>
> This reverts commit 042fe0847b.
>
> Reason for revert: SkottieTracing bots not happy.
>
> Original change's description:
> > [skottie] Remove defensive seek(0) from Animation ctor
> >
> > It potentially causes unnecessary image frame loads.
> >
> > Well-behaved clients should always seek() before calling render().
> >
> > Bug: skia:9686
> > Change-Id: If16257dc947941541d9ae8906b5ec7b1754dd7df
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257625
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
>
> TBR=fmalita@chromium.org,reed@google.com,aparchur@google.com
>
> Change-Id: I3b7efdfc8e0aed1deb8756d585f946b4309d469d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9686
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257630
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

Bug: skia:9686
Change-Id: Ib8a5d76821685cfa7e7dac61bcc31da5629d9055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257632
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-03 18:26:40 +00:00
Florin Malita
e0f374bf8f Revert "[skottie] Remove defensive seek(0) from Animation ctor"
This reverts commit 042fe0847b.

Reason for revert: SkottieTracing bots not happy.

Original change's description:
> [skottie] Remove defensive seek(0) from Animation ctor
> 
> It potentially causes unnecessary image frame loads.
> 
> Well-behaved clients should always seek() before calling render().
> 
> Bug: skia:9686
> Change-Id: If16257dc947941541d9ae8906b5ec7b1754dd7df
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257625
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

Change-Id: I3b7efdfc8e0aed1deb8756d585f946b4309d469d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9686
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257630
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-03 17:17:36 +00:00
Florin Malita
042fe0847b [skottie] Remove defensive seek(0) from Animation ctor
It potentially causes unnecessary image frame loads.

Well-behaved clients should always seek() before calling render().

Bug: skia:9686
Change-Id: If16257dc947941541d9ae8906b5ec7b1754dd7df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257625
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-12-03 16:49: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
Brian Osman
4449f1f3fa Remove ResourceProvider and ImageAsset sample impls from skottie
All tools are updated to use the new copies in skresources

Change-Id: If3cfc3104d72535ea4c49f70f1fa68dcf78af987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256657
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-11-26 15:47:14 +00:00
Brian Osman
849f4d6571 Copy SkottieUtils' classes into skresources
For now, we'll have two copies. Once clients are using the skresources
versions exclusively, we can remove the originals from skottie.

Change-Id: I3152f526b0505b8374bdd9b4513a80bddc702ccc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256416
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-26 14:25:44 +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
Brian Osman
85bf9314c0 Extracted Skottie's resource provider to a separate module
This is a first pass that should help with migrating clients.
The utility implementations of ResourceProvider are still in
skottie - those are going to be harder to move. More likely
that I'll add parallel implementations in skresources, then
we can shift clients over and delete the skottie copy.

I'm planning to use this interface/system in particles.

Bug: skia:9513
Change-Id: I004da685983c05cb1b48a75f8a23bd7d73a3f5af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256077
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-11-25 18:58:26 +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
684929ceb1 [skottie] Fix single-node camera orientation relative to z=0 plane
One-node cameras start off by pointing forward, where "forward" is
decreasing z (as opposed to always facing z==0, as they currently do).

Change-Id: I2ccd5a7cf7d8f0aeeebde1537d44e188aabccd04
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255117
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-18 23:25:47 +00:00
Florin Malita
ad76b2ee25 [skottie] One-node camera support
So far Skottie has been assuming all cameras are two-node (have a point
of interest).

AE also supports one-node cameras, where the camera does not auto-orient
towards a POI but starts off perpendicular to the z == 0 plane.

(https://helpx.adobe.com/after-effects/how-to/camera-animation.html)

Change-Id: Id565de7d8feb9a762940ac372c1bbbcce2e2dfc6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254559
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-14 18:45:18 +00:00
Florin Malita
91a1ec34bf [skottie] Streamlined gradient stop merger
Refactor as a single interpolating loop, based on careful selection
of lerp coefficients.

Change-Id: I58786cddb2f042b53dcbac80c2346736429be102
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252858
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-05 19:44:11 +00:00
Florin Malita
73a722ce97 [skottie] Fix trim path mode interpretation
"m": 1 -> parallel trim
  "m": 2 -> serial trim

(we had these backwards)

TBR=
Bug: skia:9599
Change-Id: Ib764c04a96c3a1e627553d8b8588028a411b5240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252796
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-05 18:31:24 +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
501149f8d1 [skottie] Add support for gradient opacity stops
Bug: skia:9600
Change-Id: If95c02279efae21db8a673a3b0d349915b0aaba0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252483
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-11-04 20:01:16 +00:00
Brian Osman
e36d030016 SkColorMatrix cleanup
Remove the RGB/YUV helpers (use SkYUVMath instead), along with the
unused get20/set20.

Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Bug: skia:9543
Change-Id: Id83467a1b7f33657869e0a933af75387a4e36a88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/252188
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-11-04 15:20:15 +00:00
Florin Malita
512eb94916 [skottie] Fix layer blend modes under mattes
The layer blend mode should be applied post-masking (after compositing
with the matte layer).

TBR=
Change-Id: Ie84760526cd9be95f08bc68bc5a8dbfb635ca905
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251316
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-29 01:49:26 +00:00
Florin Malita
c6fbedc507 [skottie] 3D layer parenting refinements
Observed AE layer parenting semantics:

  * layers are flagged as either 2D or 3D
  * camera applies to 3D layers, but not to 2D layers
  * parented 3D layers treat their ancestor transform chain as 3D (SkMatrix44)
  * parented 2D layers treat their ancestor transform chain as 2D (SkMatrix, ignoring 3D components)

This means that for a given layer, we may need to build two distinct transform chains - depending
on the type of descendant layer being considered.

Furthermore, transforms are animatable and their animators are scoped to a layer controller.  Since
we're potentially building two version of the transform node, we need to ensure all animators for
both of them are transferred to controller object (we still want to only instantiate a single layer
controller and render tree to avoid duplication).  IOW, all dependent layer transforms need to be
considered before "sealing off" a given layer controller.

In order to avoid a layer dependency/topological sort, we can split off the transform tree
construction into a separate pass.  High-level changes:

  -- replace existing LayerAttachContext with CompositionBuilder
     (holds LayerBuilders and other Composition-wide state)

  -- replace LayerRec with LayerBuilder
     (holds Layer-wide state and also caches transform nodes)

  -- pass 1: for each LayerBuilder, transitively build and cache a transform chain
     of a type (2d/3d) determined by the leaf (entry point) layer

  -- pass 2: for each LayerBuilder, build the actual layer content render tree
     and instantiate the layer controller objects

Bug: skia:8914
Change-Id: I9f7efcf4819424282fd3dda98f5621ba12fd001b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251001
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-28 20:29:54 +00:00
Florin Malita
c1b501c352 [skottie] Shift Channels effect support
(https://helpx.adobe.com/after-effects/using/channel-effects.html#shift_channels_effect)

Limitations: no HSL sources for now.

Change-Id: Iffd63f2bbfc8c5f1de00846412be26847e822420
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250036
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-10-22 20:36:01 +00:00
Florin Malita
94e1a52686 [skottie] fix clangtidy warning
TBR=
Change-Id: I4db02978edbf7d60693b18a7c661640a4ab05bf0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249885
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-21 21:27:40 +00:00
Florin Malita
cfbc4d496d [skottie] Add DataURI image support in utils/tools
BodyMovin can export inline (dataURI) images.

Change-Id: I821a2e225359f8ac37d4d2c9479d4ff5d78f924e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249516
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-21 18:02:39 +00:00
Florin Malita
b9886864ca [skottie] Frame-index seek API (seekFrame)
Add a new seek method which takes a frame index. This provides more accurate
control when rendering of exact frames is needed.

Also surface the animation frame rate, and convert skottie_tool to use this
new mechanism (now defaulting to native animation frame rate).

Change-Id: Id870629e1747a9f70cbf4d3e770366df1299a519
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249799
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-10-21 17:14:36 +00:00
Florin Malita
814f3cc079 [skottie] Default camera for 3D layers
When 3D layers are present, we need a camera view even when no explicit
camera is present.

TBR=
Bug: skia:8914
Change-Id: I408986d516e03bc4f80c7c09103e09821704ff2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249420
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-18 17:20:11 +00:00
Florin Malita
a3adb9ac7e [skottie] Camera does not apply to regular/2D layers
Per [1], "Cameras affect only 3D layers and 2D layers with an effect
with a Comp Camera attribute."

[1] https://helpx.adobe.com/after-effects/using/cameras-lights-points-interest.html#create_a_camera_layer_and_change_camera_settings

Bug: skia:8914
Change-Id: Ic63ac1a9bfd0913757061684f64adf3df8424246
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249419
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-18 16:45:07 +00:00
Florin Malita
d9e8586d23 [skottie] Fix camera/3D layer transform interactions
Currently, the camera view transform is attached to the render tree as a
TransformEffect.  This means it gets "flattened" to an SkMatrix in isolation,
and does not compose with other layer transforms in 4x4 format.

Refactor the implementation to

  - build the camera transform upfront
  - compose (chain) all layer transforms from this camera transform

This ensures that transform composition happens in SkMatrix44.

E.g. render tree topology change (TE == TransformEffect)

Before:

                      [root]
                        |
                      [TE]<---[CameraT]
                        |
       ------------------------------------
      |                                    |
      |                                    |
    [TE]<--[Layer1T]          [Layer2T]-->[TE]
      |                                    |
  [Layer1]                              [Layer2]
      |                                    |



After:
                      [root]
                        |
                        |
       ------------------------------------
      |                                    |
      |             [CameraT]              |
      |                / \                 |
    [TE]<--[Layer1T]<--   --->[Layer2T]-->[TE]
      |                                    |
  [Layer1]                              [Layer2]
      |                                    |


TBR=
Bug: skia:8914
Change-Id: Idd407712f75c48623b5299a4284ddb17b98c155f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249217
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-17 20:57:09 +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 Klein
b484e7ce24 hand off frames to encoder as they come
Instead of rendering all .mp4 frames then encoding, we can kick off
rendering and have the encoder consume frames in order as they become
available.

This uses std::promise / std::future pairs to make the handoff: frame
producers fulfill thieir promise by moving their image into set_value(),
and the encoder (main thread) consumes them by moving those images out
of the paired std::future().  It may not be obvious, but the line

    sk_sp<SkImage> img = frame.get_future().get();

does move the image into `img`... gMP4Frames does not hold a ref once
.get_future().get() has returned.  (Though depending on when you look,
the surface still might.)

This lets us get going on encoding as soon as the first frame is ready,
and hypothetically means encoding should finish shortly after the last
frame draws.  But, different frames cost different time to draw, and we
can't control the order they'll return.  We _do_ have control over the
order they're started, and we're doing that exactly wrong using a LIFO
thread pool.  I've added .mp4 encoding starvation stats to show this...
when I run in LIFO order it looks typically something like

    starved min 0ms, med 0ms, avg 4.12333ms, max 2115ms, sum 2474ms
    frame time min 12ms, med 292ms, avg 307.208ms, max 711ms, sum 184325ms
    106.68user 57.27system 0:04.55elapsed 3601%CPU (0avgtext+0avgdata 3159748maxresident)k
    0inputs+1528outputs (0major+772790minor)pagefaults 0swaps

Mirroring the batch order with (i = frame_count - 1 - i) results in less
starvation, less memory usage, better scaling, and a quicker wall time.

    starved min 0ms, med 0ms, avg 0.896667ms, max 382ms, sum 538ms
    frame time min 13ms, med 374ms, avg 344.365ms, max 918ms, sum 206619ms
    111.64user 52.56system 0:03.62elapsed 4529%CPU (0avgtext+0avgdata 2660912maxresident)k
    0inputs+1528outputs (0major+649031minor)pagefaults 0swaps

Change-Id: Ic60e8eac856af238ef32e3383d86f6c24e5c7851
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247674
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-10 16:34:31 +00:00
Florin Malita
10e5257ec9 [SkVideoEncoder] Allow clients to control the color type
Change-Id: If57514c9e7e8d0a417eb9388873bbb348fc49076
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247384
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-10-10 14:55:31 +00:00
Mike Klein
be6d62d5d3 add -f mp4 to skottie_tool
This runs way faster than skottie2movie, even with Mike's patch.
We could probably ditch skottie2movie with this CL and one adding --gpu?

Change-Id: I41376c2cd636eb75a3a6d2aaa75bef48211a1021
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247377
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-10-09 18:53:01 +00:00
Florin Malita
f976e97a97 [skottie] Horizontal-constraint for Shaper *ToFit alignment modes
Currently we only constrain vertically, assuming shaped lines don't
overflow horizontally.  This is not true for very long words.

Update kVisualResizeToFit and kVisualDownscaleToFit to constrain in
both dimensions.

Also drop the early exit condition because

a) it makes less sense when checking in 2 dimensions (there are
multiple answers which fit snugly in one dimension, but we're
ultimately selecting for the largest font size)

b) it probably doesn't trigger much in practice

Existing tests cover the change in behavior.

Bug: skia:9471
Change-Id: I4e53a51500b02ba7db26dad249458bcf491b088a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246305
Reviewed-by: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-07 14:58:48 +00:00
Florin Malita
e3e4b0cfc1 [skottie] Fix motion blur glitches around domain edges
For motion blur we're sampling within some window around a given t.

If t is close to the layer in/out point, things get murky: for samples
which fall outside the layer lifespan, we skip drawing => fewer samples
are accumulated => the opacity of the result drops => visual glitches.

The solution is to modulate the frame alpha based on the number of
*visible* samples, and skip rendering when no samples are visible.

Bug: skia:9486
Change-Id: I8d9692ae1589b43d9e6f728d7b7ac2fbf39153fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/245363
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-10-01 17:25:12 +00:00
Florin Malita
26013e93b5 [skottie] Minimize top layer size
Limit the optional/top layer size to the dest area.

Change-Id: Ic3825ff3c12d87b01f18f52ea60bfc31710e2272
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244885
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-09-27 19:29:50 +00:00
Florin Malita
4122c4d23a [skottie] Fix skottie_tool anim null check logic
Pre-compute the scale matrix based on the main thread animation size,
to avoid touching thread-local animations before null-checking.

Change-Id: Ib2b91d9db7d60a1bd31b21972de136fd838b8377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244836
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>
2019-09-27 15:24:46 +00:00
Florin Malita
49c0732570 [skottie] Add null sink option for skottie_tool
Useful for excluding encoder/IO from scaling tests.

Change-Id: Ib76cc07a54d3cd3e00b4a3b3c9ea6f049440b7f8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244396
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-09-26 16:11:14 +00:00
Florin Malita
fbe61189f6 [skottie] Minor MotionBlurEffect cleanup
Change-Id: I9d02ff9f6bcc86cdc10e01a4e3379014557172e9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244507
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>
2019-09-26 16:01:44 +00:00
Mike Klein
1585d7e108 opt skottie_tool into thread-local strike caches
I think this is largely free win if done once at process startup:

    $ time out/skottie_tool -i ~/Downloads/mb/data.json -w before
    166.59user 29.42system 0:06.13elapsed 3195%CPU (0avgtext+0avgdata 1994888maxresident)k

    $ time out/skottie_tool -i ~/Downloads/mb/data.json -w after
    93.36user 34.96system 0:04.76elapsed 2690%CPU (0avgtext+0avgdata 1968568maxresident)k

    $ idiff before after
    1333 files are identical.

Change-Id: I5454aed5e64bf78d61dfdc22ea1ce629714bd70c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244120
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-09-25 16:57:56 +00:00
Mike Klein
5e6d36ac3e dump frame time stats in skottie_tool
$ time out/skottie_tool -i ~/Downloads/mb/data.json -w after

  Animation loaded with 2 errors, 0 warnings.
    !! Could not create typeface for Google Sans|Bold.
    !! Could not create typeface for Google Sans|Medium.
  frame time min 28ms, med 286ms, avg 441.18ms, max 1982ms, sum 264708ms
  93.74user 33.03system 0:04.70elapsed 2694%CPU (0avgtext+0avgdata 1976980maxresident)k

Things are looking pretty reasonable scaling-wise when we take ~5
seconds to run and some frames take up to ~2 seconds.

Change-Id: I0bfd955afcd9b8ac18e6614e1b5aa6889a06059a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244121
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-09-25 16:13:29 +00:00
Florin Malita
01acb12110 [skottie] Disable skottie_tool on iOS
No thread_local support.

Change-Id: I8f22b237e099f36992da3483e06ae22ba3cd6de0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243625
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-09-24 22:27:10 +00:00
Florin Malita
052837c3d2 [skottie] Tweak skottie_tool --threads meaning
There's an implicit +1 to the SkTaskGroup worker count, as the
main/scheduling thread also participates in the queue.

This is quite confusing.

Adjust the --threads parameter such that 1 means single threaded,
2 means rendering on two threads, etc.

Change-Id: Ib55c4b0a29cb342c7d18a15384e1c511614ee7af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243740
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-09-24 19:54:02 +00:00
Florin Malita
c245673402 [skottie] Multi-threaded skottie_tool
Parallelize frame rendering and encoding:

  - introduce a caching/pre-decoding resource manager.

  - dispatch individual frames to a task group

  - use per-thread animation instances and sinks


Change-Id: I91549ed20e3346c445defa0d8734648f8a89f8df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243659
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-09-24 18:29:09 +00:00
Florin Malita
0f11e115d7 [skottie] Fix motion blur asserts
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>
2019-09-23 17:34:42 +00:00
Brian Osman
1ec1e3c55e Use 64 bit shift to make MSVC happy
CQ_INCLUDE_TRYBOTS=skia.primary:Build-Win-MSVC-arm64-Debug,Build-Win-MSVC-x86_64-Debug
Change-Id: I381da9c2b2e9b98bc50e8d80ead10ad048e50fce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243036
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-09-20 13:44:00 +00:00
Mike Klein
f51e1fd37d raster 8888 pow2 samples hack
The gist here is to use saveLayer() to create a buffer to draw each
subframe into, but not actually use it to draw anything at restore()
time, hence, canvas->clear(0).  (SkCanvas sniffs out cleverer approaches
like 0 alpha or SkBlendMode::kDst.)

Instead, we accessTopLayerPixels() and slurp the subframe out into a
16-bit accumulator, then when all subframes have drawn and accumulated
there, one more saveLayer() and accessTopLayerPixels() lets us put them
back, shifting back down to 8-bit.

The hot parts of the profile are drawing the frames themselves, then the
accumulate / repack code in renderToRaster8888Pow2Samples().

  $ time out/skottie_tool -i ~/Downloads/mb/data.json -w bar
  Before: 28.39user 1.14system 0:29.54elapsed
  After:  22.08user 1.12system 0:23.21elapsed

    I'm not proud of it.
    ...
    ...
    ...
    I am a bit!

Now using one layer.

Change-Id: I241529fad4c5b55c6abc55793f2d9c9693a03c18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242853
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-09-20 03:53:08 +00:00
Mike Klein
8dc7d6cb30 faster PNG encoding in skottie_tool
This trades a bit of file size for CPU time spent encoding,
making Skia dominate the profile.  Most of our other tools
use these same settings for the same reason.

Before:
    $ time out/skottie_tool -i resources/skottie/skottie-text-animator-4.json -w bar; du -sh bar
    1.53user 0.82system 0:02.35elapsed
    1.3M	bar

After:
    $ time out/skottie_tool -i resources/skottie/skottie-text-animator-4.json -w bar; du -sh bar
    0.49user 0.81system 0:01.31elapsed
    1.7M	bar
Change-Id: If00ca43d49e3f12d2e34e1a2b8e15158e6a76034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242498
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-09-18 16:10:23 +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
eec0199e15 [skottie] Avoid reshaping text unnecessarily
Only call into SkShaper when the text value changes.

Change-Id: I4c44a20fd48be932f9ffe23af5ebcc12b67956ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241077
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-09-12 21:18:37 +00:00
Florin Malita
2e4c283f78 [skottie] Clean up TextAdapter
Convert to DiscardableAdaptorBase, drop unneeded TextAnimatorList
wrapper, switch to raw pointer lambda captures.

TBR=
Change-Id: Idd43ad89a299ff344ff539b87cfb7790fef10b2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238441
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-09-03 15:29:36 +00:00
Florin Malita
f49cd70119 [skottie] Plumb square selector "smoothness" prop
Requires https://github.com/bodymovin/bodymovin-extension/pull/22

Change-Id: I2614aeefce18f4b3e6c6373cd5503a7696253a76
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238436
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-09-03 15:08:14 +00:00
Florin Malita
93edd9eb44 [skottie] Discard unneeded static text animators
Change-Id: I8751b1b1193726849e6ed3f127e32c17b8a7ed6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238443
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-30 21:09:08 +00:00
Florin Malita
165ca3f85b [skottie] Text selector ease-high/ease-low support
Change-Id: Ia879868df677cabca6d5fcd09845efdb6147ee8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238177
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-29 21:34:10 +00:00
Florin Malita
a58bbee8f7 [skottie] Refactor/generalize text selector shape generators
The main motivation for this change is getting *all* shape generators to
run the ramp through a cubic mapper - this will allow adding
ease-in/ease-out support in a follow up CL.

As a bonus, the new implementation is more straightforward and concise
(at the expense of dropping some likely-premature optimizations).

Change-Id: Ia2bc53525ae529c35300be124220b4d61e4fc474
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238061
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-29 18:56:23 +00:00
Florin Malita
511d2c281c [skottie] Disable text baseline snapping
Change-Id: I51ba09c78d200986a3116774f5dfd3a02bb597e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237523
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-27 21:24:21 +00:00
Mike Klein
48e08aa973 <ostream> -> <iosfwd>
<ostream> is one of the more expensive headers to include
and that's amplified by SkRefCnt.h's popularity.

We've been including <ostream> for sk_sp's operator<<.  That's only
used by Chromium and while we could just sprinkle in a bunch of .get()
calls and remove operator<<, when I started going through and actually
doing that I got the feeling I was making things pointlessly harder to
read and write, and wanted to find a way to make it actually work.

My next instinct was to template it without mentioning ostreams,

    template <typename OS, typename T>
    auto operator<<(OS& os, const sk_sp<T>& sp) -> decltype(os << sp.get()) {
        return os << sp.get();
    }

but that makes this operator<< ambiguous with some other templated operator<<
in GTest.  They got in first, so they win...

So ultimately, switch <ostream> to <iosfwd>.   Anyone using our
operator<<() presumably has <ostream> included already, and the #include
cost for <iosfwd> is small enough that I don't think we'll mind keeping
this around indefinitely.

To repro, look at before/after of -ftime-trace:

    ~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ -I. -Os -c src/core/SkCanvas.cpp -ftime-trace

I have tested locally that Chromium builds with this change.

Change-Id: I9decc2e65b5cc8fd07d8106a5eff81901aedd7d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237190
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-08-27 13:08:56 +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
Florin Malita
b9fb29f21e [skottie] Shaper downscale-to-fit vertical alignment mode
Introduce a new hybrid valign extension, kVisualDownscaleToFit (sk_vj: 4):

  - when the text shaped at the requested size fits within the box,
    center vertically (same as kVisualCenter)
  - otherwise, scale down until it fits (same as kVisualResizeToFit)

Change-Id: I8e096a49e2b87582e1bd42161657ec4ef561ebdf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235601
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-19 18:59:06 +00:00
Brian Salomon
9c73e3df83 Turn off -Wreturn-std-move-in-c++11
Change-Id: I127c979670c3dc7dac2e35908a795afbdefca8f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234902
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-08-15 17:45:58 +00:00
Florin Malita
feacb0fb34 [skottie] Add support for multiple range selectors
Text animators can have more than one range selector.

(depends on https://github.com/bodymovin/bodymovin-extension/pull/21)

TBR=
Change-Id: Id7f73386853f0e0f9e3c0f15d5a87ec1653ba873
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234319
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-14 17:34:02 +00:00
Avinash Parchuri
3a543aafd4 Reland "[skottie] Add onTextProperty support into PropertyObserver."
This is a reland of 2a558f5675

Original change's description:
> [skottie] Add onTextProperty support into PropertyObserver.
>
> This effectively allows observing/modifying properties at the text document level. By default
> Bodymovin exports even static TextDocuments as a single keyframe, so the unit-tests have been
> updated to store the property handles for verification.
>
> Change-Id: Iab8bcb29cdc5626d1abc34593ee9967b543428eb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231681
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

Change-Id: I3231607e469dcc321fa5900500a21f0f101c299c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232628
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-06 13:50:41 +00:00
Greg Daniel
08ada8eda6 Revert "[skottie] Add onTextProperty support into PropertyObserver."
This reverts commit 2a558f5675.

Reason for revert: breaking Test-Win7-Clang-Golo-CPU-AVX-x86_64-Debug-All-NativeFonts_GDI bot

Original change's description:
> [skottie] Add onTextProperty support into PropertyObserver.
> 
> This effectively allows observing/modifying properties at the text document level. By default
> Bodymovin exports even static TextDocuments as a single keyframe, so the unit-tests have been
> updated to store the property handles for verification.
> 
> Change-Id: Iab8bcb29cdc5626d1abc34593ee9967b543428eb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231681
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,aparchur@google.com,isabelren@google.com

Change-Id: I5298bb45cd12b86fb921aaf835b2340205fed1b5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232582
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-08-05 20:00:51 +00:00
Avinash Parchuri
2a558f5675 [skottie] Add onTextProperty support into PropertyObserver.
This effectively allows observing/modifying properties at the text document level. By default
Bodymovin exports even static TextDocuments as a single keyframe, so the unit-tests have been
updated to store the property handles for verification.

Change-Id: Iab8bcb29cdc5626d1abc34593ee9967b543428eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231681
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-08-05 18:20:59 +00:00
Florin Malita
66374f69e4 [skottie] Fix Venetian Blinds typo
TBR=

Change-Id: Ia6d802202e6b3dfe069e36a6daeb92bf4c49b873
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232123
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-02 23:33:03 +00:00
Florin Malita
17b9d1d1de [skottie] Initial Hue/Saturate effect support
Due to limitations in BodyMovin/AE JSX, full effect data is not
available (specifically the "channel range" property).

We only support static master hue, static master saturation and
static master lightness at this point.

This CL also introduces a new animation builder pattern:
DiscardableAdapterBase and attachDiscardableAdapter().

The former is a base class for adapters with full animator ownership.
This enables a) capturing raw adapter pointers in animator lambdas and
b) syncing to SG only once, after all local animators are updated).

The latter is a helper for managing adapter creation and optional
destruction (when all adapter properties are static we can discard it).

Change-Id: Iecc4b78830e5464e7958cb12cdfd75a61010aa25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231956
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-02 18:04:14 +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
80e7bd03d4 [skottie] Suppress placeholder range selector warnings
For text animators without associated range selectors, BodyMovin still
exports a selector entry with invalid (0) domain/shape props.

Suppress warnings for these, as they are expected with BM.

TBR=
Change-Id: I7ec3737ebc2a33f4ba6955975c50ea7bf116b003
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231481
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-08-01 17:18:31 +00:00
Avinash Parchuri
fe125a1103 [skottie] Rename TextValue to TextPropertyValue and make public.
This allows TextValues to be manipulated via the skottie::PropertyObserver API in a future change.

Change-Id: I96b22771d8ee9a90c8d41869ece814b0bfa4dc74
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230917
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-07-31 13:30:32 +00:00
Florin Malita
d17beec458 [skottie] Safe div-by-zero in LevelsEffectAdapter::apply
TBR=
Change-Id: I3bef9659d073a91d074e6f5a0e2873cdb16aad20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230978
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-30 22:06:59 +00:00
Florin Malita
d9a44101f2 [skottie] Fix property observer scoping for effects
Introduce AutoPropertyTrackers for each effect being built, such
that associated properties are correctly scoped to the effect name.

This ensures that e.g. the fill effect color property is dispatched with
the correct name.

TBR=
Change-Id: Idb2663503eb2c3805fb96edb0284754464f4fb94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227498
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Isabel Ren <isabelren@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2019-07-30 13:57:28 +00:00
Florin Malita
02f345f543 [skottie] Log warnings for missing glyphs
Extend SkottieShaper to return the number of missing glyphs.

Keep a handle to the client logger in TextAdapter.

Log warnings when missing glyphs are detected.

Change-Id: Ie958e5e0a391bffe9ece7033d0118cc546e4a9bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230196
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-07-28 15:30:07 +00:00
Florin Malita
426843323f [skottie,skshaper] Plumb an optional SkFontMgr in SkShaper/SkottieShaper
Skottie already takes an optional client fontmgr at load time, but
SkShaper(HB) currently uses the default fontmgr for fallback.

Plumb the Skottie font manager all the way to SkShaper.

This should give clients more control over font fallback, instead of
relying on the default SkFontMgr.

Change-Id: I3df16b3924a68d232573e25f9e526f523fc1dc08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230122
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-07-26 19:34:48 +00:00
Mike Klein
e172236e7b rewrite *.gn and #includes on CheckGeneratedFiles bot
In addition to checking .fp files, this ought to make this bot now also
check that our .gn files are formatted and our #includes are consistent
with rewrite_includes.py.

Some .gn files needed formatting; you can see the failure caught on PS 4.

Cq-Include-Trybots: skia.primary:Housekeeper-PerCommit-CheckGeneratedFiles
Change-Id: Ia6669581406212c986da81f2521e4e9d8d3eadb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229802
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2019-07-25 20:48:33 +00:00
Avinash Parchuri
ca2640423d Change the visibility of skottie::PropertyHandle constructor to public.
This allows for unit-testing of implementations of the Skottie::PropertyObserver
API, which are expected to act on the PropertyHandle.

Change-Id: If7a7518db1571523de688f2ca3d40862f8a68ada
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229880
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-07-25 19:31:12 +00:00
Florin Malita
fd91f6d1fb [skottie] Cleanup: track animator scoping in AnimationBuilder
Instead of passing an explicit scope all over, keep track of the current
scope in AnimationBuilder.

Removes a bunch or redundant plumbing.

TBR=
Change-Id: I9e587f4ae7a1d12f86d13f30144816492a4ce147
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229762
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-25 18:03:13 +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
1281ec3eec [skottie] Remove deprecated loadImageAsset API
TBR=
Change-Id: I95d5fdd9db0869afbe9cb3e4d2feafcb3b25f7af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228121
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-17 18:28:40 +00:00
Florin Malita
7a15a6e2c7 [skottie] De-dupe sequential cubic mappers
Detect and de-dupe repeating/sequential cubic mapers.

Also improve linear keyframe detection.

Change-Id: Ic7cc757ba9369416d4f1e5639e1c9fdf9e1e2c6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228117
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-07-17 17:14:46 +00:00
Florin Malita
dc02c3ed01 [skottie] Fix default cubic controls detection
C0 & C1 are swapped and being compared against the wrong defeault
values.

Swap again to avoid instantiating unnecessary SkCubicMappers.

TBR=
Change-Id: Ie26c28805b3b4517ca65f8e715e27a2eb65fe700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228061
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-17 15:56:36 +00:00
Florin Malita
eb24735ec5 [skottie] Pass asset IDs to ResourceProvider::loadImageAsset
Also use explicit IDs as keys for the image asset cache.

Change-Id: I359ff026063318ace524d1205b4f0b3e7a6e1d5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227783
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Isabel Ren <isabelren@google.com>
2019-07-17 01:08:05 +00:00
Florin Malita
5b181bfb2d [skottie] Use kF16ColorType layers for motion blur
This fixes the result quantization issue.

TBR=
Change-Id: I7b1f6e40792a4032f93aabc96beddaacf6d837c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227259
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-15 21:41:28 +00:00
Hal Canary
41248071ac tools: separate TimeUtils from AnimTimer
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>
2019-07-12 15:05:01 +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
0e1b0af175 [skottie] Motion blur fast path
Use the SkSG deferred blend mode isolation when possible.

This avoids per-frame layers when the frame content consists of single
draws.

Change-Id: Ia3581ffa421fc1651f0fe5637d34e8e645dcc22a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226077
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-09 14:07:42 +00:00
Florin Malita
5f1108ce46 [skottie] Motion blur support
Unlike all other Skottie effects, motion blur requires sampling at multiple
points on the timeline.

To support this:

  1) Introduce MotionBlurEffect - a custom SG render node which can drive
     the timeline of its subtree using an sksg::Animator.

  2) Introduce MotionBlurController to swap for a regular LayerController
     when needed.  MotionBlurController dispatches time ticks to
     MotionBlurEffect instead of directly to the layer animators.

The actual motion blur impl is based on
https://skia-review.googlesource.com/c/skia/+/221416.

Motion blur requires Lottie files exported with this BodyMovin patch:
https://github.com/bodymovin/bodymovin-extension/pull/15

Change-Id: I075e101ea91ec9aa300bac35ee810fd539f1aced
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225416
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-09 13:02:17 +00:00
Hal Canary
c74a55057b GM: s/handleKey/onChar/
Change-Id: I917de2705807f61e6a6c3f76d52e290e8194d204
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225936
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-08 22:28:50 +00:00
Florin Malita
60c84fdb18 [skottie] Clean up layer animator scoping
Most layer animators are scoped at the LayerController level - except for
animators related to layer transforms.

The reason for this exception is that dependent/child layers require up-to-date
transform chains even when the parent layer is inactive.

Currently, to escape LayerController scoping, layer transform animators
are stored directly in the parent (composition) scope.  This works fine
for the initial purpose, but discards layer->transform-animator ownership
info.

Upcoming features (motion blur) require knowledge of all animators associated
with a given layer, and the current scheme gets in the way.

To address this problem, update the layer controller logic to

  1) store all layer animators (including transform-related) in the controller
     scope
  2) always dispatch ticks to transform-related animators

No functional changes are expected.

TBR=
Change-Id: I60a443a51d11754dfbc953f28e57cb1c13c3d647
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225195
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-02 23:24:06 +00:00
Florin Malita
45dc1f0001 [skottie] Cleanup: split off layers into own CUs
TBR=
Change-Id: Ia6c27cca33f9dc8f242a50e624341dd0b465b380
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/224738
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-07-01 18:29:22 +00:00
Florin Malita
afd2c10c98 [skottie] Use hybrid bounds for custom Shaper VAlign modes
We used to rely solely on visual bounds for vertical alignment.  That
had the downside of leading/trailing empty lines being ignored.

Then https://skia-review.googlesource.com/c/skia/+/220916 switched to
using typographical bounds.  This approach produces results in line
with AE, but allows some glyphs to overflow the alignment boundary.

This CL introduces a hybrid approach:

1) for standard AE text alignment, continue to use typographical bounds

2) for Skottie VAlign extensions (sk_vj), use the union of typographical
   and visual bounds - this should mitigate both issues mentioned above

Change-Id: Ifd3ccae3d721728ce67942206160ebe92056d3a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/224188
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2019-06-28 11:35:09 +00:00
Florin Malita
d75fed41c2 [skottie] Use explicit font ascent in Shaper
Bodymovin exports an explicit ascent for each font, as a percentage of
the text size.

Change-Id: I25708944b2b79b42a6ccb05abbe002685e36dfa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223986
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-28 11:35:09 +00:00
Florin Malita
c1f5d8d0f4 [skottie] Handle empty lines in Shaper
SkShaper doesn't seem to like empty inputs.

TBR=
Change-Id: Iace3eef389051dcce229ed4ac6897344770d19c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/224190
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Auto-Submit: Florin Malita <fmalita@chromium.org>
2019-06-27 16:59:28 +00:00
Florin Malita
f803878add [skottie] Divide-by-zero in CameraAdapter::totalMatrix()
Annotate as safe.

Bug: skia:13879
Change-Id: Ia34d71dab5fc918bd8fe9eb8b2360cb5927ac075
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/224180
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-27 13:19:24 +00:00
Florin Malita
b0944553df [skottie] Venetian Blinds effect
Change-Id: I50e133dea448e044fef45379490cb85b39eea3bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223856
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-26 13:13:10 +00:00
Florin Malita
d7b321afa2 [skottie] Radial swipe effect
Implement radial wipe with a sweep gradient shader mask filter.

The implementation is slightly convoluted because edge feathering requires a real blur, which in turn requires content layer isolation.

So there are two distinct operation modes:

  - no feather -> draw the content directly into the dest buffer, with the mask filter
    deferred in SG context

  - feather -> draw the content into a separate layer, then blend (dstOut) the composed
    blur+shader mask on top

Change-Id: I253701aff42db8010ce463762252c262e2c5d92b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222596
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-21 14:03:45 +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
Greg Daniel
f91aeb259e Move a bunch of gpu files out of include/private and into src/gpu.
In GrRecordingContext I moved the auditTrail onto the heap and only there
when compiling for tests. This allowed us to move a lot of files out of
include private.

Change-Id: Ib76ac211c0c6fd10bacaccf0c5f93f21a59f35d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221344
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
2019-06-18 14:24:42 +00:00
Florin Malita
60e60dfc50 [skottie] Add support for motion tile phase
The motion tile phase is a one-dimensional shift, applied to every other
row or column (based on a selector property).

Implement using a masking shader (covering the static rows/cols),
and blend mode shader composition (srcIn for static/pass-through
rows/cols, and srcOut for phased rows/cols).

TBR=
Change-Id: I336c150e5d4900962dc2de801a4e1572cf4b5d59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221339
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-18 14:01:22 +00:00
Mike Reed
4b203ad7ac add motion blur params to skottie2movie
--motion_angle ... [default is 180]
--motion_samples ... [default is 1, for no motion blur]

Change-Id: Iec0f31655b3369f51e0b398efb2d5b156dcbaf2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221416
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-06-17 23:13:16 +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
Florin Malita
5fe7429bab [skottie] Fix layer transform vs. effects interactions
Turns out, in addition to solid layers, pre-comp and image layer
effects are also subject to layer transforms.

TBR=
No-Try: true
Change-Id: Ie235ff19374b8e0246eeec8e08079a2340e2a92a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221177
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-06-17 12:26:13 +00:00
Florin Malita
941b9ff09b [skottie] Effects cleanup pass
Split-off effects into separate CUs.

TBR=
Change-Id: Ic214027d27e1c341085d9a8c74f605caba260630
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221118
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-14 20:31:45 +00:00
Florin Malita
e47d8afabd [skottie] Add support for Transform distort effect
Yet another way to transform a layer, disguised as a distort effect.

TBR=
Change-Id: Ic2d5479fa6ae27b460de60875924f73f77fc7f71
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221001
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-14 16:58:31 +00:00
Florin Malita
87e8850388 Reland "[skottie] Use metrics for Shaper vertical alignment"
This is a reland of 084fa1b52f

Original change's description:
> [skottie] Use metrics for Shaper vertical alignment
>
> Relying on visual bounds yields incorrect results in some cases (e.g.
> leading/trailing empty lines).
>
> Update the vertical alignment logic to use metrics instead:
>
>   - track the first line ascent and last line descent
>   - compute content height as
>
>       first_ascent + last_descent + line_height * (line_count - 1)
>
>   - relocate Result::computeBounds() to the unit test (only user)
>
> Empirically, this causes top-alignment to be less snug (likely due to
> ascent slack in the tested fonts).
>
> Bug: skia:9098
> Change-Id: Ib92bf907af8889d6b0d0fda22ef41a2cc8b50901
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220656
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=
No-Try: true
Bug: skia:9098
Change-Id: Iaba53968840749e35b9c3ed04b15d6e2cda55e72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220916
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-14 02:47:04 +00:00
Herb Derby
ed8d13089d Revert "[skottie] Use metrics for Shaper vertical alignment"
This reverts commit 084fa1b52f.

Reason for revert: Breaks google3 roller

Original change's description:
> [skottie] Use metrics for Shaper vertical alignment
> 
> Relying on visual bounds yields incorrect results in some cases (e.g.
> leading/trailing empty lines).
> 
> Update the vertical alignment logic to use metrics instead:
> 
>   - track the first line ascent and last line descent
>   - compute content height as
> 
>       first_ascent + last_descent + line_height * (line_count - 1)
> 
>   - relocate Result::computeBounds() to the unit test (only user)
> 
> Empirically, this causes top-alignment to be less snug (likely due to
> ascent slack in the tested fonts).
> 
> Bug: skia:9098
> Change-Id: Ib92bf907af8889d6b0d0fda22ef41a2cc8b50901
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220656
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

Change-Id: I2da2bf9b3bc4a2f333c0fbbd5a88434ef7ea65d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9098
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220746
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-13 18:02:01 +00:00
Florin Malita
084fa1b52f [skottie] Use metrics for Shaper vertical alignment
Relying on visual bounds yields incorrect results in some cases (e.g.
leading/trailing empty lines).

Update the vertical alignment logic to use metrics instead:

  - track the first line ascent and last line descent
  - compute content height as

      first_ascent + last_descent + line_height * (line_count - 1)

  - relocate Result::computeBounds() to the unit test (only user)

Empirically, this causes top-alignment to be less snug (likely due to
ascent slack in the tested fonts).

Bug: skia:9098
Change-Id: Ib92bf907af8889d6b0d0fda22ef41a2cc8b50901
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220656
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-13 13:04:53 +00:00
Julia Lavrova
a3552c5e6d Reland "SkParagraph"
This is a reland of 10ad0b9b01

Original change's description:
> SkParagraph
>
> Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I46cf43eae693edf68e45345acd0eb39e04e02bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219863
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-06-11 17:20:36 +00:00
Florin Malita
920f6a9bdb [skottie] Animated text tracking support
Add logic to adjust glyph positions based on animated tracking properties.

This adjustment is applied post-shaping (it doesn't observe the text box),
and requires line re-alignment - thus it is being processed per-line.

Change-Id: Id44a295032a48c7216f126cb02dd2d2d5cc18ae3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220076
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-11 13:41:28 +00:00
Florin Malita
e695e53f1c [skottie] Add support for range selector domains
Range selector's "Based On" property controls how range indices map
to glyphs: characters, characters-excluding-spaces, words, lines.

To support this feature:

  - update SkottieShaper to track domain-relevant info per fragment
    (fLineIndex, fIsWhitespace)

  - update TextAdapter to build domain maps
    (domain index -> fragment span)

  - update RangeSelector to run its range indices through a domain map,
    if present.

Change-Id: I80e713f6beaa2578aa0eae1d1ddae8e1e47d8d10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219859
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-10 17:49:08 +00:00
Florin Malita
07e103fce8 [skottie] Range selector cleanup pass
Generalize the partial coverage logic to handle all three cases (left
edge, right edge, both edges), and remove the single-index
branch.

Also add some docs.

TBR=bungeman
Change-Id: I90af708f053d6d3eff154fc1309a5c1269a7eaed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219518
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-10 14:58:10 +00:00
Herb Derby
07cd38dc13 Revert "SkParagraph"
This reverts commit 10ad0b9b01.

Reason for revert: Breaks google3 build

Original change's description:
> SkParagraph
> 
> Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

TBR=borenet@google.com,djsollen@google.com,halcanary@google.com,bungeman@google.com,kjlubick@google.com,reed@google.com,drott@chromium.org,jlavrova@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I3f4ef2f34b7489d008c2fe92527d39fba0e16ff7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219858
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-10 13:16:53 +00:00
Julia Lavrova
10ad0b9b01 SkParagraph
Change-Id: I0a4be75fd0c18021c201bcc1edfdfad8556edeff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/192100
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2019-06-07 17:23:23 +00:00
Florin Malita
04462d12c8 [skottie] Fix text selector sub-unit range handling
The current logic modulates the shape generator output by its fractional
coverage, ignoring constant lo/hi contributions.

But RampUp/RampDown have non-zero hi/lo constant coverage, which needs
to be accounted for.

The correct behavior is to perform a 3-way weighted average of the
lo/hi/generator, based on their relative weights.

Change-Id: Ide0ed2ae590bbce2b56c0c65008b64632b987905
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218962
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-07 01:34:27 +00:00
Florin Malita
54c8411c27 [skottie] Fix zero-overlap selector handling
The current implementation applies constant coverage (outside selector
range) based on computed integral edges.

But the integral range is clamped to the valid index domain and its
extremes are always assumed to have partial coverage - so we never get
to constant-blit the full buffer when the interval is outside, which
can yield incorrect coverage for the first/last fragments.

Update the constant coverage logic to operate in full domain coordinates.

Change-Id: I23902674fe5e822081fb8262167511df1cc3463e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219206
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-06-06 16:09:39 +00:00
Florin Malita
711f39fb45 [skottie] Add support for RangeSelector shapes
Introduce square/ramp/triangle/round/smooth shape generators,
and use them to seed the range selector coverage pipeline.

Change-Id: Ib7b94ceecd2ccf66820f4dd2443fdd62e2ac6a1b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218828
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-06 13:51:11 +00:00
Florin Malita
1c44db15d1 [skottie] Initial text range selector support
Each animator can have multiple range selectors, whose combined "coverage"
modulates how the animator props compose with other/initial props.

Since there can be multiple animators with different/arbitrary selectors,
we compute independent property values for each fragment.

Supported features:

 - start, end, offset, amount
 - units: percentage, index
 - based-on: characters-only for now
 - mode: add-only for now
 - shape: square-only for now

Change-Id: If7fee46ffb29e1f92542822481ed699fd0b0b521
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218076
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-04 20:50:32 +00:00
Florin Malita
1d89b0d7e1 [skottie] Add support for scale and rotation text animators
The interesting bit here is a change in glyph positioning:
AE text animator transforms are to be applied relative to the glyph position.

To support this behavior, update Shaper to externalize glyph positioning
when in fragmented mode.  I.e. instead of baking glyph positions in blobs,
apply them at the scene graph transform level (such that they compose with
animated transforms correctly).

Change-Id: I9aeb5e6f8c1ec1a2c8b5351e8fc2a73d4bdf5cad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217556
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-31 20:41:19 +00:00
Florin Malita
e57546bb78 [skottie] Add support for opacity text animators
Change-Id: I76da8745ccd714cb8457000d9cd208e62f1058ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217536
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-05-31 19:50:59 +00:00
Florin Malita
96b95f911c [skottie] Initial animated text properties support
Limitations:

  - no range selectors (applies to the whole text)
  - only position, fill color and stroke color for now

Change-Id: I91e88a6107c5f66687c1c27f27a71be3914bde25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217386
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-05-31 18:41:13 +00:00
Florin Malita
0fe004c14c [skottie] Shaper: fission glyphs into separate fragments when needed
In the presence of animated text properties, we want the Shaper result
glyphs to be split into separate fragments.

Add a Shaper flag to request this mode, and upate the logic to emit
one fragment per glyph, when active.  Otherwise fall back to the
current/consolidated blob mode.

Change-Id: If7440e5fa1ae2f8855984d3ae4d6852b10b2316c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216879
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-30 17:05:00 +00:00
Florin Malita
eca7315109 [skottie] Add a Shaper line buffer
Instead of committing glyphs directly to SkTextBlob buffers, accumulate
data for a full line before passing to the builder.

For now this doesn't have any effect (other than making a data copy),
but the intermediate buffer will be used for

  a) post-shaping adjustments (justification, tracking?)
  b) multi-blob/fragmented shape results

Change-Id: I45796ef2fd491a14322c32672137ac90138f36ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216686
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-05-29 22:10:05 +00:00
Florin Malita
1f02e84885 [skottie] Add support for more font weights
Also shuffle the search order to better match use frequency.

Change-Id: I8ba7f5474f0937aecb75215a1129b439f89a7dbf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216357
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-05-28 21:11:21 +00:00
Florin Malita
a8d18191b5 [skottie] Support multiple text fragments
In preparation for text range selectors, update Shaper and the text
adapter logic to deal with multiple text "fragments".

 - Shaper::Result is now an array of (blob,pos) tuples

 - TextAdapter builds an arbitrary number of scene graph nodes, based on
   the Shaper fragments

Change-Id: I0f2ed86da77e9aaf22b9cb138c3a5f8f957393fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216403
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-28 18:31:32 +00:00
Florin Malita
de7e074e81 [skottie] Shaper::VAlign::kResizeToFit should also scale line height
When fitting the shape result to a box, scale both the font size and
line height by the same factor.

This produces more intuitive results.

Bug: skia:9129
Change-Id: I742a952b9615216a2b68c0432b41026751099cbc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216220
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-27 15:15:00 +00:00
Florin Malita
46f2b58d86 Reland "Active layer excludes outPoint"
This reverts commit a4b837971c.

Reason for revert: Google 3 roll should pass now

Original change's description:
> Revert "Active layer excludes outPoint"
> 
> This reverts commit 87224bbed6.
> 
> Reason for revert: Speculative revert for Google 3 roll
> 
> Original change's description:
> > Active layer excludes outPoint
> > 
> > Exported AE layers outPoint is exclusive
> > 
> > Change-Id: Ie53954ef8df3938e13f2241b649429775553aa59
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215432
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> 
> TBR=fmalita@chromium.org,isabelren@google.com
> 
> Change-Id: I17f6a66f3165983b8c082e9324b042d75818d987
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215781
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

TBR=brianosman@google.com,fmalita@chromium.org,isabelren@google.com

Change-Id: I69211dbc6351b2ad91304890cce84c8f15ae6c21
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216043
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-24 23:25:17 +00:00
Florin Malita
3fdc05a334 [skottie] Always use explicit text line height
Line height is always specified for JSON text values, there is no need
to treat as optional or have a fallback based on font metrics.

Change-Id: I468666e82dab74203fee985503c020217e0d4db8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215829
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-24 18:05:37 +00:00
Florin Malita
1e8f6e2372 [skottie] Add kBottom text alignment extension
Introduce a new Shaper::Valign enum to support aligning the shaped text
visual bottom with the text box bottom.

This option corresponds to JSON prop sk_vj: 2.

kResizeToFit (used to be sk_vj: 2) is now bumped to sk_vj: 3.

Change-Id: Ib1621a21a42bfc21c99826e203c587a3fdc663dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215821
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-24 15:28:01 +00:00
Brian Osman
a4b837971c Revert "Active layer excludes outPoint"
This reverts commit 87224bbed6.

Reason for revert: Speculative revert for Google 3 roll

Original change's description:
> Active layer excludes outPoint
> 
> Exported AE layers outPoint is exclusive
> 
> Change-Id: Ie53954ef8df3938e13f2241b649429775553aa59
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215432
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Florin Malita <fmalita@chromium.org>

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

Change-Id: I17f6a66f3165983b8c082e9324b042d75818d987
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215781
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-24 02:00:46 +00:00
Florin Malita
e85067f29d [skottie] Clamp seek() to the valid frame range
AE's valid frame range for a given composition/layer is
[inPoint,outPoint).  That is, a given object is not active at outPoint.

https://skia-review.googlesource.com/c/skia/+/215432 started enforcing
this for layers, but the side effect is seek(1) now produces blank
frames.

This CL pins t in the [inPoint,outPoint) interval, to guarantee a valid
frame.

Change-Id: I6e0001f284b85fe733e30469a7a7947818c1e07e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215681
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-23 19:53:50 +00:00
Isabel Ren
87224bbed6 Active layer excludes outPoint
Exported AE layers outPoint is exclusive

Change-Id: Ie53954ef8df3938e13f2241b649429775553aa59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215432
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-23 18:58:49 +00:00
Avinash Parchuri
0d380182d5 Apply layer in-point as a negative time-bias for multi-frame image assets.
The time argument to skottie::ImageAsset::getFrame() is expected to be relative to the in-point of the layer.

Change-Id: I9299e07af2254353e0799a827813c1bd75bdec26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213800
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2019-05-17 14:24:17 +00:00
Florin Malita
4f6eb15178 [skottie] Add resize-to-fit text alignment extension
Introduce a new SkottieShaper VAlign option (kResizeToFit), to scale the text
size for the best box fit.

The basic idea is to perform a binary search on the font size, until
the shaped text fits snuggly within the specified box.  The search is
focused on height, as horizontal fitting is assumed to be handled in
SkShaper.

Change-Id: I56269e02dda7a34e4ef3b79c205ea651b909f370
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212962
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-09 16:03:39 +00:00
Florin Malita
a50484a570 [skottie] Text line height support
Change-Id: Id5b52e7586aa42400162fd227add28d6ebf3ac11
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212728
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-08 19:27:52 +00:00
Florin Malita
ca449d5899 [skottie] Cleanup: relocate text sources
Move text-related sources to a dedicated 'text' subdirii, and drop
"Skottie" src prefix.

TBR=
Change-Id: I4f8d1633d649d371f76840405b6e567bd93f0c00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212724
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-05-08 14:36:07 +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
8b7768d206 [skottie] Relocate "GMs" to resources/
... to make them available on test bots.

TBR=mtklein@google.com

Change-Id: I107a042fbd20c673e964273291ce8c060c522a59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211991
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-03 16:14:46 +00:00
Ben Wagner
0b9b1f1847 IWYU for SkTLogic.h
Noticed that there was an include for <array> in there that didn't make
a lot of sense, so cleaned up the others which are hanging around from
older code which was in there.

Change-Id: I77acbb0914989e9bf67ab74dfd842a798ea592f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206172
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-02 21:17:37 +00:00
Ben Wagner
d1701ba884 IWYU for gms starting with 'a'.
There is still a bit of manual mucking about with iwyu output to get
things nice, but the checker seems to be doing ok and the process is now
a bit easier. Will see how it goes.

This also pointed out the amount of code behind ifdefs should be
minimized by using the build system and 'constexpr if' when possible.

Change-Id: Ic63fa33c65e5ff40b58858e15fc51f27d862e20d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211349
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-04-30 19:39:37 +00:00
Florin Malita
836ff5e405 [skottie] Mask feather support
Wrap mask nodes with a sksg::BlurImageFilter to implement the feather
(blur) effect.

Requires assets exported with https://github.com/bodymovin/bodymovin-extension/pull/13.

Change-Id: Ia7809a73582f6ed4e55c88a26b5fe36a52cbb749
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211340
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-30 15:20:18 +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
Florin Malita
7cd5ea0a63 [skottie] Fix camera z-rotation
Flip z consistently.

TBR=reed
Change-Id: I910d6e2ae4cc21992b5b5c3acb5c4074b1e4204e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210382
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-25 15:28:00 +00:00
Florin Malita
b783a43f0d [skottie] Fix 3d rotation order
TBR=reed
Change-Id: I07263ad7ef0b86ce1ace19d68f3f3b08cfd76dfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210300
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-25 00:29:35 +00:00
Ben Wagner
f460eeec99 Use linear metrics flag for linear metrics.
Now that no one is using the linear metrics flag directly, change the
meaning from 'no-hinting and subpixel positioning at an odd size when
measuring and just no-hinting when drawing' to meaning 'use linear
metrics'.

This also changes the font hosts to no longer use subpixel positioning
as a proxy for this value. This fixes outstanding bugs in Chromium about
getting the right metrics for hinted fonts.

Change-Id: I033b3d5ad431eba906a89cc0fefc59cd6702a02c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209174
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-04-24 22:48:48 +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
e1c275e360 [skottie] 'Add' layer blend mode support
BM now exports an enum for 'add' blending [1]. This corresponds to
SkBlendmode::kPlus.


[1] 86874c1018

Change-Id: I3c9a52e4055563f50bb68f460eda27fed1c4a411
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208220
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-15 17:47:39 +00:00
Brian Osman
eec1e9e4f1 Even more DLL build fixes
These changes let us build a non-official component build on Windows,
using either MSVC or clang

Change-Id: Ia3279aa19e007e70ff28925ff70a0bfe8144d96f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207307
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-10 21:02:40 +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
347a9709bb Reland "[skottie] More snug kTop Shaper alignment"
This reverts commit 80658204f4.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Revert "[skottie] More snug kTop Shaper alignment"
> 
> This reverts commit 7ef3e14516.
> 
> Reason for revert: TSAN failures (HB?)
> 
> Original change's description:
> > [skottie] More snug kTop Shaper alignment
> > 
> > The current implementation relies on SkShaper ascent values for top
> > text box alignment, but the results are not as visually accurate as AE
> > (or Lottie).
> > 
> > Use the computed tight bounds instead.
> > 
> > Change-Id: I4447a834fe3cae398fc887766daa68802e7f50a5
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206684
> > Reviewed-by: Ben Wagner <bungeman@google.com>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> 
> TBR=bungeman@google.com,fmalita@chromium.org
> 
> Change-Id: Icdcca2f6a7b33c8366c1118be2e842ff3978c8bd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206911
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

Change-Id: I8b72a30b7c2d6d6918f768e59e5d7c987ed5c147
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207300
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-10 20:27:34 +00:00
Brian Osman
ca9465688f Make Skottie's GN setup more DLL friendly
Skottie doesn't currently build with is_component_build=true. Trying to
build a DLL with skia_enable_skottie=false failed, because we ended up
with a component("skottie") that had no sources. That led to fallback
linker behavior, but no DllMain.

To solve this, and simplify things, move the skia_enable_skottie checks
to the outer scope, and simply replace all the referenced components
with empty groups when it's not enabled. Also fix some fm code that was
assuming it was always enabled.

Change-Id: I4a47d80d882e6c557ee14b34255e22e09292cc8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207302
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-10 18:35:25 +00:00
Florin Malita
80658204f4 Revert "[skottie] More snug kTop Shaper alignment"
This reverts commit 7ef3e14516.

Reason for revert: TSAN failures (HB?)

Original change's description:
> [skottie] More snug kTop Shaper alignment
> 
> The current implementation relies on SkShaper ascent values for top
> text box alignment, but the results are not as visually accurate as AE
> (or Lottie).
> 
> Use the computed tight bounds instead.
> 
> Change-Id: I4447a834fe3cae398fc887766daa68802e7f50a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206684
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

Change-Id: Icdcca2f6a7b33c8366c1118be2e842ff3978c8bd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206911
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-09 17:37:21 +00:00
Florin Malita
7ef3e14516 [skottie] More snug kTop Shaper alignment
The current implementation relies on SkShaper ascent values for top
text box alignment, but the results are not as visually accurate as AE
(or Lottie).

Use the computed tight bounds instead.

Change-Id: I4447a834fe3cae398fc887766daa68802e7f50a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206684
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-08 22:48:08 +00:00
Florin Malita
774aeba9d0 [skottie] Add support for pre-decoding images at load time
Some animations use humongous images which thrash Skia's resource caches
at raster time.

To avoid that, we can

1) force decoding upfront, when the animation is loaded

2) clamp the image size to something reasonable (2K^2)

Add a flag to support this operation mode, and enable for Skottie/WASM.

Change-Id: Id2f127a5200b812b87e588904393d82c80452aa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206179
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-04-05 16:30:22 +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
Florin Malita
9a9e723f02 [skottie] Add support for (non-standard) v-centered text
Introduce a Skottie JSON extension for controlling vertical text
alignment ("sk_vj"), with a single public value for now: 1 (centered).

Refactor SkottieShaper to handle vertical adjustments based on a VAlign
enum:

  kTop         - the topmost line is ascent-aligned with the box top
                 (AE text-box behavior)
  kTopBaseline - the topmost line is baseline-aligned with the top box
                 (AE text-point behavior)
  kCenter      - the text center is aligned with the box center
                 ("sk_vj": 1, Skottie extension)

Also externalize the vertical adjustment as a text blob offset (instead
of baking into blob glyph offsets).

Change-Id: I29a414d4c6ccfafc534ca7b61f48ef96d8cff86e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205590
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-03 13:06:14 +00:00
Brian Osman
4428f2c39f Remove SkScalarSinCos
This differed from the separate versions in that it snapped to zero.
It was also strictly worse than calling the two separate versions.
Most clients don't need the snapping, so just call the two existing
functions. For clients that need the snapping, call new variants of
each that do snap.

Change-Id: Ia4e09fd9651932fe15caeab1399df7f6281bdc17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205303
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-04-02 15:46:57 +00:00
Ben Wagner
3bdb69c55f Clean up shaper handler.
Change-Id: Icb741ba9013747528e893c94df3b9242562028ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205341
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-02 14:56:26 +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
8dd5ea1a75 [skottie] Allow extra-normal Bezier interpolation
AE/Lottie allow Bezier control Ys to be outside the [0..1] range.

Update SkCubicMap to do the same.

Bug: skia:8931
Change-Id: I54ee8dbb4e6e0a33a917500523c82fe56c854d4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205002
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-29 18:23:03 +00:00
Florin Malita
20678f822b [skottie] Tweak Shaper test tolerances to fix NativeFonts bots
TBR=bungeman@google.com
Change-Id: I70ac3a993f1eaee57b074c493eaa70ba9adbf20d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204780
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-28 23:09:52 +00:00
Florin Malita
01fe263606 [skottie] Add support for BodyMovin 5.5.0 keyframes
BM 5.5.0 introduced a change in the keyframe format (dropped redundant
start/end value repetitions).  This updates the parser to support the
new format.

TBR=reed@google.com
Change-Id: I44efc54b60d08574ab649b0da90336dbd0e40391
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204740
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-28 22:50:32 +00:00
Florin Malita
0d33eac1aa [skottie] Compute tight bounds in skottie::Shaper
Instead of relying on conservative text blob bounds, update
Shaper::Result::computeBounds() to be more accurate.

Also add a skottie::Shaper unit test.

Change-Id: Icf17afcc814329197825e8d404416b6b7060c79d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204480
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-28 19:02:50 +00:00
Daniel Bratell
78a282f49b Add an include guard to SkottieShaper.h
SkottieShaper.h was not protected against multiple inclusions in the
same translation unit.

Change-Id: Ie1f5acbcab82b9b1c37868739fb4322c471886cf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204421
Auto-Submit: bratell <bratell@opera.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-28 13:05:02 +00:00
Florin Malita
0ed4c37634 [skottie] Fix handling of hidden shapes and layers
TBR=reed@google.com

Bug: skia:8923
Change-Id: I5bd1d4f2ef62ebd95cfae0fe3665960b07ed4ae1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204082
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-27 13:17:48 +00:00
Florin Malita
f4e8733947 [skottie] Relocate text shaping utils to separate compilation unit
Introduce AE-specific text shaping abstractions, and move the existing
implementation to a separate CU.

Change-Id: I8533ed8d9c59af6d82b3f1ca66a6e1d50a3c33c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203706
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-26 20:34:02 +00:00
Ben Wagner
7415a422ac Replace SkSpan with Range in shaper reporting.
This allows for using non-contiguous input in a future api for shaper.
This change forces cleanup of error handling when doing low level
shaping, which prompts cleaning up the correct shaper code to make the
control flow more obvious.

Bug: skia:8906
Change-Id: If084e0dd88e2f3a9651551ceeff87480e87fb998
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203465
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-03-25 20:26:50 +00:00
Mike Klein
5b3f343d25 DEFINE_int32 + DEFINE_uint32 -> DEFINE_int
There's really no big benefit to distinguishing these.

Change-Id: Ib329d32b1fc43e98ba40658cfea37261203ecdb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202801
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-21 17:20:19 +00:00
Mike Klein
84836b799a moar static flags
Like any normal variable, flags can be made file-scoped static,
and like any normal variable, mostly they should be if they can.

This CL converts most flags to be static, if only so that the
ones that do cross files stand out more clearly, and so that
there's more examples of static flags through the codebase for
people to ape.

Change-Id: Ibb5ddd7aa09fce073d0996ac3ef0487b078b7d79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202800
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-21 17:07:13 +00:00
Mike Klein
cd5104e942 SkAnimTimer -> AnimTimer
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>
2019-03-20 18:26:35 +00:00
Mike Klein
ea3f014e2b sk_tool_utils -> ToolUtils, and git clang-format
sk_tool_utils doesn't really fit the naming convention
the rest of code under tools/ tends to use.

Change-Id: I45326a174101c6eb4b6149e9c742f658f2fd23b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202313
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-20 18:05:42 +00:00
Mike Klein
0cffcbf97b de-Sk tools/font, and git clang-format
Change-Id: I0326eb9cc1e1e38b0fdc417567987a595f9021d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202310
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-20 17:36:52 +00:00
Mike Klein
88544fbe63 remove Sk prefix from CommandLineFlags
The command line flag package is tool-only, not part of Skia per se,
and does not need an Sk prefix to avoid naming conflicts.

And git clang-format.

Change-Id: Ida8477779e51750ed0475590ed2454841b23d6ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202307
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-20 17:13:22 +00:00
Florin Malita
7b49eeb496 [skottie] Turn on AA for solid layers
TBR=reed

Change-Id: I8b7b73516eeb7acb5412ad61d6fcbe92dbe10525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201467
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-19 22:16:48 +00:00
Florin Malita
e3e8da5e52 [skottie] Initial camera support
Camera layers introduce a top-level 3d camera/view matrix based on their
transform properties:

  * position - camera location
  * point of interest (stored as anchor point by BM) - camera direction
  * rotation - camera orientation

The perspective degree is controlled by a "zoom" camera property (which
corresponds to the view distance), and the composition dimensions.

Current limitations:

  * single camera track/layer
  * affects all layers (not just 3d-tagged layers)
  * parent layer transforms are likely not applied correctly

Bug: skia:
Change-Id: Ifc1b8b699ff09fa13b4804d18546b444d02e81c2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201651
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-19 19:49:12 +00:00
Hal Canary
c25f4e9eaa GN: split out skia_*_public from skia_*_sources
`gn check` passes.  We will work towards removing `check_includes = false`.

Change-Id: I0ab396fadaf31a166921bdea334b2cfedca23dcd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/195363
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-03-15 18:29:19 +00:00
Florin Malita
b9008539c5 [skottie] Initial text box support
AE supports two text layout modes [1]:

  * point text: text is laid out on an infinite line, starting at the given position,
    and observing explicit line breaks only; in this case the text baseline is at the
    given position.

  * paragraph (box) text: text is laid out within the given box, using line breaks to
    fit.

This CL implements the latter mode, in addition to the already supported point mode:

  - parse & plumb the text box info
  - update the text adapter logic to use SkShaper's width-constrained shaping mode
  - tangentially, fix sksg::TextBlob's bounds computation

[1] https://helpx.adobe.com/after-effects/using/creating-editing-text-layers.html

Bug: skia:8849
Change-Id: Ifdb34e39eef84d10fd75870aef785e3ee960a19c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201387
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-15 14:39:17 +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
c5664425bb [skottie] Fix Gaussian blur repeat edge pixels semantics
Repeat edge pixels: on  -> kClamp_TileMode.

Repeat edge pixels: off -> kClampToBlack_TileMode.

Bug: skia:
Change-Id: Id2096ad90d31b47e7041a502ded959b67c719a5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199923
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-11 19:16:02 +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
4025710b75 [skottie] Use std::chrono for load time stats
Bug: skia:8803
Change-Id: I56a6596a62557ed994c2ff1161367532f405a08e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198601
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>
2019-03-07 15:32:39 +00:00
Florin Malita
34336e3633 Make SkCubicMap immutable
Drop setter, only keep the parameterized constructor.

Change-Id: I31517df23688b8bd7485bf70c9c055cd1c87edcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198245
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-03-06 22:55:08 +00:00
Florin Malita
f12d675179 [skottie] Shape blending mode support
Starting in v. 5.4.4, BodyMovin also supports/exports per-shape
blending modes.

Change-Id: I9827f1db11df207da62bfb0de724e62489ed9255
Reviewed-on: https://skia-review.googlesource.com/c/195365
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-26 18:48:25 +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