Commit Graph

1807 Commits

Author SHA1 Message Date
Kevin Lubick
0c23120abd [canvaskit] Switch to appropriate WebGL Context for Surface methods
Change-Id: Id829603bafb73d2256e44a9101b4b1669b735e12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469534
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-10 13:49:24 +00:00
Kevin Lubick
1f8c31b101 [infra] Add initial Bazel rules and files
These rules can be used to build our GMs on WASM+WebGL and
libskia.a with just the CPU backend (and most other features
turned off).

This can be done with the following commands:
  - bazel build //modules/canvaskit:gm-bindings-wasm --gpu_backend=gl_backend --with_gl_standard=webgl_standard
  - bazel build :skia-core --config clang

This pivots slightly from http://review.skia.org/463517
by using config_settings [1] instead of platforms for
the optional features that we control. This pivot was
suggested in [2]

We have BUILD.bazel files in many of the subdirectories
that specify filegroups for the appropriate files. In
an effort to make //BUILD.bazel more readable, it is
the responsibility of these subfolders to deal with
conditionally including certain .h or .cpp files.
This is done using select statements and config_settings
or platform constraints as necessary.

For example, src/gpu/BUILD.bazel will different private
filegroups for each of the supported gpu backends [3]
and a more-visible filegroup called "srcs" that has
the right selection of the private files to be used
for compilation.

An effort has been made to avoid using glob() in our
BUILD.bazel files. These file lists were made by using
`ls -1` and some regex to add in quotes. We might want
to make a helper script to assist with that, if necessary.

To specify which options we have, the settings in
//bazel/common_config_settings/BUILD.bazel have been
redesigned. They make use of a macro `string_flag_with_values`
that removes the boilerplate. Patchset 36 shows what the
file looks like w/o the macro.

The top level BUILD.bazel file will still need to use
some logic to handle defines, because local_defines is
a list of strings, not a list of labels [4].

