Commit Graph

548 Commits

Author SHA1 Message Date
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
Robert Phillips
37a59ef1af Revert "Shuffle SkSL sources around so compiler and bytecode can be used w/o GPU"
This reverts commit 90507286cc.

Reason for revert: Seems to be breaking some builds

Original change's description:
> Shuffle SkSL sources around so compiler and bytecode can be used w/o GPU
> 
> Change-Id: I7236a30040ab532086e68d6e9de2898dd7acaa32
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221098
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>

TBR=mtklein@google.com,kjlubick@google.com,brianosman@google.com,ethannicholas@google.com,reed@google.com

Change-Id: Ie230315a72ebcfae32bc9ce7bafec1f87106cff2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221536
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-06-18 11:35:18 +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
Brian Osman
90507286cc Shuffle SkSL sources around so compiler and bytecode can be used w/o GPU
Change-Id: I7236a30040ab532086e68d6e9de2898dd7acaa32
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221098
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-06-17 21:16:18 +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
Brian Osman
08a8496135 Interpreter: Simplify interface quite a bit.
Slightly sharper, but far easier to hold:

- Remove Value union from interface, everything is a 32-bit
  value type, or a collection thereof.
- Collapse to one version of Run (that takes count), and make
  it a member on ByteCode.
- Similarly, move disassemble to ByteCodeFunction.

Change-Id: I07c85e65991178b3f52e20e815c25f36bc9c4257
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220753
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-06-14 16:04:58 +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
f39124b076 Baseline for empty text
Change-Id: I7c172bfb8f35f684030489f75cd997acdbbe3a75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220298
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-06-11 21:49:49 +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
Herb Derby
7a1bf99935 Revert "Build fix"
This reverts commit 14c8ca93db.

Reason for revert: This and original cl are breaking google3

Original change's description:
> Build fix
> 
> Change-Id: Ifd64425e6c8bc1a51b4617f043b828acafeb4368
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218966
> Commit-Queue: Julia Lavrova <jlavrova@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

TBR=bungeman@google.com,jlavrova@google.com

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

Change-Id: I655f1da3d9c08994c210fff3ee9310288a248895
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219856
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-10 13:03:07 +00:00
Herb Derby
607c6d9c86 Revert "Try to fix include problems for skparagraph"
This reverts commit cc82972af1.

Reason for revert: Part of the chain of cls breaking Google3

Original change's description:
> Try to fix include problems for skparagraph
> 
> Change-Id: Id98790de9364093dbcd6948c00c192ad0bb01882
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219573
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Herb Derby <herb@google.com>

TBR=herb@google.com,jlavrova@google.com

Change-Id: Ib2000566a9764dab2dd46f0a4ed0877be1b7f1d5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219857
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-10 12:44:44 +00:00
Herbert Derby
cc82972af1 Try to fix include problems for skparagraph
Change-Id: Id98790de9364093dbcd6948c00c192ad0bb01882
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219573
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-09 22:00:04 +00:00
Herb Derby
9577f01ba0 Revert "Add FontCollection.h to gni"
This reverts commit 9e1e8caff3.

Reason for revert: ooops it was in includes

Original change's description:
> Add FontCollection.h to gni
> 
> Change-Id: I0e720d6cf023303328fd68ce70e09a81e61088f2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219697
> Commit-Queue: Herb Derby <herb@google.com>
> Reviewed-by: Herb Derby <herb@google.com>

TBR=herb@google.com,jlavrova@google.com

Change-Id: I4c2c08765ed3502323af028fe0aeb57472db7de0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219756
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-09 13:59:48 +00:00
Herbert Derby
9e1e8caff3 Add FontCollection.h to gni
Change-Id: I0e720d6cf023303328fd68ce70e09a81e61088f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219697
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2019-06-09 13:24:20 +00:00
Julia Lavrova
14c8ca93db Build fix
Change-Id: Ifd64425e6c8bc1a51b4617f043b828acafeb4368
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218966
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-07 18:48:22 +00:00
Brian Osman
8016441e20 Interpreter: Refactor interface and lifetime management
Interpreter is now just a namespace with Run and Disassemble. This hides
all of the implementation details. In addition, the interpreter only used
the Program because of a few details in FunctionDeclarations - scrape that
when constructing a ByteCodeFunction, and we don't need to keep the entire
Program alive, just the ByteCode. Adjust tests to ensure that this works.

Change-Id: I61efe4fe986476afedbd295d3d55b2a326fea4e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219521
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-06-07 18:47:22 +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
Kevin Lubick
d6ba725da3 [canvaskit] Save a copy by using SkVertices::Builder
Change-Id: I7a01f97d57c37b7198b7f4fbb966c785ab998861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217898
Reviewed-by: Mike Reed <reed@google.com>
2019-06-03 18:41:00 +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
Ben Wagner
89799efe58 Document SkShaper::RunHandler::Buffer
This at least documents the current behavior. There exists tension between
users who just want positions and those who also want advances, which
requires this to be overly clever. Perhaps a better solution can be
found.

Change-Id: Ic2166ca294003da3325a0fe068ef84cdef9f804d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217259
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-30 23:06:02 +00:00
Mike Reed
c72216583d share tiny bit of code for std language iter
Change-Id: I928ba956c1ff038332d7c7497fe5fc0c297f4f22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217140
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-30 19:10:44 +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
Ben Wagner
bd8c724fd4 Correct shaper assert around iterator fonts.
The assert here was intended to catch the case where a font run iterator
produced a font without specifying a typeface. This should never happen.
However, it is currently fine for the user to pass in a font without
specifying a typeface, which really means they don't care.

