Commit Graph

1959 Commits

Author SHA1 Message Date
Kevin Lubick
149938e8e3 [canvaskit] Rename some CK-specific defines
The one use of the define in //modules/skottie was in an old
G3 BUILD file which has since been deleted.

Change-Id: I3cbb0dd2bcbff7de433b2d044b3e7a0c34a45240
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509400
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-15 22:42:17 +00:00
Kevin Lubick
7f568e968e [bazel] Update to use emsdk 3.1.4
PS1 regenerates the BUILD.bazel files

This allows us to use closure to minify the JS in canvaskit.js

Change-Id: Ib8326d2e3a19cd2168b740b6946f9165a2810133
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/509177
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-15 17:47:03 +00:00
Kevin Lubick
c13cd6479d Reland "Build CanvasKit using GN/Ninja"
This is a reland of ecac712bec

Changes (best viewed comparing PS1 to latest)
 - Use emsdk 3.1.3 which includes important bug fixes
 - Remove unnecessary steps in compile.sh
 - Fix use of various gn args.
 - Avoid conflicts with Flutter's GN symbols
 - Add/update docs
 - Make activate-emsdk script compatible with our infra.

Original change's description:
> Build CanvasKit using GN/Ninja
>
> Build with
>
> ./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'
>
> or
>
> ./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'
>
> Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I601712a8953c2799fa029e782e097905b95e6b59
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507717
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-15 16:31:10 +00:00
dependabot[bot]
9fae1e741e Bump follow-redirects from 1.13.0 to 1.14.8 in /modules/canvaskit
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.0 to 1.14.8.
<details>
<summary>Commits</summary>
<ul>
<li><a href="3d81dc3237"><code>3d81dc3</code></a> Release version 1.14.8 of the npm package.</li>
<li><a href="62e546a99c"><code>62e546a</code></a> Drop confidential headers across schemes.</li>
<li><a href="2ede36d7c6"><code>2ede36d</code></a> Release version 1.14.7 of the npm package.</li>
<li><a href="8b347cbcef"><code>8b347cb</code></a> Drop Cookie header across domains.</li>
<li><a href="6f5029ae1a"><code>6f5029a</code></a> Release version 1.14.6 of the npm package.</li>
<li><a href="af706bee57"><code>af706be</code></a> Ignore null headers.</li>
<li><a href="d01ab7a5c5"><code>d01ab7a</code></a> Release version 1.14.5 of the npm package.</li>
<li><a href="40052ea8aa"><code>40052ea</code></a> Make compatible with Node 17.</li>
<li><a href="86f7572f93"><code>86f7572</code></a> Fix: clear internal timer on request abort to avoid leakage</li>
<li><a href="2e1eaf0218"><code>2e1eaf0</code></a> Keep Authorization header on subdomain redirects.</li>
<li>Additional commits viewable in <a href="https://github.com/follow-redirects/follow-redirects/compare/v1.13.0...v1.14.8">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.13.0&new-version=1.14.8)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/google/skia/network/alerts).

</details>

This is an imported pull request from
https://github.com/google/skia/pull/93

GitOrigin-RevId: cd866a81a4068daa7417ff084ef9369795b57cb5
Change-Id: I6a5acd8505472d13c9e00fb7965c08632d7dffc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508996
Reviewed-by: Ravi Mistry <rmistry@google.com>
2022-02-15 13:42:38 +00:00
dependabot[bot]
3f2effdbdc Bump karma from 5.2.3 to 6.3.14 in /modules/pathkit
Bumps [karma](https://github.com/karma-runner/karma) from 5.2.3 to 6.3.14.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/karma-runner/karma/releases">karma's releases</a>.</em></p>
<blockquote>
<h2>v6.3.14</h2>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.13...v6.3.14">6.3.14</a> (2022-02-05)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>remove string template from client code (<a href="91d5acda63">91d5acd</a>)</li>
<li>warn when <code>singleRun</code> and <code>autoWatch</code> are <code>false</code> (<a href="69cfc763c8">69cfc76</a>)</li>
<li><strong>security:</strong> remove XSS vulnerability in <code>returnUrl</code> query param (<a href="839578c45a">839578c</a>)</li>
</ul>
<h2>v6.3.13</h2>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.12...v6.3.13">6.3.13</a> (2022-01-31)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump log4js to resolve security issue (<a href="5bf2df3044">5bf2df3</a>), closes <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/3751">#3751</a></li>
</ul>
<h2>v6.3.12</h2>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.11...v6.3.12">6.3.12</a> (2022-01-24)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>remove depreciation warning from log4js (<a href="41bed33bf4">41bed33</a>)</li>
</ul>
<h2>v6.3.11</h2>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.10...v6.3.11">6.3.11</a> (2022-01-13)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> pin colors package to 1.4.0 due to security vulnerability (<a href="a5219c52e2">a5219c5</a>)</li>
</ul>
<h2>v6.3.10</h2>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.9...v6.3.10">6.3.10</a> (2022-01-08)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>logger:</strong> create parent folders if they are missing (<a href="0d24bd937f">0d24bd9</a>), closes <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/3734">#3734</a></li>
</ul>
<h2>v6.3.9</h2>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.8...v6.3.9">6.3.9</a> (2021-11-16)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>restartOnFileChange option not restarting the test run (<a href="92ffe60184">92ffe60</a>), closes <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/27">#27</a> <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/3724">#3724</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/karma-runner/karma/blob/master/CHANGELOG.md">karma's changelog</a>.</em></p>
<blockquote>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.13...v6.3.14">6.3.14</a> (2022-02-05)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>remove string template from client code (<a href="91d5acda63">91d5acd</a>)</li>
<li>warn when <code>singleRun</code> and <code>autoWatch</code> are <code>false</code> (<a href="69cfc763c8">69cfc76</a>)</li>
<li><strong>security:</strong> remove XSS vulnerability in <code>returnUrl</code> query param (<a href="839578c45a">839578c</a>)</li>
</ul>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.12...v6.3.13">6.3.13</a> (2022-01-31)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> bump log4js to resolve security issue (<a href="5bf2df3044">5bf2df3</a>), closes <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/3751">#3751</a></li>
</ul>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.11...v6.3.12">6.3.12</a> (2022-01-24)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>remove depreciation warning from log4js (<a href="41bed33bf4">41bed33</a>)</li>
</ul>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.10...v6.3.11">6.3.11</a> (2022-01-13)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>deps:</strong> pin colors package to 1.4.0 due to security vulnerability (<a href="a5219c52e2">a5219c5</a>)</li>
</ul>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.9...v6.3.10">6.3.10</a> (2022-01-08)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>logger:</strong> create parent folders if they are missing (<a href="0d24bd937f">0d24bd9</a>), closes <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/3734">#3734</a></li>
</ul>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.8...v6.3.9">6.3.9</a> (2021-11-16)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>restartOnFileChange option not restarting the test run (<a href="92ffe60184">92ffe60</a>), closes <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/27">#27</a> <a href="https://github-redirect.dependabot.com/karma-runner/karma/issues/3724">#3724</a></li>
</ul>
<h2><a href="https://github.com/karma-runner/karma/compare/v6.3.7...v6.3.8">6.3.8</a> (2021-11-07)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>reporter:</strong> warning if stack trace contains generated code invocation (<a href="4f23b14d3e">4f23b14</a>)</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="c97e562319"><code>c97e562</code></a> chore(release): 6.3.14 [skip ci]</li>
<li><a href="91d5acda63"><code>91d5acd</code></a> fix: remove string template from client code</li>
<li><a href="69cfc763c8"><code>69cfc76</code></a> fix: warn when <code>singleRun</code> and <code>autoWatch</code> are <code>false</code></li>
<li><a href="839578c45a"><code>839578c</code></a> fix(security): remove XSS vulnerability in <code>returnUrl</code> query param</li>
<li><a href="db53785b3e"><code>db53785</code></a> chore(release): 6.3.13 [skip ci]</li>
<li><a href="5bf2df3044"><code>5bf2df3</code></a> fix(deps): bump log4js to resolve security issue</li>
<li><a href="36ad678320"><code>36ad678</code></a> chore(release): 6.3.12 [skip ci]</li>
<li><a href="41bed33bf4"><code>41bed33</code></a> fix: remove depreciation warning from log4js</li>
<li><a href="c985155a4e"><code>c985155</code></a> docs: create security.md</li>
<li><a href="c96f0c5529"><code>c96f0c5</code></a> chore(release): 6.3.11 [skip ci]</li>
<li>Additional commits viewable in <a href="https://github.com/karma-runner/karma/compare/v5.2.3...v6.3.14">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=karma&package-manager=npm_and_yarn&previous-version=5.2.3&new-version=6.3.14)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/google/skia/network/alerts).