Suggested Review Order:
  - WORKSPACE.bazel to see the new dependencies on the
    emsdk toolchain and bazel_skylib
  - bazel/common_config_settings/* to see the few settings
    defined (we have more to define, see BUILD.gn and
    //gn/skia.gni for ideas)
  - BUILD.bazel to see the "skia-core" cc_library rule.
    See also "gms" and "tests"
  - modules/canvaskit/BUILD.bazel to see the use of
    the emscripten "wasm_cc_binary" rule, which depends
    on the "skia-core", "gms", and "tests" rule. Note that
    it only builds some of the gms as a proof of concept.
  - The other BUILD.bazel files. Some of these are not
    platform or feature dependent (e.g. pathops). Others
    are (e.g. gpu).
  - All other files.

[1] https://docs.bazel.build/versions/4.2.1/skylark/config.html#user-defined-build-settings
[2] https://github.com/emscripten-core/emsdk/pull/920
[3] In this CL, that's just the webgl one.
[4] https://docs.bazel.build/versions/main/be/c-cpp.html#cc_library.local_defines

Change-Id: Ieecf9c106d5e3a6ae97d13d66be06b4b3c207089
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458637
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Owners-Override: Kevin Lubick <kjlubick@google.com>
2021-11-09 12:32:25 +00:00
Kevin Lubick
37bef2d300 [canvaskit] Add tests/examples for using CanvasKit with Typescript.
This adds a way to test/demonstrate how an external client
using Typescript can make use of CanvasKit in a browser
(currently a JS library with Typescript bindings supplied).

See: modules/canvaskit/external_test/typescript_browser/

This also adds a way that we hope CanvasKit might be used
in a future release, that is, via ES6 modules.

See: modules/canvaskit/external_test/typescript_browser_es6/

These TS files can be built into the JS files needed by the
respective index.html files using the appropriate target
in modules/canvaskit/external_test/Makefile. Then, `make serve`
will bring up a HTTP Server that will make the folders
accessible on localhost:8000

Change-Id: Ie4ddc2588b4bdccd4a727f11b540289cf4f85795
Bug: skia:11077, skia:12539
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468214
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-05 20:18:30 +00:00
Jorge Betancourt
f2e90d3005 add skottie support for Bulge ADBE effect
This effect does not yet support pinned edges or taper

also sneak in a filename change (CCToner) to keep all effect names standard

Change-Id: I17f2b5463408556775bc12a972358abd4d8d8690
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467319
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-11-04 21:05:22 +00:00
Avery Musbach
a05d3029ac Fix skottie::PropertyHandle export
Bug: chromium:1266877
Change-Id: I6000d0dd8c9214aa37c1956834d6a14db151c929
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467956
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-11-04 19:00:27 +00:00
Florin Malita
ba35f687c3 [skottie] Clean up FractalNoise and SkSLEffect
Pass inval controller and ctm to child nodes during revalidation.

Change-Id: Iee6862af78c77d5164e29b0e41ed6dae9a7f4235
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/466760
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-02 13:27:15 +00:00
Jorge Betancourt
172c7998e1 plumb experimental SkSL layer effect in native Skottie player
Long term plan is to expose a plugin (standalone or with bodymovin) that allows motion artists to write sksl into a composition.
This is the first step where we test how we'd read in the json data under the hood.

Change-Id: I300d3af5d01e12f5b495970f89fd12b5f464a9a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464368
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-11-01 18:05:15 +00:00
John Stiles
9ec61da31b Fix Clang warning -Wbitwise-instead-of-logical.
warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
    inherit_if_needed(currentNode->fX               , attrs->fX)      |
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  note: cast one or both operands to int to silence this warning

Change-Id: I6d59a5c33826af29560c0e30ddf9f4e16581882c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463896
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-26 21:35:37 +00:00
Kevin Lubick
7ce380e967 [canvaskit] Remove deprecated MakeTypefaceFromData and RefDefault
Change-Id: I0072fa5c11834a6250f2f5b9290ecea0d30f2128
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462177
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-10-21 16:45:42 +00:00
Kevin Lubick
2d13fab55c [canvaskit] Define requestAnimationFrame and other definition fixes.
Change-Id: I28a908fb680d704bf730a5968691f54d4a9e0a68
Bug: skia:12555 skia:12550
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462056
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-10-21 16:45:42 +00:00
Jorge Betancourt
aaa70658c2 expose directional blur to skottie
Change-Id: I759e4fff7a6d9cd1aae6ece060d570d05c1af94a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461236
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-20 19:41:30 +00:00
Jorge Betancourt
ebe2d82384 [JetSki] get TypeFace from FontMgr
Change-Id: Ied6cc2f67434757ed1cf6dd4edb6c40798ec206b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/450038
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-10-20 19:33:30 +00:00
Florin Malita
b3460f9979 [skottie] Floatify Fractal Noise
Halfs are lacking sufficient precision for this effect.

Change-Id: If3c2cac34d465d74b7ad8228417c42950f48adfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/461177
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-10-19 19:20:08 +00:00
Florin Malita
decc9ae2fc [skottie] Fractal Noise optimization
Hoist all evolution-related calculations out of the shader, and pass
precomputed noise planes and weight uniforms.

Renders ~20% faster locally (w/ software rasterization).

Change-Id: I771bea8f3425440515d2cb9a8623336d18bcc7b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460336
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-18 16:14:54 +00:00
Florin Malita
b6a3aa7eb5 [skottie] Fractal Noise: cycle evolution support
AE allows for optional cycling of evolution, after a certain number of
revolutions.

To support:

  - split off the base/offset component into a separate uniform
    (currently front-loaded into evolution)
  - introduce an additional "cycle" (period) uniform to mod() the noise
    plane calculations


Change-Id: Ib412027114c467934c549cc1438a7d4560aa14bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/460116
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-10-18 15:11:06 +00:00
Harry Terkelsen
1cb3f3666c Don't free the locale pointer in a paragraph style.
The locale is malloc'ed using `cacheOrCopyString`, which should never
be explicitly freed.

Change-Id: I6a911c52f1f485b34fad86303a1f4be199195858
Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit,Test-Debian10-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459835
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-10-15 22:14:34 +00:00
Jorge Betancourt
aa9656d8ca expose FontChain interface to Java with FontChainAdapter
initial commit to add fontChain to JetSki

Change-Id: Ic2e27b055888394b0b8202d817b0c09595ca9fa0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457837
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-10-14 19:58:29 +00:00
Nico Weber
39edd521a2 Fix Wbitwise-instead-of-logical warnings
`a || b` only evaluates b if a is false. `a | b` always evaluates
both a and b. If a and b are of type bool, `||` is usually what you
want, so clang now warns on `|` where both arguments are of type bool.

In Skia, 3 of 3 uses of `|` were intentional as far as I can tell (one
had an explicit comment, the other two didn't). Rewrite them slightly
to make this intent more clear and to suppress the warning.

There was also one use of `&`. That one looks like a (benign) typo for
`&&`, so change it.

Bug: chromium:1255745
Change-Id: I9ac37075311005c0a8fcb8d1379f516510929423
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459456
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-14 14:50:09 +00:00
Florin Malita
ad6f2d3e66 [skottie] Log text layout errors
If text layout fails (e.g. due to unsatisfiable scaling constraints),
log an error to notify clients.

Change-Id: Ic7a028196b3bfb8f45b91c88766f0059145a202f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458722
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-14 14:29:11 +00:00
Kevin Lubick
9a5762052a Followup fixes to gm bindings
Change-Id: If896d8a06fcf1bf1859a486f16e9f56fd184c0c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459196
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-10-13 19:26:05 +00:00
Robert Phillips
083e038fe6 Fix WasmGMTests bot
Change-Id: Iffb757bdc8b28d14aae176b1d2448e72ccde7c3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459116
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-10-13 18:03:45 +00:00
Robert Phillips
297d096cfb [graphite] More testing infrastructure
With this CL we can run as:

     dm --src gm skp tests --config grmtl -v --nocpu --nogpu

and not get all the non-Graphite unit tests.

Bug: skia:12466
Change-Id: Ib3f04f315fe4b5731a54e4c72979a0c1e00baf24
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457898
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-10-13 15:15:29 +00:00
Eric Sum
734d7e2be4 Export some classes callers may use for Skottie.
1) CachingResourceProvider - The immediate user of this is ChromeOS,
but it seems like a generally useful ResourceProvider implementation
that all can use.

2) Animation::Builder - See this CL:
https://chromium-review.googlesource.com/c/chromium/src/+/3171517
It seems that windows builds fail with "undefined reference" linker
errors when trying to use the Animation::Builder directly. My guess
is that this is because the SK_API macro is needed to export it.

Change-Id: Ief39fe6ec03f992a0be73e5be54b0119d2d82930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458407
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-13 01:35:54 +00:00
Brian Salomon
87a0078b89 Support building on clang with -std=c++14 but no C++17 extension warning.
Classes of issues addressed:

1. static constexpr class variables aren't automatically inline. Already handled in a separate CL

2. Lack of C++17 copy elision means classes of objects constructed at function return need a copy or move constructor even if RVO will mean it isn't called.

3. Nested braced init no longer allowed for base classes of subclasses without constructors.

4. template static constexpr var in template class throws error about redundant initialization. Adding inline and removing defn outside of class fixes it.

5. Some places that should have been including std headers now actually need to include them.

6. No auto template parameters.

7. No lambdas in constexpr funcs.


Bug: chromium:1257145
Change-Id: Icb24c6b4ed039287fb4cf27a21a1bb7dc9821728
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457298
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-12 16:34:30 +00:00
Julia Lavrova
0c1f6e5dab Implementing baseline shift for JetBrains
Bug: skia:12390
Change-Id: I90d99e1ca18c1274ac53ab35a3f63b716d26cb5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457097
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-10-12 14:35:33 +00:00
Kevin Lubick
f32ad08ac4 [infra] Deduplicate serve.py
Change-Id: I25bd987faedd7e9c322bcec487ab07583bad6b9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/458197
Reviewed-by: Erik Rose <erikrose@google.com>
2021-10-12 11:42:50 +00:00
Brian Salomon
9fa47cc1c6 Make class members that are static constexpr also be inline.
This is in prep for compiling with -std=c++14 and -Wno-c++17-extensions
when building with clang. Chrome has encountered problems with
third_party headers that are included both in Skia and other Chrome
sources that produce different code based on whether preprocessor macros
indicate a C++14 or C++17 compilation.

In C++17 they are already inline implicitly. When compiling with C++14
we can get linker errors unless they're explicitly inlined or defined
outside the class. With -Wno-c++17-extensions we can explicitly inline
them in the C++14 build because the warning that would be generated
about using a C++17 language extension is suppressed.

We cannot do this in public headers because we support compiling with
C++14 without suppressing the C++17 language extension warnings.

Bug: chromium:1257145
Change-Id: Iaf5f4c62a398f98dd4ca9b7dfb86f2d5cab21d66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457498
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-10-11 16:22:59 +00:00
Florin Malita
132d47c90d [skottie] Path support for paragraph text
In addition to single line (point) text, AE also supports path layout
for paragraph text.

At a high level, the paragraph box top is mapped to the path (following
alignment rules), and each glyph is displaced along its path positioning
vector, post orientation.

The main difference compared to point text, is that the distance on path
is based on the fragment position relative to the paragraph left edge.

The paragraph box also plays a role in alignment: left/center/right
aligns with path start/mid/end.

This includes a tangential optimization: instead of validating cached
contour data in each PathInfo::getMatrix() call, we only check once at
a higher level (onSync) -- to avoid performing a shape vector comparison
for each fragment.

Change-Id: I2c31ce3b0a525a3cd2d4525abcf88d5fc943bb6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457656
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-10-11 15:26:00 +00:00
Florin Malita
d616f0b949 [skottie] More animatable text path properties
"Perpendicular To Path" and "Reverse Path" are animatable in AE, but
used to be exported as static props.  Bodymovin is being updated to
export them as animatable now.

Change the parser to handle both cases.

Change-Id: If2fea2a37af7ec6af5ac07c24cfb533bff5e03ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457736
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-10-11 14:34:36 +00:00
Kyle Carlstrom
cd2f207a2e Allow tracking of Precompositions onEnter/onExit
Change-Id: I6941d7d6c7a76eef462711964e5fb1cb4fd68634
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457156
Reviewed-by: Florin Malita <fmalita@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
Commit-Queue: Avinash Parchuri <aparchur@google.com>
2021-10-08 18:36:50 +00:00
Jorge Betancourt
7357ae2af5 add CCToner support to skottie
Change-Id: Ib5f0d7241f0aa039e325c977aaca30f19682196f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456637
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-10-08 17:03:50 +00:00
Florin Malita
7fcda8e23e [skottie] Initial text path support
Current limitations:

  -- single-line only (no paragraph box support)
  -- "Force Alignment" not supported
  -- tracking animators not supported

Change-Id: I4072f1d8280032787c6db7e8b47d6f55be43bddb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456237
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-10-08 15:09:35 +00:00
Florin Malita
7e5772f448 [skottie] Fix Fractal Noise transform order
Update the shader transform order to match AE.

Change-Id: Iff9256923bef153342fcabe5f5a1091d4b2e3895
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457120
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-10-08 13:59:01 +00:00
Michael Ludwig
8724136129 Revert "Allow tracking of Precompositions onEnter/onExit"
This reverts commit 510e0c57da.

Reason for revert: probably blocking g3 roll

Original change's description:
> Allow tracking of Precompositions onEnter/onExit
>
> Change-Id: I065288b212d8ffc4d0ca127940e524799f59aff7
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454976
> Reviewed-by: Avinash Parchuri <aparchur@google.com>
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Avinash Parchuri <aparchur@google.com>

Change-Id: I2e5b12bd45d48fc98ee799a733740e4cd8ae3dcb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/456921
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-10-07 13:54:07 +00:00
Kyle Carlstrom
510e0c57da Allow tracking of Precompositions onEnter/onExit
Change-Id: I065288b212d8ffc4d0ca127940e524799f59aff7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454976
Reviewed-by: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Avinash Parchuri <aparchur@google.com>
2021-10-06 18:01:56 +00:00
Florin Malita
9c57e16950 [skottie] Fill effect opacity workaround
The Fill effect has separate "color" and "opacity" components.

In AE, the color chooser does not allow modifying the alpha channel --
the only source for Fill transparency is the opacity property.

Thus, the alpha component of the color property should always be 1.

But in practice, it appears Bodymovin sometimes exports the color with a
zero alpha field (BM always encodes colors as 4-float arrays).

To workaround this issue, update Fill to ignore the color alpha and only
use the explicit opacity.

Change-Id: Ic4bbbc1ac91d255fe14e3261d1ae03340e053ce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454856
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-10-01 16:20:54 +00:00
Kyle Carlstrom
4aef06d231 Added TextExpressionAnimator
Change-Id: If60d4a7893da5987176163ce9fa258f846b1f2e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448650
Reviewed-by: Florin Malita <fmalita@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
Commit-Queue: Avinash Parchuri <aparchur@google.com>
2021-09-30 19:28:31 +00:00
Kevin Lubick
bb71c1bea2 [canvaskit] Update SKP and RTShader examples
Loading an old SKP stops working after a while, so this changes
it to draw something and then deserialize it immediately.

I also noticed that the CPU backend supports atan, so we can
use a more complete example there.

Change-Id: I70bec69d05184c5ea041b143132ddbbd7f63f004
Bug: skia:12439
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/454456
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-30 13:00:30 +00:00
Kyle Carlstrom
0bfac0127c Create VectorExpressionAnimator
Change-Id: I9ac04e316fd5cc21f9400ff56cf6bc6db77ca046
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444871
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-09-28 01:23:19 +00:00
Florin Malita
18cb4a67d8 [skottie] Fix MotionTile/opacity interaction
Some group effects (including layer opacity) are not applied upfront,
via an expensive saveLayer, but are deferred until we can determine
whether they can be folded into an atomic draw's paint (to avoid the
extra layer).

At the moment, the MotionTile custom render node drops all pending
paint effects on the floor (ignores |ctx|).  Update to apply via the
shader paint.

Also update a couple of related tests to animate opacity.

Change-Id: I1f5cd2459ec81b170749528e8818d0be598a7ca7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452723
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-09-27 18:04:20 +00:00
Eric Boren
04fe267ab9 Fix some master -> main references in docs
Bug: skia:12478
Change-Id: I4e2bc1eb441c19d7b4cf2bcea65b852f7f0aa59b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/453136
Reviewed-by: Ravi Mistry <rmistry@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
2021-09-27 14:52:24 +00:00
Florin Malita
6ba939d288 [skottie] Improved Hue/Saturation effect
The current HueSaturation effect implementation relies on a simple
HSLA color matrix operation and assumes the controls are linear.

Turns out AE's saturation is more sophisticated, both in implementation
and in control mapping.

Updating the effect to use a chain of specialized color filters:

  - keep HSLAMatrix() for hue adjustments
  - introduce a custom runtime effect for saturation
    (following AE's semantics)
  - use a plain Matrix() CF for lightness adjustments

Change-Id: Iba6c9f7fd8c01dc33c1cd00822ea546867c057ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452976
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-09-27 13:30:48 +00:00
Jorge Betancourt
4d06441fca [JetSki] bind drawGlyphs to JetSki for Text rendering
Change-Id: I5cd691b5b3fda58afdc8ddd5213063c202b19672
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447716
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-09-22 19:38:13 +00:00
Florin Malita
6a2a637746 [skottie] Fix Keyframe::Value equality operator
Per spec, reading anything other than the most recently written
union member is undefined behavior.

Keyframe containers always access the same member, consistently.  But
the type-agnostic equality operator does touch both members.

Refactor to avoid undefined behavior.

Also add a couple of unit tests to capture keyframe deduping behavior
(which in turn relies on the equality operator).

Change-Id: I7ba9c335ef28af7ddc71bd6f03d56b891fbdea1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/451016
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-09-21 19:23:26 +00:00
Ben Wagner
3d9c73c100 Use thread_local on iOS
Using thread_local on iOS requires iOS 9 or greater. Chrome for iOS
now requires 13, Skia sets the minimum to 11 for test builds, and
Flutter actively does not support 8 or earlier. Dropping support for
iOS 8 in practice and moving to iOS 9 makes it possible to use
thread_local without reservations on iOS.

Change-Id: Ib80cbe24e8154be650f343643281384c17356242
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447497
Reviewed-by: Heather Miller <hcm@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-09-20 17:51:38 +00:00
Julia Lavrova
398ef4487b Reland "Reland "Small changes for SkText that are not in experimental directory""
This reverts commit b51994990b.

Reason for revert: Fixed the test

Original change's description:
> Revert "Reland "Small changes for SkText that are not in experimental directory""
>
> This reverts commit ce32c8a074.
>
> Reason for revert: Skottie test is broken
>
> Original change's description:
> > Reland "Small changes for SkText that are not in experimental directory"
> >
> > This reverts commit 481a58dfe0.
> >
> > Reason for revert: Fixing the build
> >
> > Original change's description:
> > > Revert "Small changes for SkText that are not in experimental directory"
> > >
> > > This reverts commit 92f1bc0083.
> > >
> > > Reason for revert: Blocking Android roll.
> > >
> > > Original change's description:
> > > > Small changes for SkText that are not in experimental directory
> > > >
> > > > (also made utf 8<->16 conversion static on SkUnicode)
> > > >
> > > > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > > > Reviewed-by: Mike Reed <reed@google.com>
> > > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> > >
> > > Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> > > No-Presubmit: true
> > > No-Tree-Checks: true
> > > No-Try: true
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> > > Auto-Submit: Brian Osman <brianosman@google.com>
> > > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> >
> > Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: Ib8e5ec05a5555f34106a0ee61878a8199b82bb82
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448897
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: I3bc103c0e1c495342a6673e80765b5f26862e8dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448898
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-15 15:31:14 +00:00
Kevin Lubick
0c5b05c3ab [canvaskit] Roll 0.30.0
Change-Id: Ia990c0537d79256b895348c75ff118253a5af926
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449056
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-09-15 13:21:25 +00:00
Julia Lavrova
b51994990b Revert "Reland "Small changes for SkText that are not in experimental directory""
This reverts commit ce32c8a074.

Reason for revert: Skottie test is broken

Original change's description:
> Reland "Small changes for SkText that are not in experimental directory"
>
> This reverts commit 481a58dfe0.
>
> Reason for revert: Fixing the build
>
> Original change's description:
> > Revert "Small changes for SkText that are not in experimental directory"
> >
> > This reverts commit 92f1bc0083.
> >
> > Reason for revert: Blocking Android roll.
> >
> > Original change's description:
> > > Small changes for SkText that are not in experimental directory
> > >
> > > (also made utf 8<->16 conversion static on SkUnicode)
> > >
> > > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > > Reviewed-by: Mike Reed <reed@google.com>
> > > Commit-Queue: Julia Lavrova <jlavrova@google.com>
> >
> > Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> > No-Presubmit: true
> > No-Tree-Checks: true
> > No-Try: true
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> > Auto-Submit: Brian Osman <brianosman@google.com>
> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
>
> Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Ib8e5ec05a5555f34106a0ee61878a8199b82bb82
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448897
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-14 20:32:02 +00:00
Julia Lavrova
ce32c8a074 Reland "Small changes for SkText that are not in experimental directory"
This reverts commit 481a58dfe0.

Reason for revert: Fixing the build

Original change's description:
> Revert "Small changes for SkText that are not in experimental directory"
>
> This reverts commit 92f1bc0083.
>
> Reason for revert: Blocking Android roll.
>
> Original change's description:
> > Small changes for SkText that are not in experimental directory
> >
> > (also made utf 8<->16 conversion static on SkUnicode)
> >
> > Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
> Auto-Submit: Brian Osman <brianosman@google.com>
> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>

Change-Id: I1e5859c9dd943c701d4c4e648bdc3e44412eca54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448676
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-09-14 14:30:22 +00:00
Brian Osman
481a58dfe0 Revert "Small changes for SkText that are not in experimental directory"
This reverts commit 92f1bc0083.

Reason for revert: Blocking Android roll.

Original change's description:
> Small changes for SkText that are not in experimental directory
>
> (also made utf 8<->16 conversion static on SkUnicode)
>
> Change-Id: Ie64d18ad21a35ec10bd0b350fb7887fb78a419d8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448140
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

Change-Id: Ieb9eb0495dddfc0f9e9e74861b24efc0201fd520
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448656
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2021-09-14 13:27:19 +00:00