Change-Id: Ib63430142b9a05b4f2f8603e7a56a0ac09fa219f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216874
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-05-30 14:47:58 +00:00
Ben Wagner
e8db325168 Add trivial implemenations of shaper run iterators.
Change-Id: I71f9cf2971cdb44ae2d189e29afc2ab330750dcb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216780
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-30 13:19:28 +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
Mike Reed
dc2b98fd29 simplify setColor, without needing the 4f or the colorspace
Change-Id: I7f6fe83cfb653819c1b5d865421f4fd2121e9b4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212418
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-20 16:59:26 +00:00
Brian Osman
4c63a1eada Particles + Interpreter: Bind particle's SkRandom to "rand"
Update sample effects to use that (and remove the need for the
hacky workaround "random -> frame" affector I was using).

Current perf on my workstation, 6k particles updating:
native: 0.67 ms
interp: 0.97 ms

Change-Id: I3a2168c210d7431ffffe2b87ab6adade69f1dce7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214190
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-17 14:29:22 +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
Ben Wagner
6bb79bbfdc Add SkShaper which just shapes.
This adds and SkShaper which doesn't wrap or re-order. This allows for
users to write their own implementations of shape-then-wrap logic.

Change-Id: I8bd8931ac9534c33883fc303be25f379c02da4b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213829
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-15 15:37:08 +00:00
Brian Osman
e246b13a1d Only enable the interpreter particle affector with GPU support
Workaround for the SkSL sources being part of the gpu component in GN,
causing link errors in CanvasKit CPU builds. Better solution is to move
the SkSL interpreter into a separate component.

Change-Id: I0438d8eff16f335eb07ff557f7917697767c58f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212987
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-05-09 20:32:06 +00:00
Brian Osman
c04cadbb6e Prototype interpreter particle affector
Change-Id: Ib440570ecbd46b5bc98d346592cbbb72f58ae85a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212500
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2019-05-09 18:37:46 +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
Ben Wagner
51e15a69ce Use SkTextEncoding enum instead of macros.
Change-Id: I4b6259590fa0693ee0522b4999a1c0fe250b173d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212504
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-07 20:54:16 +00:00
Kevin Lubick
0921c10404 [canvaskit] 0.6.0
Change-Id: I4c408a8b711421856a14d67cee121512f7e06900
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212190
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-05-06 17:47:09 +00:00
Kevin Lubick
d6b32ed39d [img-decode] Start on proposed new spec
This adds readPixel and a partial stub of window.createImageData

Change-Id: Iee992312b9331b71852fe2198f844a7e4ae9e963
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211344
Reviewed-by: Mike Reed <reed@google.com>
2019-05-06 17:39:19 +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
Mike Reed
e869a1ed96 stop calling legacy 255-biased colormatrix
... but keep the apis for now

Bug: skia:4872
Bug: skia:9012
Change-Id: I3a9b0c9194be6897c0e59b7edd972b7218168183
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211343
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-30 16:59:36 +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
Mike Klein
ba201aea74 make -Werror or /WX optional, off by default
Most external users complain about -Werror,
and I've heard anecdotally that devs find it annoying too.

This turns it off by default, but keeps it on the bots.

Change-Id: I6e87c92215261ebf6e961f816177386d5d58f28e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209787
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-23 20:39:34 +00:00
Brian Osman
c3186302bd Add skcms directory to public includes
skcms is part of Skia's public API now. This attempts to recognize that,
and pave the way for moving the header to another location more easily
in a follow up CL, or - at a minimum - for clients that redistribute
Skia as a library + includes to relocate the skcms.h header as part of
that.