</details>

This is an imported pull request from
https://github.com/google/skia/pull/92

GitOrigin-RevId: 3ea60ab04fd34441badcf9d6aaa4961cffacdf56
Change-Id: I6f6174fe27ae93d4774a299ca8769a4105395780
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507618
Reviewed-by: Ravi Mistry <rmistry@google.com>
2022-02-13 15:18:03 +00:00
Brian Osman
40d7426345 Remove isOpaque from SkRuntimeEffect::makeShader signature
Bug: skia:12643
Change-Id: Id5eecb3445082e747def8c87f99a16552857af3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506462
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-11 16:05:01 +00:00
Kevin Lubick
a59af6e4f2 Revert "Build CanvasKit using GN/Ninja"
This reverts commit ecac712bec.

Reason for revert: possibly breaking flutter, definitely breaking docker wasm builds

Original change's description:
> Build CanvasKit using GN/Ninja
>
> Build with
>
> ./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'
>
> or
>
> ./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'
>
> Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

Change-Id: I04dbb3b1cff7511064f603d7dc7c8a4168bf0d56
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/507616
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-11 13:35:19 +00:00
Harry Terkelsen
ecac712bec Build CanvasKit using GN/Ninja
Build with

./bin/gn gen out/wasm_debug '--args=target_cpu="wasm"'

or

./bin/gn gen out/wasm_release '--args=target_cpu="wasm" is_debug=false'

Change-Id: Ib74586bf8397d57064a3899eaa6da76f9bce9049
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502036
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-11 13:05:44 +00:00
Kevin Lubick
7b5c0de7ce [canvaskit] Improve error when non-matrix argument passed in
Follow-up to https://skia-review.googlesource.com/c/skia/+/506458

