Commit Graph

396 Commits

Author SHA1 Message Date
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