Change-Id: I15da63b0d4ab8916a71fb7e6ab3656db87252707
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209640
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-22 20:32:23 +00:00
Kevin Lubick
0e3342cfcd WASM build cleanups
Fix debugger includes (broke on https://skia-review.googlesource.com/c/skia/+/208226)

Fix canvaskit building w/o fonts

Change-Id: I1279d92ee1ac749a974830e75b41e97e9f75f578
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/208515
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-04-16 17:48:53 +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
c85f8e8dda Include particles in shared Windows builds
Avoids double-compiling SkTextUtils (with different settings),
which is already in the dependent 'skia' target.

Change-Id: I3f803e7ebcc0787b8b47a85d2a5a52fd8e0778db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207866
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-12 15:05:57 +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
c725e8f7ea Make SkShaper's GN setup more DLL friendly
Similar to the Skottie refactor that just landed, this avoids having an
empty component when shaper is disabled (which turns into a DLL with no
sources, and a missing DllMain). I think this pattern of having modules
expose the same components as empty groups is simpler (and also fixes
the fact that only two of N references in top-level BUILD.gn were
guarded). Also, no one is using the define?

Change-Id: I9d25c1cfbd42336874f4428bf61f3e34a4a18d3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207303
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-10 18:59:35 +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
Mike Reed
b286bc2da8 Introduce new factory for SkColorFilters
Idea: transition callers to this, so we can later typedef SkColorFilter
and SkShader to the same thing.

Bug: skia:8937
Change-Id: I000c882e11622091aa44c141aa6ddd1216414f46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206685
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-08 21:03:59 +00:00
Kevin Lubick
09d022cbb8 [pathkit] build with newer emscripten
Bug: skia:
Change-Id: I5576ec94cae42dd0e03079321e61f71292350808
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206389
Reviewed-by: Eric Boren <borenet@google.com>
2019-04-08 13:56:18 +00:00
Kevin Lubick
c7755d9470 [canvaskit] Bump GPU resource cache to 256MB
Wrong file was previously edited.

Change-Id: I2e78d102ca85a22268481d1958b983e41d72ee3e
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206271
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-05 18:06:18 +00:00
Kevin Lubick
cc13fd3d6c [CanvasKit] Add basic support for SkPicture
Can dump SkPicture to an skp, but only for debugging purposes
(no deserialization).

Bug: skia:
Change-Id: I37f3c4dcfdd70b665748773ee6b5135329c6240a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206262
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-05 17:14:55 +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
Ben Wagner
51874e3e37 Allow selection of shaper wrapping algorithm.
Change-Id: I8103348de810863088758d26b6b2d8062827105e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206170
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-04 21:03:00 +00:00
Florin Malita
e797dfba63 Revert "[canvaskit] Bump GPU resource cache to 256MB"
This reverts commit a93aa74a39.

Reason for revert: Busted skottie.skia.org

Original change's description:
> [canvaskit] Bump GPU resource cache to 256MB
> 
> Bug: skia:
> Change-Id: I398ef2e79076018f3f62e62a2040052eeaf60784
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206066
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

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

Change-Id: I0e6181a6ded0adc40531f936fc495f89400516a1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206077
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-04 16:53:41 +00:00
Florin Malita
b161a7d965 [skottie] Fix gradient ramp interaction with non-atomic draws
Currently, shader effects are applied via layers for non-atomic draw fragments.

This is incorrect, as shaders on layer paints are ignored.

Update to always propagate the shader to leaf node paints.

Change-Id: I59f5a5b874e87827f61844969550600fa39e22a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205931
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-04 16:52:59 +00:00
Florin Malita
a93aa74a39 [canvaskit] Bump GPU resource cache to 256MB
Bug: skia:
Change-Id: I398ef2e79076018f3f62e62a2040052eeaf60784
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206066
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-04-04 15:49:01 +00:00
Ben Wagner
1383a38e1d Allow users to create stock shaping iterators.
This provides a way to re-use the existing basic shaping iterators.

Change-Id: I148dd513dcd01381301e7835672d0d605c1c462b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205933
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-04 15:04:59 +00:00
Kevin Lubick
a064c2812e [canvaskit] Make SkImageShader from SkImage
This removes a few src/ includes as well, to avoid using private
implementations like we did.

Change-Id: Ic9a21d04a131c30e17dfca6d8ea45bdefd362aa7
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206062
Reviewed-by: Mike Reed <reed@google.com>
2019-04-04 13:42:41 +00:00
Kevin Lubick
ee91c07a76 [canvaskit] adding drawAtlas to canvas API
Also re-works colors in the JS part to be unsigned,
so there's less chance for oopsies when passing them
to the C++ side.

Change-Id: I3f56d22e873e1407c402606444c50b76dd34ffd4
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204543
Reviewed-by: Mike Reed <reed@google.com>
2019-04-04 13:03:35 +00:00
Mike Reed
5c5de21463 no more legacy enum references
Bug: skia:8937
Change-Id: I64ba9dffe340769ead0de54a82cd32b61f87c57d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205838
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-04-03 21:24:17 +00:00
Florin Malita
866e262a21 [skottie] Fix gradient ramp for non-solid layers
Two issues:

  1) Empirically (per AE's model), only solid layers transform the effect space.
     All other layer types implement their effects ignoring the layer xform.

  2) Due to the effect deferral mechanism in sksg, shader effects are
     sometimes applied with a different transform than intended.

To address #1, tweak the layer builder logic to attach the effects
before/after the transform node, depending on the layer type.

For #2, track the CTM active when the shader effect is attached and undo
any intervening transformations via a local matrix when the shader is
actually applied to SkPaint.

Change-Id: I29b5a4df3b223e7da9dfc36b0d7d40055d192ac0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205922
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-03 20:46:35 +00:00
Mike Reed
fae8fceb4a Use SkTileMode instead of nested enum
Add guard to transition clients

Change-Id: Ia7a3e8f95722f91e84af262168dadf89a78707da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205720
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 15:24:18 +00:00
Florin Malita
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
Mike Reed
e25b4472cd Move SkTileModes to top level
- move shader factories to their host (e.g. picture->makeShader)

More to do to formally deprecated SkShader::TileMode

Bug: skia:8937
Change-Id: I101e42fb9fba4ab91d028a34888f1fde16fdece4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205589
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 00:18:35 +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
Ben Wagner
1e08a7cbc4 Expose basic shaper iterators.
Change-Id: I1b4a04a296df6830c50461a891725b48a2defbd9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/204261
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-01 19:42:53 +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
Kevin Lubick
3902628e35 Support WebGL 1.0 with caps
There is some logic in here for 2.0 as well, just as a
"as long as I was looking at the specs", but only 1.0
is really supported.

This seems to resolve the bug where some GPUs weren't
advertising correctly that they had vertex array object
support, by checking for both extension names (with and
without "GL_" prefix)

Of note, this saves about 18 Kb (5.5 Kb gzipped) of code size
by compiling out the unneeded GLES checks/functionality.

Bug: skia:8378
Change-Id: I773bf4dbf231b991051d2a9f640b8047a9010e7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203461
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-28 17:21:23 +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
Kevin Lubick
cd54466473 Expose gpu cache knobs
Change-Id: I5911593812ebf6fd235c6a3fc2acfa740c7687aa
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203164
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-25 11:48:25 +00:00
Mike Klein
e5acd7547b delete DAA
Change-Id: I1fd8cba067c0063c6621641e8196e69fd5e31cec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203080
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-22 15:44:03 +00:00
Kevin Lubick
025949e0f7 [canvaskit] npm version 0.5.1
Fixes a build flag