This will also make closure not rename the DOMmatrix arguments
(it wasn't happening, but it could have).

Change-Id: Id2e141ce777579d12c5c45a3bfe9661602fed3e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506976
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-10 17:15:55 +00:00
Brian Osman
77326adc07 Remove isOpaque parameter from CanvasKit SkRuntimeEffect APIs
Bug: skia:12643
Change-Id: I285d42c908c75532b78c9b80da7b6145e1b47fe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506458
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-10 17:15:13 +00:00
John Stiles
2122f40c4b Update REPORTER_ASSERT/ERRORF to check format strings.
Previously, REPORTER_ASSERT/ERRORF relied on a helper function named
`reporter_string` which papered over zero-argument and one-argument
messages (where one-argument messages are assumed to ignore printf
formatting rules entirely, and just forward the message as-is).

Replacing this helper with a direct call to `SkStringPrintf` allows
the compiler to check format arguments for correctness, but sacrifices
the one-argument special case. In practice the one-argument special
case was very rarely used, so it's not a significant sacrifice,
and this did uncover several real errors in assertion format strings
(including some cases where the wrong number of arguments was passed).

Change-Id: I4378c43b16fd8fdbf4c78d849a9f2f0a254f7abc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506617
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-10 16:37:05 +00:00
Brian Osman
cd189e8a1d Remove default/deprecated arguments to makeShader calls
Bug: skia:12643
Change-Id: I37e1718a20283dfb814c85260257d57bac2b7b34
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506211
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2022-02-09 20:41:23 +00:00
Kevin Lubick
0fac7baa61 Remove experimental/xform
Requires cr/427505724 to land also.

Change-Id: I88465a234b48abf4b1ac97146c8adcf9638babd0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506396
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-09 19:56:49 +00:00
Kevin Lubick
9cb74e9079 [bazel] Compile gms for wasm and WebGL
PS 1 is re-generating existing BUILD.bazel files
PS 2 is generating BUILD.bazel files for tests/gms
PS 3+ makes modifications to build all of the gms and tests.

It is recommended to view this CL with just a diff between
PS 2 and the end, due to the large amount of generated changes
in PS 1 and 2.

We make a filegroup for the gms and tests because they need
to be compiled as one large blob in order for the registries
to work. Maybe in the future we will break these up, but at least
for WASM/JS, the overhead of starting a browser for each new
test would likely grind things to a halt, so we just group them
all together for now. It's also the most similar to what we
currently do.

In gm/BUILD.bazel and tests/BUILD.bazel, we add a cc_library
that encapsulates all of the deps of the tests, so we can
easily include that the build. These were discovered via
trial and error, not anything automatic or systematic.

The is_skia_dev_build config_setting is very similar to the
GN equivalent from which it was based.

The list of gms and tests to skip (e.g. which are incompatible
with WASM) was determined by building the wasm bundle:

modules/canvaskit$ make bazel_gms_release
tools/run-wasm-gm-tests$ make run_local_debug
# Don't forget to click the button on the screen after the
# browser loads

This way of invoking the tests will be replace soon with
`bazel test <something>`. As such, I didn't bother fully
documenting the current way.

Suggested review order:
 - modules/canvaskit/BUILD.bazel taking note that we always
   use profiling-funcs to make the stacktraces human readable.
 - gm/BUILD.bazel and tests/BUILD.bazel to see the lists of
   gms/tests. Notice the tests are roughly partitioned because
   we don't support things like vulkan/PDF in the wasm build
   and we will want a way to not build certain tests for
   certain configurations
 - tools/* noting some of the cc_libraries added to make
   dependencies easier to add when needed.
 - All other files.

Change-Id: I43059cd93c28af1c4c12b93d6ebd9c46a12d381f
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506256
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-02-09 18:56:17 +00:00
Florin Malita
e5d7a8ec89 Revert "[skottie] Visual-only text valign"
This reverts commit dcafc5d2bc.

Reason for revert: too disruptive for existing g3 asssets

Original change's description:
> [skottie] Visual-only text valign
>
> Historically, Skottie started with vertical alignment based on the
> typographic bounding box.  This was meant to account for empty
> leading/trailing lines.
>
> At some point [1], the strategy was changed to also take the visual
> bounding box into account (union of typographic and visual bounds).
>
> It turns out this is still suboptimal: aligning based on font metrics
> yields poor results in practice, and pretty much everyone expects
> visual-only alignment.
>
> This CL is an attempt to fix things:
>
> 1) update kVisualTop/kVisualCenter/kVisualBottom to use visual bounds
>    only (as their name implies)
> 2) introduce kDeprecatedVisualCenter to preserves the old behavior
>    for compatibility, and use it for the legacy sk_vj flags
>
> The latter is done to minimize disruption for clients which have
> adjusted for the current misalignment: luckily they're mostly using the
> old sk_vj flag instead of explicit resize/valign policies, and they can
> continue to do so without change, while new clients can opt into the
> new/improved valign modes.
>
> The change is guarded by a build flag for g3 staging.
>
> [1] https://skia-review.googlesource.com/c/skia/+/224188
>
> Change-Id: I334c1713ce32635e3649711f072a3dcdf6b12244
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501016
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
> Commit-Queue: Florin Malita <fmalita@google.com>

Change-Id: I633dd54cd04727617e845d24a35e5e8cef64f861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506177
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2022-02-09 14:42:14 +00:00
Herb Derby
2562144c11 rename fontID to typefaceID
Change-Id: Ifb387d315fdd083190128f448aadb3e54c4e3369
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/505198
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2022-02-07 20:12:39 +00:00
Julia Lavrova
14f559fd23 Add SkTypeface::openExistingStream.
Allow users to retrieve the stream from an SkTypeface, but only if that stream is inexpensive to create.

Bug: https://github.com/flutter/flutter/issues/97384

Change-Id: I9bab1a775273363500cf7482f1babeee75c5a3df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503349
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-02-07 17:06:09 +00:00
Florin Malita
dcafc5d2bc [skottie] Visual-only text valign
Historically, Skottie started with vertical alignment based on the
typographic bounding box.  This was meant to account for empty
leading/trailing lines.

At some point [1], the strategy was changed to also take the visual
bounding box into account (union of typographic and visual bounds).

It turns out this is still suboptimal: aligning based on font metrics
yields poor results in practice, and pretty much everyone expects
visual-only alignment.

This CL is an attempt to fix things:

1) update kVisualTop/kVisualCenter/kVisualBottom to use visual bounds
   only (as their name implies)
2) introduce kDeprecatedVisualCenter to preserves the old behavior
   for compatibility, and use it for the legacy sk_vj flags

The latter is done to minimize disruption for clients which have
adjusted for the current misalignment: luckily they're mostly using the
old sk_vj flag instead of explicit resize/valign policies, and they can
continue to do so without change, while new clients can opt into the
new/improved valign modes.

The change is guarded by a build flag for g3 staging.

[1] https://skia-review.googlesource.com/c/skia/+/224188

Change-Id: I334c1713ce32635e3649711f072a3dcdf6b12244
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501016
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2022-02-07 17:04:17 +00:00
John Stiles
87aa7a9095 Add SK_PRINTF_LIKE to existing variadic print functions.
This shook out a handful of formatting issues:
[SkVMVisualizer]
- We were passing plain text like "width:35%;" through printf.
- One particular opcode type was printing a string as a number.
[Skottie, SortToy]
- Used wrong integer type instead of %zu for size_t

This CL does not update print functions which take printf arguments via
variadic template, as __attribute__((format)) does not support this
style. These could be converted to va_list style, but that's not done in
this CL.

(For some reason, GCC requires the attribute to be set on a prototype
for freestanding functions, so a few of these now have a prototype
immediately followed by a declaration.)

Change-Id: I63a6c2486c785cc38563028fdf8df0662ec04935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504698
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-07 14:55:39 +00:00
John Stiles
4250effcc5 Prepare to reenable unreachable-code warnings.
Adding double-parens around an `if ((false))` squelches the warning.
In other cases, you can squelch the warning by assigning the
always-constant(-on-this-machine) check into a constexpr bool.

Change-Id: I5a344fb45779c5bd2865edb3cffaf839ba9a5d85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504597
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-04 21:45:39 +00:00
Kevin Lubick
a803794df7 [canvaskit] Add more features to Bazel build
PS 1 adds particles to the build
PS 2+ ports many of the options from //modules/canvaskit/compile.sh

With this CL, all the CanvasKit tests pass with both the
debug and release build.

Change-Id: Id70f0c16a087109c56949417f940849f2e3b5200
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/504537
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-04 21:33:20 +00:00
Kevin Lubick
e94b52c442 [canvaskit] Add skottie to Bazel build
PS 1 regenerates existing Bazel files
PS 2 adds generated Bazel files to skottie and its dependencies,
as well as incorporating it into CanvasKit.

This changes the version of Bazel we use to 5.0.0 (recently
released).We had been using a pre-release of 6.0 because we
wanted the new features in one of the 5.0 release candidates,
but not the regression that was there (and reverted before the
full 5.0 release). I'd like to stick to the latest stable Bazel
release where possible.

Suggested Review Order:
 - //modules/skottie/BUILD.bazel (this was hand written
   to encapsulate the skottie library). The files in the
   deps are based on skottie.gni.
 - //modules/skresources/BUILD.bazel and //modules/sksg/BUILD.bazel
   which expose all sources
 - //third_party/file_map_for_bazel.json which ignores the
   ffmpeg libraries (we won't actually build the SkVideoDecoder
   stuff because HAVE_VIDEO_DECODER is not set).
 - //modules/canvaskit/BUILD.bazel which makes use of the skottie
   library and includes the interface skottie.js file.
 - .bazelversion which changes the Bazel version used (e.g. by
   Bazelisk).
 - All other changes should be auto-generated or related to
   deleted files.

Change-Id: Ic26f9a9dea5310f2cbd9cda7d701847924a39a22
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503828
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2022-02-04 19:18:27 +00:00
Kevin Lubick
40df2e3cf5 [canvaskit] Expose SkPicture.makeShader
Change-Id: I664d3828ca848e7ce83ca7cdc5fae4bdb7cbc02c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503737
Reviewed-by: Florin Malita <fmalita@google.com>
2022-02-04 15:12:46 +00:00
Kevin Lubick
d66553ba8c [pathkit] Publish 1.0.0
The API has been stable for long enough to start using major versions.

Change-Id: I70bb75c6f4b51d2d76b933898608ee2efc155f3b
Bug: skia:8216
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503738
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2022-02-04 13:11:08 +00:00
Kevin Lubick
cedcaeed01 Reland "[pathkit] Reorganize to be more like CanvasKit"
This is a reland of e138730000

I fixed the tryjobs to move the compiled files into the right
location.

Original change's description:
> [pathkit] Reorganize to be more like CanvasKit
>
> Change-Id: I64226b57161f86277e0635592c2c11442888335a
> Bug: skia:8216
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502817
> Reviewed-by: Nathaniel Nifong <nifong@google.com>

Bug: skia:8216
Change-Id: I535f906b43816d3143e95ff9350ba20b998d817d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503826
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-04 13:10:43 +00:00
Kevin Lubick
b59e38d379 Reland "[pathkit] Increase default memory size and allow growth"
This is a reland of 5268f9d562

Original change's description:
> [pathkit] Increase default memory size and allow growth
>
> Change-Id: Ib403708a8cbdcb85512c341c093d1c1fe342d2b3
> Bug: skia:8216
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502778
> Reviewed-by: Nathaniel Nifong <nifong@google.com>

Bug: skia:8216
Change-Id: I8b63fe28c785ef2fc4fc08cc6b9a076bed34040a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503825
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-03 18:23:17 +00:00
Kevin Lubick
49df61f638 Reland "[fuzzer] Remove GL from (now-Vulkan) build"
This is a reland of 805acda3f3

It fixes the #if SK_GL which was causing the Android roll
to fail.

This disables unit tests on Test-Ubuntu18-Clang-Golo-GPU-QuadroP400-x86_64-Release-All-TSAN_Vulkan
which were consistently crashing with OOM.

Original change's description:
> [fuzzer] Remove GL from (now-Vulkan) build
>
> The fuzzer runs against the Vulkan version of Swiftshader.
> There are no libGL.so (etc) on the fuzz runtime, so we
> want to avoid linking against those.
>
> The GL code that is #ifdef'd out is still necessary to
> avoid timeouts on TSAN with our NVIDIA jobs.
> https://skia-review.googlesource.com/c/skia/+/502638
>
> Procedure for testing this locally (and iterating):
>   1. In oss-fuzz checkout, run
>      `python infra/helper.py shell skia`
>      to pull up local interactive version of Docker
>      fuzzer build image.
>   2. Run `compile` in fuzzer shell. Stop after
>      the swiftshader compiles and is copied into /out
>      with Ctrl + C.
>   3. Comment out the swiftshader compilation part [1]
>      (no need to re-do this when modifying Skia code).
>      `apt-get install nano -y`
>      `nano ../build.sh`
>   4. Make change to Skia repo using normal methods.
>   5. Run the following in the Skia repo
>      `git diff origin main > foo.patch`
>      Copy the patch into the Docker shell using Ctrl+C
>      and nano.
>   6. Apply the patch inside the Docker shell
>      `git apply foo.patch`
>      and re-compile (which should skip right to
>      building the fuzzer libs)
>      `compile`
>   7. Repeat 4-7 or make small changes directly in
>      the Docker shell via nano.
>   8. When compilation and link succeeds, run
>      `ldd /out/api_mock_gpu_canvas`
>      to verify GL and friends were not dynamically linked.
>
> [1] https://github.com/google/oss-fuzz/pull/7214/files#diff-76f13875e33875cdd372f1f0933206be599cd87952f1bd1eaa57ca928ee9e3e1R49-R53
>
> Change-Id: Idf569820527c1304b0e5a68fd36295be89dfa2a0
> Bug: oss-fuzz:44132
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503016
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Kevin Lubick <kjlubick@google.com>

Bug: oss-fuzz:44132, skia:12900
Change-Id: Ia2eff9403b0035e7f86098f296d7d9b1bbfd4876
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503716
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2022-02-03 18:07:47 +00:00
Kevin Lubick
ec4b8f1d05 Revert "[pathkit] Increase default memory size and allow growth"
Revert submission 502817

Reason for revert: Failing tests
Reverted Changes:
I64226b571:[pathkit] Reorganize to be more like CanvasKit
Ib403708a8:[pathkit] Increase default memory size and allow g...

Change-Id: Ia5d8c24dd61807cb24342d55d8541e459280d429
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503740
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Kevin Lubick <kjlubick@google.com>
2022-02-03 16:03:10 +00:00
Kevin Lubick
c6a311d2ca Revert "[pathkit] Reorganize to be more like CanvasKit"
Revert submission 502817

Reason for revert: Failing tests
Reverted Changes:
I64226b571:[pathkit] Reorganize to be more like CanvasKit
Ib403708a8:[pathkit] Increase default memory size and allow g...

Change-Id: I74ebd8cde4a2b60b113574115d353576bd362310
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503739
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-02-03 16:03:10 +00:00
Kevin Lubick
e138730000 [pathkit] Reorganize to be more like CanvasKit
Change-Id: I64226b57161f86277e0635592c2c11442888335a
Bug: skia:8216
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502817
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-03 15:40:56 +00:00
Kevin Lubick
5268f9d562 [pathkit] Increase default memory size and allow growth
Change-Id: Ib403708a8cbdcb85512c341c093d1c1fe342d2b3
Bug: skia:8216
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502778
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-03 15:40:56 +00:00
Kevin Lubick
d86814d8a8 [canvaskit] Deploy 0.33.0
Change-Id: I07591580ace4d14b91922ebcef84f9e138509906
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503696
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2022-02-03 15:23:00 +00:00
John Stiles
ffeb6f2339 Remove SkSL::String class.
The previous CLs have removed the last significant differences between
SkSL::String and std::string. This CL removes SkSL::String entirely and
replaces it with std::string throughout the code.

Apologies for the very long CL, but I have done my best to make it as
simple and reviewable as possible. The vast majority of changes are
simple replacement of `SkSL::String` with `std::string`. In the rare
spots where code is moved from one place to another, it is logically
unchanged.

Change-Id: I39563d2db45da229f17f4504dfd63e00bde7a96e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503339
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-03 14:59:16 +00:00
Kevin Lubick
de29ec3ac6 [canvaskit] Add 1d and 2d PathEffects to API
Change-Id: I7858d5bb4dd3425557b801782880476f983e1fe2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/503416
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-02-02 20:00:20 +00:00
Kevin Lubick
dba5d2c97c [ck] Expose ParagraphBuilderImpl::Reset to CanvasKit
See also https://skia-review.googlesource.com/c/skia/+/499236

Bug: https://github.com/flutter/flutter/issues/97182
Change-Id: Ib905b0e2dc62b8eae6d24d116ed4e1f5bf6614e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499877
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-02 15:54:21 +00:00
Brian Osman
0769d45c68 Implement SkTLazy using std::optional
Change-Id: I3d3f175892d23ff5db2c14600c5168273fca8efb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501840
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-02-01 19:51:21 +00:00
Kevin Lubick
d31c6a9db1 [canvaskit] Change contexts when making surfaces from GrContext
Suggested by jason-simmons
https://github.com/flutter/flutter/issues/95259#issuecomment-1026390189

Change-Id: Id523648dc4d8db261577f2cf4b46d52cc3335451
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502310
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-01 15:56:04 +00:00
Kevin Lubick
06acd1d194 [canvaskit] Fix MakeRenderTarget
Change-Id: I86c296ff2dad8f915e75dd71301cf43f36ce6e00
Bug: skia:12862
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500438
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-01 15:42:37 +00:00
Kevin Lubick
aa2579cce0 [canvaskit] Include WebP and JPEG encoding in npm version
Change-Id: I3086129d6fd7e3505a93bf8157b55ad2c5096902
Bug: skia:12853
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500376
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-01 15:42:37 +00:00
Julia Lavrova
24a8aa9d1f Updating the API description for Flutter
bug: skia:12850
Change-Id: I78148b2d99701a9127c377ddf709c89a885fcfc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502312
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-02-01 15:36:41 +00:00
Kevin Lubick
102dbf9c43 [canvaskit] Disable dynamic execution
This required an update to emscripten, due to there being
a few bug fixes regarding the non-dynamic code and the
Closure compiler/minifier.

Change-Id: Icc922bd98cdd52a6923a9367da3747dac2b897b3
Bug: skia:12795
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492916
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-01 13:15:22 +00:00
John Stiles
9ac97cf56d Undo various C++14 compatibility fixes.
This CL rolls back various changes from http://review.skia.org/457298
which made the code longer or more complex. They are no longer needed
now that we compile in C++17 mode.

A few changes were left as-is because they seemed equally good either
way.

Change-Id: I4eb0fe3d12382bcb485abb5222a0f00411742191
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502296
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-31 16:55:20 +00:00
Kevin Lubick
994c946bd3 [canvaskit] Add API to re-use Image textures and reduce flickering
This creates a new SkImage with the same texture and changes it
out without the user noticing (or needing to delete the old Image).

Change-Id: I3a1ce6d4a335873f2b7670d56dadfccdc7881c38
Bug: skia:12723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495556
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-01-31 14:00:48 +00:00
John Stiles
952bcb0732 Re-enable SkSL tests in CanvasKit/wasm.
We can disable SkSL tests on a case-by-case basis via the skip list in
`run-wasm-gm-tests.html`. This doesn't allow us to exclude by GPU, but
in practice the Golo machines tend to all have a uniform setup (with
Quadro P400s) so we can just work around failures as they come up.

Change-Id: I46f709691282e576d00d5191e9dbd46b740e4a5f
Bug: skia:12876
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501682
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-28 16:22:33 +00:00
John Stiles
d50db53f37 Disable SkSLTest on wasm.
Only one SkSL test is broken at the moment, but I don't have fine-
grained controls for test disables in wasm.

Change-Id: Ic44b4d6d660d4cb382d18cccf07574318b982d5a
Bug: skia:12876
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501438
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-27 21:56:18 +00:00
John Stiles
f07421bcbd Remove unnecessary ctors now that we have C++17 copy-elision.
This CL backs out C++14 compatibility changes from
http://review.skia.org/457298 :

"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."

Change-Id: I33a833d33b221e757bf6a6459835a7215b4e6b66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/501240
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-27 20:26:54 +00:00
Florin Malita
e3ecc34f01 [skottie] Fix text error logging
Don't clear the logger until we actually see some errors.

Change-Id: I275e99a6f2748dff1456a471daabb142fd1a10f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/500996
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2022-01-27 16:06:41 +00:00
Kevin Lubick
c4b2fb39b1 [canvaskit] Use proper texture tracking method
The emscripten generated GL texture tracking code uses an
integer, not the length of the textures array.
a8e7d3b8f2/src/library_webgl.js (L242)
I believe this is to make sure a texture and buffer do
not share the same handle.

Therefore, we must use this method when making our own
additions to the textures array, otherwise Skia-created
textures will overlap with supplied textures, causing
mis-drawings and feedback loops.

Change-Id: I4e1be5ff2b0c3d1ba5f5984232980724cb492313
Bug: skia:12797
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495416
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-01-26 19:53:05 +00:00
Justin Novosad
cec7f5dec5 Add willReadFrequently 2d context creation attribute where appropriate.
This change add the willReadFrequently HTML canvas 2d context creation
attribute in cases where we know the canvas is used for readbacks.

See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

The API will soon be launched in chromium-based browsers.

The objective of this change is to optimize performance and avoid
possible performance regressions when the new API feature goes live
in major browsers.

Change-Id: If0b54d2d2243db4e9ac6d685d793ab2008973b8c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/496881
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-26 15:31:39 +00:00
dependabot[bot]
1d9471f553 Bump follow-redirects from 1.13.0 to 1.14.7 in /modules/pathkit
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.13.0 to 1.14.7.
<details>
<summary>Commits</summary>
<ul>
<li><a href="2ede36d7c6"><code>2ede36d</code></a> Release version 1.14.7 of the npm package.</li>
<li><a href="8b347cbcef"><code>8b347cb</code></a> Drop Cookie header across domains.</li>
<li><a href="6f5029ae1a"><code>6f5029a</code></a> Release version 1.14.6 of the npm package.</li>
<li><a href="af706bee57"><code>af706be</code></a> Ignore null headers.</li>
<li><a href="d01ab7a5c5"><code>d01ab7a</code></a> Release version 1.14.5 of the npm package.</li>
<li><a href="40052ea8aa"><code>40052ea</code></a> Make compatible with Node 17.</li>
<li><a href="86f7572f93"><code>86f7572</code></a> Fix: clear internal timer on request abort to avoid leakage</li>
<li><a href="2e1eaf0218"><code>2e1eaf0</code></a> Keep Authorization header on subdomain redirects.</li>
<li><a href="2ad9e82b62"><code>2ad9e82</code></a> Carry over Host header on relative redirects (<a href="https://github-redirect.dependabot.com/follow-redirects/follow-redirects/issues/172">#172</a>)</li>
<li><a href="77e2a581e1"><code>77e2a58</code></a> Release version 1.14.4 of the npm package.</li>
<li>Additional commits viewable in <a href="https://github.com/follow-redirects/follow-redirects/compare/v1.13.0...v1.14.7">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.13.0&new-version=1.14.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language

You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/google/skia/network/alerts).

</details>

This is an imported pull request from
https://github.com/google/skia/pull/90

GitOrigin-RevId: ccf8ab9b6586a37a3f0d6493f53f3b41b92df8a4
Change-Id: Ib65fd507953eaf3bf880b508586856cb51e7f01b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495616
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2022-01-26 14:01:50 +00:00
Dan Field
dc17274403 ParagraphBuilder::Reset
Allow callers to reset the ParagraphBuilder to an initial state for
reuse and caching.

Bug: https://github.com/flutter/flutter/issues/97182
Change-Id: Ifc80bdd53a1c68d4bfe355c74bbefa27b1d2d7de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499236
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Dan Field <dnfield@google.com>
2022-01-25 19:24:40 +00:00
Florin Malita
1a9e7531e0 [skottie] Fix text opacity animator semantics
The current implementation uses multiplicative composition for opacity
animators (modulate_opacity always scales the new opacity by the old
value).  That means that if one animator drops opacity all the way to
zero, there is no way for subsequent animators to increase opacity.

Instead, AE seems to use the same interpolation as for colors
(prev value/animator value, based on modulation param).

Update to use similar interpolation for opacity properties, and also
to only apply when opacity props are actually specified for a given
animator.

Change-Id: I5a96f9e3722399c8ec661a7843c86dfa60eac5ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499376
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2022-01-25 17:58:15 +00:00
Ben Wagner
83c85affad Avoid calling hb_face_set_index with uninitialized value.
If an SkTypeface stream exists and is a memory based stream an hb_face
may be created directly from the memory. In this case the collection
index was set when the stream was retrieved and the hb_face is created
with this index. Otherwise, the hb_face is created by table callback. In
this case the stream may or may not have been successfully retrieved. If
the stream was successfully retrieved the hb_face index should be set to
the collection index retrieved with the stream. Otherwise, the hb_face
index should not be set.

Change-Id: I2568fecb1096d1a2e7f529342668ea443a8615c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499136
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2022-01-25 14:15:37 +00:00
Brian Osman
a1fd1c189c Mark operator bool() explicit in src, tests, and modules
Change-Id: Ic664ad0134d61dcf939dcf585a81d53e29c6afcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/496597
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
2022-01-19 15:10:45 +00:00
John Stiles
cabc3f5209 Fix Typescript type hints for CanvasKit debug traces.
The tests for these methods are only handled in Javascript, so the type
mismatches weren't detected until I tried using the calls in Typescript
later.

Change-Id: Ifb233f871be1146d3f059b166b7de40bb401d4c9
Bug: skia:12818
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495417
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-14 17:13:49 +00:00
John Stiles
575d0c5e1d Add CanvasKit bindings for RuntimeShader.MakeTraced.
To save space, debug trace bindings can be disabled by turning off
SK_INCLUDE_SKSL_TRACE. Most clients shouldn't need them.

Change-Id: Ifadc05b3eeed95def334fa7e0755f61caeef27f0
Bug: skia:12818
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/494244
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2022-01-13 14:08:54 +00:00
Kevin Lubick
6e63f4925e [bazel] Use font manager in HelloWorld.
This documents the various factory settings (I kept getting
confused as to what each was doing).

Additionally, this makes setting the factory flag bring in
the dependent code as well (like our current GN rules do).

Change-Id: I93437651b078baac04433c14c573a95982b7bc15
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493396
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-01-11 16:22:52 +00:00
Florin Malita
3e1354a592 [skottie] Fix assert for missing layer type
When the layer type is missing, fType == -1 and we rely on unsigned
(size_t) underflow + check against the known types array size to catch
the condition.

The problem is SkToSizeT() itself asserts the input is a valid size_t,
and even if it didn't clusterfuzz would likely complain about
underflowing.

Refactor to check for negative values explicitly.

Bug: b/200660146
Change-Id: Iae74dca14ac0202ffcdd4449f0d470063916eff5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493116
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2022-01-10 18:52:39 +00:00
Florin Malita
dd575bc0f1 [skottie] Fix float->int overflow
We do test for and catch int overflows, but after casting -- which is
enough to trip clusterfuzz.

Refactor to catch upfront.

Bug: b/200722666
Bug: b/200663331
Bug: b/200662108
Change-Id: I26da4b1ca21ad0bc34384e957a30211402219841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/493018
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2022-01-10 15:46:52 +00:00
Kevin Lubick
048545d249 Set up basic hello world sk_app
Change-Id: I233e7653eadcce87067def841b2f28c700f96045
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492096
Reviewed-by: Brian Salomon <bsalomon@google.com>
2022-01-06 20:29:35 +00:00
Julia Lavrova
85a7045856 Fixing some getRectsForRange issues
This fix only affects 2 very specific cases used for text selection
in Flutter (via getRectsForRange).

bug: skia:12785
Change-Id: I22d141210d129d78ed028592162fef02b9120292
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491450
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2022-01-06 18:53:23 +00:00
Kevin Lubick
96e4053be7 Update Bazel files
- Use latest emscripten toolchain (3.1.0)
 - Autogenerate the atoms and manually fix some of the file lists.
 - Add a known_good_builds target to bazel/Makefile to help
   check the things we expect to work with Bazel.

Change-Id: Ia5f51e7b9eb5c108386820ad59180c8f862f5a70
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491438
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-01-06 18:10:57 +00:00
Jason Simmons
67dd028ae0 Avoid scanning for bidi levels if the paragraph is unidirectional
Change-Id: I789efe0d6992d637ec688a9a841ece89738dd6d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/486336
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2022-01-06 17:39:50 +00:00
Jason Simmons
53bf2fa77a Remove obsolete SkBidiIterator_icu::getBidiRegions method
Change-Id: I9afbb79d6538f40d4f1fe06d91b7d5790124bfe5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487478
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2022-01-05 17:31:54 +00:00
Lei Zhang
7f99e8d824 Remove SkM44.h include from SkImage.h.
It is not needed there. Add it to files that do need it instead.

Change-Id: I2fa32d423972c4c91c4fbfe5508bd50323201714
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/463556
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Lei Zhang <thestig@chromium.org>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2021-12-23 13:45:20 +00:00
Brian Osman
1ba283e6b4 In GPU CanvasKit, default to sRGB surfaces
Change-Id: I1931b09e6a4a52fb7d91a0d3f013e1d0519919dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487977
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-22 18:13:49 +00:00
Kevin Lubick
16a06174df [canvaskit] Release 0.32.0
Change-Id: Ic9f345a37f409108c4c4252b3d2d0c8b6255a78a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485156
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-12-15 18:05:58 +00:00
Kevin Lubick
68a364c9bc [canvaskit] Reset GrContext after lazy-loading image from texture
The issue was Skia would be in the middle of drawing when it
needed to lazy-load the image's texture. This would mess up the
bound texture in WebGL, but Skia didn't know that. As a result,
it would not realize that some of the work had been undone.

Calling resetContext() makes Skia aware of this fact, so it can
adjust its behavior.

Change-Id: I5e62987546be8d63d13c906dfab3bc92cf3120cd
Bug: skia:12740
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485016
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-15 15:11:41 +00:00
Jorge Betancourt
68e240d9cd add sharpen effect support to skottie player
Change-Id: I3242897c00b3cbe84c5ec964831df0fd4ae45622
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481556
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-12-14 19:44:26 +00:00
Jason Simmons
ddbf93159f Move Run per-glyph data into an object held in a shared_ptr
This will reduce memcpy overhead when runs are copied into a paragraph
or when paragraph cache entries are read or written

Change-Id: Id81725f3d8fc70daa17d154093ae7bc8b519118c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/483022
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2021-12-13 22:24:30 +00:00
Brian Osman
3695bdb587 Refactor SkMatrixProvider slightly
There was only one virtual method, so switch that to a bool stored in
the base class. The derived types exist as hints for the reader, and an
easy way to adjust how the new localToDevice is constructed.

With this change, we don't need SkSimpleMatrixProvider. SkMatrixProvider
is concrete, so we can use it directly. SkOverrideDeviceMatrixProvider
no longer needs the original provider for anything, so remove that
parameter. It now exists solely to inhibit the hitsPixelCenters flag.

Fix a few spots (SkParticleBinding, some sites in SkRuntimeEffect) where
we used SkSimpleMatrixProvider, even though the local coordinates being
passed did not obey the hits-pixel-centers constraints.

Most importantly, document how localToDeviceHitsPixelCenters works.

Change-Id: Ibe9060bac0822d0edf52a507d390bd198d8e6dbd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482176
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-09 20:10:58 +00:00
Jorge Betancourt
27db7e6e2a move duplicate code to common SkSLEffectBase class
Change-Id: I9f4100bdb09a2fc0e940c007bf5cca0edec24e7c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480429
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-12-09 19:45:35 +00:00
Jason Simmons
d8e29e09c8 Call SkFont::getBounds once per run in ShaperHarfBuzz::shape
Change-Id: Ie5d4ff977d5952423f5679387fae98d377489c0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481796
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-12-09 19:37:03 +00:00
Kevin Lubick
44c81d1492 [canvaskit] Add frame duration and docs
Also clean up some more findMarkedCTM references.

Change-Id: I29a52e1157691c86992e70a3774b984e5383e3ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482005
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2021-12-09 18:53:23 +00:00
Brian Osman
ca916f705f Remove canvas marker stack, marked matrices, etc...
This entire API existed, but was unused (no longer connected to
drawVertices or runtime effects).

In theory, we could further simplify some of the matrix providers, but
more importantly - I have serious doubts about the correctness of
localToDeviceHitsPixelsCenters for most of them.

Change-Id: If5af182015dd96e5ed3353a117223e8dbbe17097
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481683
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-09 16:22:16 +00:00
Kevin Lubick
5d1d92c505 [canvaskit] Add rough measureText to Canvas2D emulation layer
I wanted to use SkParagraph myself, but the API is a little
awkward right now in that I cannot just pass in a SkFont object
(which I have) - I would have to make a FontCollection, which
we lack the ability to do so.

Change-Id: I1488fb9c1a42af020a245a792b8e266c809b599a
Bug: skia:12705
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481238
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-12-09 13:07:24 +00:00
Jason Simmons
c307c5566d Efficiency improvements to SkParagraph ParagraphCacheKey
* Compute and store the hash in the ParagraphCacheKey ctor
* Move the ParagraphCacheKey into the ParagraphCacheValue during construction

Change-Id: If267fe6757c6a6bf7528f4dcc838e88f5458946f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481239
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2021-12-08 18:55:59 +00:00
Kevin Lubick
58a768b68f [canvaskit] Fix test search path
Change-Id: Ifb7a4191d43d1875da945a5f3af2d1bed62ee915
Bug: skia:12715
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480236
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-12-07 19:43:27 +00:00
Gregg Tavares
5f9ec39daf Wrap SkImage into HTMLImage
Canvas-wasm says it's a drop in replacement for the Canvas API.
Unfortunately HTMLCanvas.decodeImage returns an SkImage which
has functions width() and height() for getting the width and height
of an image whereas HTMLImageElement has properties width and height.

Lots of existing code uses width and height so wrapping this
would seem to make it more closely match expectations.

Bug: skia:12705
Change-Id: I62c4f655c58f6806e836700e03b946a91f3e518d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/479936
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-12-06 20:05:42 +00:00
John Stiles
dfc7f31bd1 Create a public base class for debug traces.
SkRuntimeEffect needs an API for generating debug traces. This means
that we will need references to debug traces inside a public header.
Rather than reference SkVMDebugInfo directly, we now have a simpler
base class for debug traces. This is better suited to landing in
include/.

I've also renamed SkVMDebugInfo to SkVMDebugTrace for consistency, since
it now contains all the trace data. (When it was first added, it only
had the slot info.)

Change-Id: Ibaa4dedf9a17b9462b4f233a28a7b875d0317892
Bug: skia:12708
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/480356
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-12-06 18:22:51 +00:00
Kevin Lubick
aef2b63743 [canvaskit] Use closure in release Bazel builds
We don't need to use the env variable EMCC_CLOSURE_ARGS,
as per https://github.com/emscripten-core/emsdk/pull/941

We can use --closure-args to pass the externs file in
instead, which is much easier to configure.

Change-Id: I2dcfbca6307438e76fb374741bb6b33ef296be15
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478307
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-12-01 15:59:41 +00:00
Kevin Lubick
4bd08c52c0 [infra] Add SkParagraph (harfbuzz, ICU) to Canvaskit Bazel build.
As a follow-up to https://skia-review.googlesource.com/c/skia/+/476219,
this sketches out how we can maybe use cc_library for the things
in //modules to make sure something in //src doesn't depend on
anything in //modules, for example.

The following succeeds:
bazel build //modules/skparagraph:skparagraph --config=clang \
  --shaper_backend=harfbuzz_shaper --with_icu

As does `make bazel_canvaskit_debug` in //modules/canvaskit

Suggested Review Order:
 - third_party/BUILD.bazel for ICU and harfbuzz rules. Pay
   special attention to the genrules used to call the python
   script for turning the icu .dat file into .S or .cpp.
 - bazelrc and bazel/ for new flags and defines that control
   use of ICU and harfbuzz. Unlike GN, with the public_defines
   that get added in automatically if icu or harfbuzz is
   depended upon, we need to set the defines at the top level.
   This necessity might go away if we change the atoms to
   depend on //modules/skshaper, which could define that flag.
 - Top level BUILD.bazel files in //modules/skparagraph,
   //modules/skshaper, //modules/skunicode, //modules/canvaskit
 - All other .bazel file changes are automatic.

Bug: skia:12541
Change-Id: I38a9e0a9261d7e142eeb271c2ddb23f362f91473
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/478116
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 21:01:06 +00:00
Kevin Lubick
6ba9f702ba [bazel] Try adding cc_binary rules that use generated rules
To make the atomic rules a bit easier to work with, in many
of the folders, this adds in cc_library rules to group
together the sources from that folder (and subfolders
where prudent). We only needs sources because those atoms
should have their headers as deps.

One issue that was pointed out is that there is currently
no way to restrict the inclusion of certain packages,
a la, `gn check`. For example, there is no mechanism from
stopping a dev from adding
#include "modules/canvaskit/WasmCommon.h"
to something in //src/core (except circular dependencies).
We can probably address that using Bazel's visibility
rules as needed:
https://docs.bazel.build/versions/main/visibility.html
https://docs.bazel.build/versions/main/be/functions.html#package_group

It is recommended to look at this CL patchset by patchset.
PS1: Update gazelle command to generate rules in more folders.
PS2: A few changes to make generation work better.
PS3: The result of running make generate in //bazel
PS4: Adding the rules to build sksllex, the simplest binary I
     could find in the Skia repo.
PS5: Adding the rules to build skdiff, a more complex binary.
     I tried a few approaches, but ended up gravitating back
     towards the layout where we have each folder/package
     group up the sources. I imagine at some point, we'll have
     skdiff depend on skia_core or something, which will
     have things like //src/core, //src/codecs, //src/pathops
     all bundled together.
PS7: Added in the groupings of sources, similar to what we had
     earlier. I liked these for readability. These helped fix
     up the //:skia_core build, and by extension, the CanvasKit
     build.

Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 18:18:53 +00:00
Florin Malita
15949beef2 [skottie] Fix mask feather tiling
We currently default to kClamp, but for mask feathers we want kDecal.

Bug: skia:12676
Change-Id: I7e3e21c310823987819e7374b494de4a48d9cae6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477297
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
2021-11-29 22:50:06 +00:00
Kevin Lubick
37a489c3a4 [canvaskit] Fix examples and tests of drawPatch and drawVertices
Change-Id: Iab8c085fad220930b838a281834a402f8d96c2af
Bug: skia:12662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477437
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-29 18:54:52 +00:00
Kevin Lubick
9488e0237d [infra] Experiment generating BUILD.bazel files
This uses the gazelle extension from
https://skia-review.googlesource.com/c/buildbot/+/473357

Review Tips:
 - Ignore any changes to .h or .cpp files. Those have been
   pulled out into their own CLs.
 - Start with bazel/macros.bzl.
 - Read the CL with the generation code, if you haven't already.
 - Look at third_party/file_map_for_bazel.json.
 - See experimental/bazel_test for an idea of how a cc_binary
   would be made.
 - Spot check one or two of the BUILD.bazel files.

This CL generates the "atomic" rules for src/, include/ and
modules/skshaper, as a starting point.

`bazel build --config clang //include/...` works

`bazel build --config clang //src/...` starts compiling,
(which verifies that the BUILD.bazel files are all valid),
but runs into errors because not all third_party deps have
been resolved, and there are some files missing from the
toolchain still (e.g. EGL headers).

Change-Id: Ib7e0fb0efdb9f08655f06cbc56e9bb4cf416294b
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/474240
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-23 18:53:16 +00:00
Jorge Betancourt
1bbc6e5cef add plumbing for color filter SkSL effect
Change-Id: I26b28ff4756cda921e4acef32f3da3b43b1fc28f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472936
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
2021-11-23 16:30:40 +00:00
Jim Van Verth
3b0eacc6ea Add SkSL::ShaderCaps and use as base class for GrShaderCaps
Bug: skia:12559
Change-Id: I76b225c9ca81264a15869324007d774d210053b5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/473416
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-11-19 16:35:39 +00:00
Kevin Lubick
f3726c61d2 [infra] Use Bazel transitions to allow cc_binary to set their own flags
This will hopefully let us pre-package certain binaries (e.g. DM,
fuzz) with more sensible defaults and not make the developer
type out all the settings.

For CanvasKit, which specifies its own build flags, I think I'll
need to make another transition setup, which would go in something
like modules/canvaskit/ck_binary_with_flags.bzl or something.

Some sausage-case-names were converted to snake_case_names as per
go/build-style#target-naming

The example this is based off is worth a look through before
diving into this:
https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts


Change-Id: Ia919d47f4d1aa25cf294af7918e36d38838c179e
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472688
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-18 19:18:54 +00:00
Jorge Betancourt
3868636fb8 discard SkRuntimeEffect builder in SkSLEffect to use lower level API
Change-Id: I20bb5e6463e79bcdd56fd614d9936fdaf65aefcc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471776
Commit-Queue: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-11-17 15:51:38 +00:00
Kevin Lubick
cf1e959c65 [canvaskit] Expand Bazel rules to include Canvas2D compat layer
Importantly, this adds options for encoding using
certain codecs, not just decoding.

Change-Id: I4a610ebf985b67d4545c71b3f3eed4c7807e6a26
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472277
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-17 13:06:35 +00:00
Kevin Lubick
888d4efa77 [canvaskit] Add Freetype/Fonts to Bazel Build
This re-works src/ports/BUILD.bazel to work like our other
BUILD files, i.e. one rule "srcs" that brings in the necessary
private filegroups.

To work around an abort with LLVM [1], we have to go back to an
earlier version of emscripten (temporarily?).

Future work should look at using transitions [2] to allow various
executables (e.g. CanvasKit, DM) to set their own set of Bazel
flags, w/o the build invokers having to specify them.

These transitions might be able to handle more complex cases
that we currently use if statements in GN to deal with.

The Freetype build rule was created by taking the BUILD.gn
rule, adding in all the sources listed there and then playing
compile-whack-a-mole to add in all the headers and included
.c files.

Suggested Review Order:
 - third_party/BUILD.bazel to see freetype build rules
 - bazel/common_config_settings/ to see treatment of fontmgr
   like codecs (many possible) and fontmgr_factory (only one).
 - src/ports/BUILD.bazel
 - BUILD.bazel
 - modules/canvaskit/BUILD.bazel. Take note of the gen_rule that
   calls tools/embed_resources.py to produce the .cpp file
   containing the embedded font data.
 - Everything else.

[1] https://github.com/emscripten-core/emscripten/issues/15528
[2] https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts
Bug: skia:12541
Change-Id: I08dab82a901d80507007b354ca20cbfad2c2388f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471636
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-17 13:06:35 +00:00
Julia Lavrova
8a4ba51fa7 Flutter RTL/LTR positioning fix
Bug: skia:12647
Change-Id: I7de8931183c3ed9ae82864ed766fff9a196e856c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471777
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-16 20:23:05 +00:00
Kevin Lubick
350d46daac [canvaskit] Deploy 0.31.0
Change-Id: I93c9bafae99b116a8efb012e3a82c000843d8eb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472380
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-11-16 18:44:05 +00:00
Kevin Lubick
ef3d6af042 [infra] Add POC Bazel rules for CanvasKit
Many things are not enabled currently (e.g. Skottie, Paragraph),
but we can render many APIs using WebGL.

To turn on Paragraph, etc, we'll need to tackle fonts, which
is a separate effort.

This also changes where the build artifacts go. ./build/ is
easier to deal with than the old way of sticking them in
./npm_build/bin

Change-Id: Ia377360af580a887d03630670438fea2e3157e90
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470682
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-12 21:38:46 +00:00
Kevin Lubick
799abb7bb8 [canvaskit] Set unsupported WebGL caps to false
The defaults were true for these, but if there was no
support, they should be set to false.

This was causing some warnings from the console, like:
WebGL: INVALID_ENUM: enable: invalid capability

Change-Id: I53b6120c969174a9ecd6d47df001870c71231352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470737
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-12 18:04:03 +00:00
Kevin Lubick
e393e72484 [canvaskit] Add ImageInfo to Texture APIs
Change-Id: Ib030c1ab47a1d1338518815915a5f59e7f9d606c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470736
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-12 18:03:38 +00:00
John Stiles
6df1871cc2 Replace fSkVMDebugTrace program setting with SkVMDebugInfo.
When calling ProgramToSkVM, you can now pass in a pointer to an
SkVMDebugInfo struct. Passing in this pointer now enables trace opcodes,
removing the need for a dedicated `fSkVMDebugTrace` flag.

In this CL, the struct is empty, but in followup CLs it will contain
mapping tables that can be used to translate trace instructions into
human-readable results (e.g. slot numbers to variable names).

Change-Id: I6b38ec559723babed1f6d2efc4c5c2579c3b99db
Bug: skia:12614
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470398
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-11-12 14:13:14 +00:00
Kevin Lubick
8ed49ea6e3 [infra] Add Bazel rules for codecs.
This ports the third_party BUILD.gn files related to codecs
(with a best-effort on arm/SIMD stuff). This includes:
 - libpng
 - libjpeg-turbo
 - libwebp
 - wuffs (gif)
 - libgifcodec
 - dng_sdk and piex (raw codec)

This expands the string_flag_with_values macro to allow
multiple values to be set at once. This was added in Bazel 5.0.0,
however the latest pre-release version of that has a bug [1]
which slows down compilation dramatically. This was fixed at
ToT, but not released. As a result, I started using the Bazel
6 pre-release (via bazelisk).

The macro select_multi makes writing select() where multiple
elements could be on possible/easier.

One can try compiling certain codecs by running:
bazel build :skia-core --config clang --include_codec=raw_codec --include_codec=png_codec

Suggested Review Order:
 - bazel/macros.bzl
 - bazel/common_config_settings/defs.bzl and its BUILD.bazel
   to see how the codec options are defined.
 - BUILD.bazel to see how the codec settings are used.
 - src/codec/BUILD.bazel to see the inclusion of Skia files to
   deal with specific codecs.
 - third_party/BUILD.bazel (while referencing the corresponding
   BUILD.gn files, such as third_party/libwebp/BUILD.gn)
 - Everything else.

Change-Id: I797375a35fa345d9835e7b2a2ab23371c45953c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469456
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2021-11-11 20:10:01 +00:00
Kevin Lubick
cb94b57ad2 [canvaskit] Add ability to make texture image across surfaces.
Change-Id: Ie82e8257c9f0990d3be99a2429e034ac400b9580
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469759
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-11 17:32:30 +00:00