Bug: skia:
Change-Id: I51f0fff18415fba5ea8396189aeab8a40f196c70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202713
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2019-03-21 18:35:18 +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
Kevin Lubick
27ba7032be Add GN args for GL/GLES interface
Bug: skia:
Change-Id: I8445a6f3641aa43e7b18832c7c228b66dd321f2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201616
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-21 12:57:27 +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
Kevin Lubick
359a7e305c [canvaskit] Add requestAnimationFrame to SkSurface
Bug: skia:
Change-Id: I8a15c10d0d8f20098d0e5357ffd602db97c50c84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201986
Reviewed-by: Mike Reed <reed@google.com>
2019-03-20 14:42:35 +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
Kevin Lubick
8aa203c1d8 Add macro to decide GrGLStandard
This allows us to remove certain interfaces at compile time.

This replaces most (all?) of the cases where it was
if (gl) else [implicit gles] to be explicitly
if (gl) else if (gles)
in preparation for adding a WebGL standard.

For consistency, I tried to check first for GL, then for
GLES, which involved re-arranging a few if blocks.

PS 3 removes about 1.2KB (0.4 KB gzipped) from CanvasKit by
removing the GrGLInterface related checks from
GrGlInterface::validate()

PS 8 removes a total of 6.0 KB (2.6 KB gzipped) from
GrGlInterface::validate() and GrGlCaps::*

Bug: skia:8378
Change-Id: Ia91b732d888907f5d94b0eac8ca023084999fa7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201604
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-19 18:19:12 +00:00
Kevin Lubick
2697dd626e [canvaskit] Various cleanups around docs/build
- Break up example into two pages
 - Deprecate SkCanvas.flush()
 - add build flag that helps with certain GPU's webgl support

Bug: skia:
Change-Id: I49b1dbfecc10265a14ef4cbe54f7e8f0306e12ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201649
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2019-03-18 15:53:30 +00:00
Kevin Lubick
d3cfbcae10 [canvaskit] Add TextOnPath helper to TextBlob
This adds the pieces needed to accomplish this, and
although clients could do it, I figured it would be
nice to expose as a universal tool (on TextBlob).

Bug: skia:
Change-Id: Id5d61744973de2da75049d33d40e1dc442c2442c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201601
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-03-15 22:28:17 +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
Kevin Lubick
832787ac6c [canvaskit] Fallback to CPU more gracefully
This should also trim down code size since WebGL should never want
GrGLMakeAssembledGLInterface only GrGLMakeAssembledGLESInterface

Bug: skia:
Change-Id: I9246d467847eeb91517c56075077b3e26c4ee336
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201223
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2019-03-14 20:25:25 +00:00
Kevin Lubick
f35551815f [canvaskit] missing extern
Bug: skia:
Change-Id: I9893650b394c71ced15c0b6b7623a4c3081cedff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201225
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-14 15:18:22 +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
Kevin Lubick
d618027eaf [pathkit/canvaskit] Address race when uploading results
As long as I'm updating the image, update Chrome from 68 to 72

Bug: skia:8844
Change-Id: Ia62ffb062b2c137c89f6e4eb3be30c22ca375bae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200508
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
2019-03-12 21:45:04 +00:00
Kevin Lubick
d254435603 [pathkit] Clean up perf/test init
This will hopefully help with flakiness.

Bug: skia:8810
Change-Id: Id2fa9abcc0e95f0cf8b08557215766b4f9c57478
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200047
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
2019-03-12 13:46:41 +00:00
Kevin Lubick
3f67f411d8 [canvaskit] Move from experimental to modules
Bug: skia:
Change-Id: I2ffd54cf81c974f3a80103e1726a06067cc90d82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200044
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-11 21:09:52 +00:00
Mike Reed
ca9b2082d1 rename mixer to lerp (in prep for SkMixer)
Bug: skia:
Change-Id: I55d879dd76e10c8ef9a01f2dd7cff725e8a82433
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199932
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-03-11 19:32:31 +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
Brian Osman
ca4ed90da7 Particles: Store stable randoms after spawn affectors
This fixes a subtle bug with correlated behavior, where the spawn and
update affectors would get the same sequence of random values, leading
to confusing patterns.

Bug: skia:
Change-Id: Ieaace68bfe92281ec81497a8c6ce0108df996a4c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199251
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-08 19:05:37 +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
Brian Osman
d0c1bd43d9 Particle cleanup: IWYU
Bug: skia:
Change-Id: If9d8a22a770e4125391d0fbd263521f6bdb7725d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198246
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-06 22:26:40 +00:00
Brian Osman
93c47cc8e3 SkReflected - avoid double registration, auto register base types, etc.
Bug: skia:
Change-Id: I99913987ec5de044ecc9302335771f59d85126dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198243
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-06 20:29:38 +00:00
Brian Osman
b77d502946 Particles: Cleanup and better UI
Remove SkAnimTimer from the module interface entirely.
Clean up some other SkParticleEffect methods. Simplify
VisitTypes to just visit all of them, it's easier for
the client to do any filtering.

In the slide, make the UI far nicer. Load all files in
a given directory, and allow editing (and saving) them
all at once, or adding a new entry. Support multiple
playing effects, with a draggable handle to set the
position.

Bug: skia:
Change-Id: I0bec4077f9135bc122569f1410bebc96d5439480
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197243
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-06 18:42:11 +00:00
Kevin Lubick
269fe89950 [canvaskit] Add particles integration
Bug: skia:
Change-Id: I5bf08e8007b59b5e21005f5004d698e53b99ffe6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197849
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-06 14:52:56 +00:00
Kevin Lubick
966348413f [particles] Clean up build - remove test deps
Bug: skia:
Change-Id: I499262277ac1c8d92a39a66f6e846e248b102aef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197767
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-05 20:44:10 +00:00
Brian Osman
bdcdf1a7c3 Add SkParticleValue to allow further customization of curve behavior
All curves (and path affectors) are driven by an SkParticleValue. The
value can derive its value from the current defaults (age of particle
or effect), or explicitly choose the other one, a random value, or any
other particle value. Values can be range adjusted and support repeat,
clamp, and mirror tiling.

Also fixed some more issues related to resource path in the slide GUI.

Bug: skia:
Change-Id: I4755018d5b57ae2d5ec400d541055ca4fb542978
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/196760
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-03-04 22:04:17 +00:00
Brian Osman
3d76d1bf46 Particles: Removed emitters, added more full-featured position affectors
Bug: skia:
Change-Id: Ie6485a11bb57fecef470d727dcf3b4fe5dff0b90
Reviewed-on: https://skia-review.googlesource.com/c/195582
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-28 21:16:02 +00:00
Brian Osman
34d1331323 Particles: Improvements to SkCurve
Added explicit Linear segment type, merge math evaluation helpers for
scalar and color curves. Add logic to visitFields that cuts down on the
serialized size of simple curves, and makes the GUI easier to work with.

Remove the curve plot from the GUI. It was incorrect (wrong points at
cubic handle locations), not terribly helpful, and difficult to
maintain.

Bug: skia:
Change-Id: I190cb5d118b1f4b910984e4df50ee3351c8be895
Reviewed-on: https://skia-review.googlesource.com/c/195884
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-27 16:46:29 +00:00
Ben Wagner
ff84d8a900 SkTypeface::openStream to return smart pointer.
Change-Id: I2c936510e13561fcc9fd8343d5ab9f18c28c8340
Reviewed-on: https://skia-review.googlesource.com/c/195371
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-27 14:08:09 +00:00
Brian Osman
e5d532edae Particles: remove non-stable random, add better enum reflection
The other generator was never used (or useful). String-based serialization
of enums is quite helpful, though.

Bug: skia:
Change-Id: Ic9d58f8d20cfe7aba47722bd74f1e6f8f0f219e5
Reviewed-on: https://skia-review.googlesource.com/c/195368
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-26 20:29:56 +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
Brian Osman
0c48681e58 Few more particle features and some generalization work
Add particle "frame" enum, to allow effects relative to local, world,
or velocity. Remove the "orient along velocity" and replace with a much
more general orientation affector (angle curve + frame). Add an angular
velocity affector to mirror the behavior of the linear velocity affector.

Bug: skia:
Change-Id: Ibbaaeb352c9547d00d81c7916d00148dd65ed2b9
Reviewed-on: https://skia-review.googlesource.com/c/195361
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-26 15:56:24 +00:00
Kevin Lubick
8abc842945 [pathkit] fix perf
Docs-Preview: https://skia.org/?cl=195360
Bug: skia:
Change-Id: I4109810832b69a71960f6e619e32288ae8fa5023
Reviewed-on: https://skia-review.googlesource.com/c/195360
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-02-26 13:17:22 +00:00
Kevin Lubick
2722083cbe [pathkit][canvaskit] roll versions
This removes the buggy .then() constructor, primarily.

Docs-Preview: https://skia.org/?cl=195126
Bug: skia:
Change-Id: Ie20512267ce3f822eb0d68e71fc07f3d3245c1e9
Reviewed-on: https://skia-review.googlesource.com/c/195126
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2019-02-25 21:53:53 +00:00
Brian Osman
14a67a3a71 Change particle affector to work on N particles
This should severely cut down on the virtual call overhead when running
affectors. It also switches to model of "for each affector, do each
particle", rather than "for each particle, do each affector". This is
going to be an I$ improvement, and (if we ever care), make it possible
to do wide-mode threading of the affectors on disjoint blocks of
particles.

Bug: skia:
Change-Id: Ia4e8e8d461dba4e303c45766ea2b4ece1bca9196
Reviewed-on: https://skia-review.googlesource.com/c/195123
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-25 19:59:04 +00:00
Brian Osman
1b20cd8d30 Add "enabled" flag to affectors, fix curve interaction with stable random
Flag is helpful while editing things (and could be a useful property to
animate, as well). The curve change fixes a bug where the stable generator
gets out of phase if all segments of a curve don't use the same options.

Bug: skia:
Change-Id: Ie151e775aee22957e79fa88feaafad72b6c781ff
Reviewed-on: https://skia-review.googlesource.com/c/195120
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-25 19:39:23 +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
Kevin Lubick
867da4b96e Allow system harfbuzz.
This should allow shaper to run on the no-deps bot.

Change-Id: I2515875d4e9b428681c20877630b904c3229ecc5
Reviewed-on: https://skia-review.googlesource.com/c/194420
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-23 12:14:30 +00:00
Florin Malita
ef22907020 [sksg] Use luminance coefficients from SkColorData.h
TBR=
Change-Id: I2dc48f3d4e1ee1b873bd41ede5168191f69bde30
Reviewed-on: https://skia-review.googlesource.com/c/194427
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-22 23:31:50 +00:00
Florin Malita
a753d1a347 Reland "[skottie] Add tritone layer effect support"
This reverts commit 42ee4028a9.

Original change's description:
> Revert "[skottie] Add tritone layer effect support"
> 
> This reverts commit 71c70ea13e.
> 
> Reason for revert: broke WASM builds
> 
> Original change's description:
> > [skottie] Add tritone layer effect support
> > 
> > Generalize sksg::TintColorFilter into GradientColorfilter, to support
> > multiple color interpolation ranges.
> > 
> > Keep the two-color/single-matrix (tint) specialization, and use a table
> > color filter for the general case.
> > 
> > Change-Id: Idf42833462127c29fb69fe94337a1d1478b77dd9
> > Reviewed-on: https://skia-review.googlesource.com/c/194024
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> 
> TBR=fmalita@chromium.org,reed@google.com
> 
> Change-Id: Id5bd99701f74fbd4f54d0aca74e753b7ab88bdb3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/194429
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

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

Reason for revert: broke WASM builds

Original change's description:
> [skottie] Add tritone layer effect support
> 
> Generalize sksg::TintColorFilter into GradientColorfilter, to support
> multiple color interpolation ranges.
> 
> Keep the two-color/single-matrix (tint) specialization, and use a table
> color filter for the general case.
> 
> Change-Id: Idf42833462127c29fb69fe94337a1d1478b77dd9
> Reviewed-on: https://skia-review.googlesource.com/c/194024
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

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

Change-Id: Id5bd99701f74fbd4f54d0aca74e753b7ab88bdb3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/194429
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-22 21:51:13 +00:00
Florin Malita
71c70ea13e [skottie] Add tritone layer effect support
Generalize sksg::TintColorFilter into GradientColorfilter, to support
multiple color interpolation ranges.

Keep the two-color/single-matrix (tint) specialization, and use a table
color filter for the general case.

Change-Id: Idf42833462127c29fb69fe94337a1d1478b77dd9
Reviewed-on: https://skia-review.googlesource.com/c/194024
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-22 21:00:25 +00:00
Brian Osman
d5c57fe289 Add local vs world flag for particle velocity
Adjust reference frame for affector to be consistent (so angles are
counted clockwise from "up" in both local and world modes).

Bug: skia:
Change-Id: I643e1484bc0a58d1f1c0cfe35ac2ab37dc2ea409
Reviewed-on: https://skia-review.googlesource.com/c/194189
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-22 17:45:25 +00:00
Kevin Lubick
1ba9c4df77 [canvaskit] JS API in place for shaped text
Depends on https://skia-review.googlesource.com/c/skia/+/186870

It's optional at build time, which is good given that
it adds about 2MB of uncompressed size (from 4.3 MB to 6.4 MB)

Bug: skia:
Change-Id: I5f54ad628b735c3bc880e917394fb27d16849ebe
Reviewed-on: https://skia-review.googlesource.com/c/187924
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-02-22 15:39:55 +00:00
Florin Malita
b0604e5c46 [sksg] Hoist empty-bounds check to base RenderNode
Empty-bounds nodes should never render anything.

TBR=

Change-Id: Iaa216a1d49a4a81054bcae19c1fff5a85e543c50
Reviewed-on: https://skia-review.googlesource.com/c/193690
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-21 14:28:11 +00:00
Kevin Lubick
2031f34a77 [canvaskit] Upgrade emscripten to .27
This should have some slightly better, more minified JS and other
bugfixes

Bug: skia:
Change-Id: I7c5367b6650267ec8bafcc5de9e351bd8788392b
Reviewed-on: https://skia-review.googlesource.com/c/193582
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-02-21 14:13:00 +00:00
Florin Malita
48cc589886 [skottie] Tint effect support
Introduce a TintColorFilter scene graph node, and hook into Skottie.

Change-Id: I350dec9ebcdc0bfc68d2874703112f1b20b51d75
Reviewed-on: https://skia-review.googlesource.com/c/193662
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-20 22:42:00 +00:00
Brian Osman
d8e1ee9a66 Refactor particle age logic
Move to a model that only needs floats, and puts the age in the
SkParticleState struct. Add a better test case for spawn affector
animation, to verify that things are still working.

Bug: skia:
Change-Id: I97d99de5f5d4cb302b76116e67ecc93368fb1677
Reviewed-on: https://skia-review.googlesource.com/c/193580
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-20 19:55:20 +00:00
Brian Osman
125daa4d1a Refactor and further generalization of particle model
- Collapsed the per-particle data into a single struct, and
  use that to communicate with drawables, too. Let the drawables
  manage allocation of xforms, colors, etc. Helpful for non-atlas
  drawables, and just to keep the effect code simpler.
- Having all of the params in a single struct allows us to move
  the remaining animated behaviors into affectors (color/frame).
- Added SkColorCurve, which works like SkCurve for SkColor4f.
  Use that to create a color affector (rather than simple
  start/end colors in the effect params).
- Also put the stable random in SkParticleState. This is going
  to be necessary if/when we change affectors to operate on all
  particles (rather than one at a time). Still need to move t
  value into the particle struct (or eval it from the lifetime
  params on demand).

Change-Id: Icf39116acbfd5d6e8eb91e9affbd8898d106211d
Reviewed-on: https://skia-review.googlesource.com/c/193473
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-20 18:01:00 +00:00
Ben Wagner
b059194c08 Make SkShaper an interface.
The interface here is not ideal, but there will need to be some build
clean-up before it can be changed.

Change-Id: Ic4d55634405f4c8d9c194e4e6f368287c9669dcd
Reviewed-on: https://skia-review.googlesource.com/c/193036
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-19 22:06:47 +00:00
Brian Osman
e12e49920c Add comments to document SkCurve
Bug: skia:
Change-Id: Idded82304a1f1d7f26f13d6c2faa1ff6f2832bbf
Reviewed-on: https://skia-review.googlesource.com/c/193372
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-19 21:01:57 +00:00
Brian Osman
23b96c0e23 First pass comments to document SkReflected.h
Bug: skia:
Change-Id: I6fe50ef0f783a9093090037c4b22af1400c0136e
Reviewed-on: https://skia-review.googlesource.com/c/193363
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-19 20:45:27 +00:00
Brian Osman
2991cbee62 Remove SkField, it's no longer used
Bug: skia:
Change-Id: I8efcbb09dce2cb0e4f33a10e4ff2148058c6fbc5
Reviewed-on: https://skia-review.googlesource.com/c/193362
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-19 16:08:42 +00:00
Ben Wagner
18ea3c70fb Add asserts to SkTextBlobBuilderRunHandler.
This makes a user check some postconditions of shaping.

Change-Id: Ifa34bbb9bd8baf18c830d58d99eee9c82811125a
Reviewed-on: https://skia-review.googlesource.com/c/193038
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-19 15:55:42 +00:00
Brian Osman
543d2e2f2e Moved image params out to SkParticleDrawable
Added a simpler circle drawable, moved drawing code out so that frame
calculation is handled by the drawable. Fixed all the sample effects,
including some size adjustments to better create the intended effect.

Bug: skia:
Change-Id: I60af9cd6262ff98352ca8ceaf6768aef9c7e164c
Reviewed-on: https://skia-review.googlesource.com/c/193029
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-15 20:07:43 +00:00
Hal Canary
1b85323f10 ICU: enable on wasm
Change-Id: I0647f641d4716af39f4afb832cfcc9fa7d571880
Reviewed-on: https://skia-review.googlesource.com/c/192832
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-02-15 18:14:43 +00:00
Brian Osman
112aa2d22e Add curve visualization back, guard eval
Editing curves is still cumbersome, but that's fine.
Visualization is just for feedback (and imgui's path
renderer is a little wonky), but this helps a bit.

Bug: skia:
Change-Id: I3dace6d822d472314513bb1ad72bcea1e8991b77
Reviewed-on: https://skia-review.googlesource.com/c/192828
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-15 16:24:43 +00:00
Brian Osman
8b6283fc98 New SkCurve type with multiple curve segments
- Converted all linear force stuff into a single affector,
  used at either spawn or update time appropriately.
  The new affector can either set or adjust velocity.
- Converted lifetime to a curve.
- Removed SkRangedFloat, initial velocity params, etc.

Looks like a large addition, but that's mostly down to the
JSON getting bigger. There's a net reduction in LoC.

Bug: skia:
Change-Id: Iac7417f15f96d0313efd08c4b26dc3250b80fa77
Reviewed-on: https://skia-review.googlesource.com/c/192102
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-15 14:10:39 +00:00
Ben Wagner
2fe1e23c58 Fix signed/unsigned mismatch in shaper assert.
Change-Id: I05e0e3f5940281b8c9fdcbabf6d8c1013bfa48d4
Reviewed-on: https://skia-review.googlesource.com/c/192824
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 22:38:37 +00:00
Ben Wagner
84cc4616df Fix assert in shaper.
Need and 'in range' operator.

Change-Id: I57cd6631376a6e857054b4712a70b2aa75a53223
Reviewed-on: https://skia-review.googlesource.com/c/192823
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 22:16:43 +00:00
Ben Wagner
83597ce581 Remove typeface from SkShaper constructor.
It isn't used anymore.

Change-Id: I4079ff9944aa2483a0cd42130d0e69fb98935731
Reviewed-on: https://skia-review.googlesource.com/c/192820
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-14 21:41:28 +00:00
Ben Wagner
f61c936670 Add HarfBuzz callbacks.
This allows for SkTypefaces not backed by OpenType data to get minimal
shaping through HarfBuzz.

Change-Id: I0e4d69627500e0aff40c8989d3734597bfa1f8d6
Reviewed-on: https://skia-review.googlesource.com/c/192681
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-14 21:28:38 +00:00
Ben Wagner
b9cc1c6bc2 Fix calculating clusters from start of input.
Still some code hanging on from optimizing for SkTextBlob.

Bug: skia:8420

Change-Id: I947a9ff691fb1fbcb82934c5597e5db11c12f013
Reviewed-on: https://skia-review.googlesource.com/c/192683
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-02-14 21:23:38 +00:00
Brian Osman
5c1f8eb094 Various particle system improvements
Effects now have a duration, and can be played looped
or one-shot. Added a second list of affectors that are
applied at spawn vs. update.

Effects grab and store the SkRandom at construction,
so it no longer needs to be passed to update().

Bug: skia:
Change-Id: Ib54d60466e162e4d4b70fa64c1215fc01680d47a
Reviewed-on: https://skia-review.googlesource.com/c/191722
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-02-14 20:19:08 +00:00
Brian Osman
5de7ea45bc Particles/SkReflected: Generalize array reflection
This supports arrays of any type, and removes all of the special case
code for arrays of SkReflected objects. (This is extracted from my
rewrite of SkCurve, which needed something like this to work).

Bug: skia:
Change-Id: I55ab942f7922335dca0685d28b3b122bc4d53daa
Reviewed-on: https://skia-review.googlesource.com/c/192620
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-02-14 20:04:48 +00:00
Hal Canary
b6f5378333 SkShaper: enable for unit and render tests
New tests that use skshaper should hide behind SK_USING_SKSHAPER define.

Change-Id: Ifcd726d931e3eb1ff209085a63e8129c9cd5596d
Reviewed-on: https://skia-review.googlesource.com/c/192026
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-02-13 16:19:48 +00:00
Ben Wagner
a8d94c1688 Font fallback to handle no font with character.
In the event that no fallback font can be found to handle a character,
just keep using the current font.

Change-Id: I93c852dc8ee5eaa868e48a5ce3e8298a642b15c7
Reviewed-on: https://skia-review.googlesource.com/c/191661
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-12 21:52:12 +00:00
Florin Malita
63136afbd0 [sksg] Fix group hit-testing order
Change-Id: Idc25109a598caabf01e3ab61dc97f984ff453d40
Reviewed-on: https://skia-review.googlesource.com/c/191664
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-12 21:10:00 +00:00
Brian Osman
7c979f52c3 Experimental Particle System
This adds a new "Particles" slide to viewer, that allows
editing, loading, and saving particle effects. All of the
particle system code is in modules/particles.

There are many rough edges and some not-yet-finished changes
to generalize the model[1]. A rough overview:

- SkReflected.h implements a lightweight reflection system
  for classes derived from SkReflected. Adding a new class
  involves deriving from SkReflected, adding a macro to the
  class declaration, and implementing visitFields(), which
  simply calls a virtual on an SkFieldVisitor for each field.
  Currently, emitters and affectors use this mechanism.

- SkParticleSerialization.h demonstrates two useful field
  visitors - for serializing to and from JSON. The driver
  code that uses those is directly in ParticlesSlide.

- SkParticleData.h and SkCurve.h define a variety of helper
  types for talking about particles, both for parameterizing
  individual values, and communicating about the state of a
  particle among the effect, affectors, and emitters.

- SkParticleEffect.h defines the static data definition of
  an effect (SkParticleEffectParams), as well as a running
  instance of an effect (SkParticleEffect). The effect has
  simple update() and draw() methods.

- ParticlesSlide.cpp adds a third field visitor to generate
  GUIs for interactively editing the running effect.

---

1: The critical change I'd like to make is to remove all
special case behavior over time and at spawn (setting sprite
frames, size over time, color over time, etc...). Integration
is the only fixed function behavior. Everything else is driven
by two lists of affectors. One is applied at spawn time, using
the effect's lifetime to evaluate curves. This allows spawning
particles with different colors as the effect ages out, for
example. The second list is applied every frame to update
existing particles, and is driven by the particle's lifetime.
This allows particles to change color after being spawned, for
example.

With a small set of affectors using a single expressive curve
primitive (keyframed list of cubic curve segments), we can
have affectors that update color, size, velocity, position,
sprite frame, etc., and implement many complex behaviors.

Bug: skia:
Change-Id: Id9402bef22825d55d021c5a2f9e5e41791aabaf4
Reviewed-on: https://skia-review.googlesource.com/c/181404
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-12 18:53:41 +00:00
Ben Wagner
50becee292 Primitive SkShaper to do primitive line breaking.
This essentially resurects the old SkTextBox code into a primitive
shaper.

Change-Id: Ia4d1a5ab3d1c7d410962b49ac3891298655c7dc4
Reviewed-on: https://skia-review.googlesource.com/c/191562
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2019-02-12 17:56:40 +00:00
Mike Reed
ec80d901b9 starter sample for playing with SG.
will flesh out more over time.

Bug: skia:
Change-Id: If5eaf0a7c404b9209b93871eb3ac3d74da8c65dd
Reviewed-on: https://skia-review.googlesource.com/c/191003
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-02-12 17:03:40 +00:00
Florin Malita
eb46bd892d [sksg] Hit-testing API
Introduce RenderNode::nodeAt(const SkPoint&) as the entry point for the hit-testing API.

This is backed by a onNodeAt() virtual, which gets dispatched throughout the render DAG,
and normally stops at the first leaf Draw node in encounters.

To support the implementation, introduce a GeometryNode::contains(const SkPoint&) API.

This is backed by a onContains() virtual, overridden in each concrete geometry class.

Expose nodeAt() on sksg::Scene, and add some basic unit tests.

Change-Id: I0c8abd9d1e51ecf2d8b4dd699f325cd636e21084
Reviewed-on: https://skia-review.googlesource.com/c/191296
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2019-02-12 15:01:05 +00:00
Ben Wagner
454e5fb745 Fix cluster reporting from shaper.
Bug: skia:8420
Change-Id: I7eea8c6b3af2153a1ac1189782fc6cbaaf9ee5c6
Reviewed-on: https://skia-review.googlesource.com/c/190821
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-11 21:59:33 +00:00
Florin Malita
ef26fcb13f [sksg] Fix image filter content inval rect tracking
Image filters cannot let descendent damage pass through, as they may
transform their inputs arbitrarily.

Introduce the notion of "damage override" SG nodes (nodes which block
descendent damage and replace it with their own), and update
ImageFilterEffect to opt in for this behavior.

Also make InvalidationController damage dispatch optional (such that we
don't accumulate inval rects unnecessarily).

TBR=
Change-Id: Ie9f7d32ecdcc77dbe6ea009aed9ce269b3649a04
Reviewed-on: https://skia-review.googlesource.com/c/191005
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-10 21:43:20 +00:00