Commit Graph

2777 Commits

Author SHA1 Message Date
Michael Ludwig
5ef07a4097 Remove deprecated offset filter header
Bug: skia:11230
Change-Id: I509a20b1b1ffa17b125289f9619692638a13a621
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371964
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-24 00:34:30 +00:00
Mike Reed
8f8e7335a5 Flutter does use legacy image.makeShader()
Bug: skia:7650
Change-Id: I779944e25b8ca241a60f2c2880c95460b5f20545
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374596
Reviewed-by: Mike Reed <reed@google.com>
2021-02-23 22:01:49 +00:00
Brian Salomon
066f411b2a Remove GrConvexPolyEffect::Make() that takes SkRect, use GrAARectEffect.
Also split out the rect test cases from convex_poly_effect into their
own GM that uses GrAARectEffect directly.

Make GrAARectEffect assert that the rect used is sorted and don't copy
inverted rect test cases to the new GM

Change-Id: Ida9847390af27ac2317d324a98bd11cc904f0e6b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/374121
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-23 21:41:21 +00:00
John Stiles
e1d1b08203 Migrate convertSwitch to SwitchStatement::Make.
This splits switch() construction into two stages.

- One version of Make takes an array of case-values and case-statement
lists, and is responsible for reporting errors if the case-values are
not unique or are improperly typed. This is what the IR generator or DSL
will start with on its first encounter with the switch statement.

- The other version of Make takes an array of already-processed
SwitchCases and can assume the invariant that they're all correctly-
typed with unique values. This is what we will have when a statement
is inlined or otherwise cloned. (We still assert this invariant, for
correctness' sake, but in release mode we assume it.)

This CL doesn't perform any optimizations at Make time yet; it does work
equivalent to how `switch` works in the IR generator today. It does
improve duplicate case-label checking slightly; duplicate case labels
are now reported, and duplicate `default:` labels are detected.
(Multiple `default` labels won't pass the parser, but they can be
constructed in DSL.)

Change-Id: I537ce2c8236152d58641fb1793619d66a62c01a8
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372616
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-23 19:16:40 +00:00
Brian Salomon
be6de9b54e Support building GrGLInterface factory functions for both EGL and GLX.
Bug: skia:11293
Change-Id: Ie99c587fd8d466cb4260d8a78b9cff84a63315e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372200
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-23 16:37:48 +00:00
John Stiles
04ca41acf3 Fix switch optimization pass.
The optimizer now properly recognizes all types of exits from a switch
statement. Break, continue and return are all potential exits and need
to be considered when determining the exit path from the switch.

Previously, dead code elimination was hiding the effects of this bug
from us, but it meant that an optimized switch had the potential to
generate lots of worthless IR nodes which then needed to be detected and
eliminated by the CFG. In particular, this affected the enum form of
blend, causing a catastrophic amount of extra work to be done.

Change-Id: If857e38cadfc016884624ea4db25a273ad3dce5b
Bug: skia:11352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372958
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-23 15:38:24 +00:00
Brian Salomon
cc35b06f6d Revert "Fix issues with insetting and outsetting quads."
This reverts commit 4a281dc8ee.

Reason for revert: may need to only do outsetting when no all aaflags are on.

Original change's description:
> Fix issues with insetting and outsetting quads.
>
> Need more degrees of freedom when moving 3D points to project to 2D
> points that don't fall on the projected quad edges.
>
> Need to check geometry subset in shader to avoid positive coverage in
> outset quads with nearly parallel edges.
>
> Bug: chromium:1177833
> Change-Id: I0759382d9221ba44aacd537254e08d9f2716a6af
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372196
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,michaelludwig@google.com

Change-Id: Idaddbdd767600a95405c028839eac4bf80a1361c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1177833
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/373878
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-22 22:24:09 +00:00
Michael Ludwig
d56589b2a9 Remove deprecated morphology image filter headers
Bug: skia:11230
Change-Id: I7e065bfe1ba567396e242b45076b520f1aa3e414
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371963
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-22 21:50:26 +00:00
Brian Salomon
4a281dc8ee Fix issues with insetting and outsetting quads.
Need more degrees of freedom when moving 3D points to project to 2D
points that don't fall on the projected quad edges.

Need to check geometry subset in shader to avoid positive coverage in
outset quads with nearly parallel edges.

Bug: chromium:1177833
Change-Id: I0759382d9221ba44aacd537254e08d9f2716a6af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372196
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-22 21:42:31 +00:00
Adlai Holler
55af50b212 Add SkReadPixelsRec.h & SkImage_Base.h to core.gni
This pebble's been in our shoe long enough!

The _Gpu.cpp files have also been moved into separate gpu.gni
file so they're gone.

Formatter also had its way with the file.

Change-Id: Ia9324953725f070c1a7b250bcb68311168560a29
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/373816
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2021-02-22 21:27:26 +00:00
Chris Dalton
ed82686819 Delete GrSTArenaList
The intent of this class was to abstract the internal linked list used
by GrStrokeTessellateOp, but it seems to just make things more
complicated. We have a need now to iterate the list with more freedom
than is offered by GrSTArenaList, so it seems best to just use a plain
C-style linked list instead.

Bug: chromium:1172543
Change-Id: Ia76be83c523bd3c285200099a529ccd3818490b6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372656
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-22 20:56:27 +00:00
Michael Ludwig
cc75fa8f95 Remove deprecated merge image filter header
Bug: skia:11230
Change-Id: I50a9fb86a9054b96b3088b06f625dea418f53db8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371962
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-22 17:22:46 +00:00
John Stiles
66c53b9428 Demonstrate a bug with inlined static switches.
When we detect a static switch, the optimizer finds the matching switch-
case and eliminates all the other switch-cases. It handles case
fall-through by scanning forward and looking for an unconditional break.

However, the inliner has an interesting quirk--it can replace `return`
statements inside of a switch with `continue` statements, since the body
of the inlined function has been wrapped with a for-loop to allow for
early exits. The optimizer does not recognize these continue statements
as exits from the switch (although they certainly qualify), so it
treats continues as fallen-through and keeps emitting switch-cases.

The dead-code elimination pass was actually doing us a favor here and
eliminating the excess code later. A flag was added to disable DCE in
order to reveal the problem in a test.

Change-Id: I8ff19fde5e32d0ab73d7c5411da40cb953a446f5
Bug: skia:11352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372956
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-22 15:05:58 +00:00
Mike Reed
13d6c4f55d Revert "Opt into new image-shaders with sampling"
This reverts commit c957bfbe2c.

Reason for revert: needed for flutter

Original change's description:
> Opt into new image-shaders with sampling
>
> Change-Id: I2d48046f68eb25a12c0c0ce4fb7cd285e53a5c21
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372036
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

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

Change-Id: I1a3271988a3b4f6be03f7fe6f58f0e75086849da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372977
Reviewed-by: Mike Reed <reed@google.com>
2021-02-20 21:28:01 +00:00
Michael Ludwig
b06dc99130 Remove deprecated matrix convolution header and old types
Bug: skia:11230
Change-Id: I9946fbcc17f96823b2b739f7d5bf065be52e9e10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371961
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-20 18:41:53 +00:00
Ben Wagner
3830714320 Disable -Wrange-loop-analysis.
This warning was originally a stand alone clang warning, not part of
'all' or 'extra', which had false positives. These false positives were
particularly accute when a container's iterators are proxy iterators.
Unfortunately the warning was moved into 'all' before being fixed.

After this became apparent, the warning was modified and split up, but
not before it was shipped in Clang 10 and XCode 11. It appears the fixed
version of the warning is in Clang 12 and XCode 12. Until the older
compilers are no longer supported, disable the warning.

This explicitly keeps the useful range-loop-construct warning which is
part of the range-loop-analysis. The range-loop-bind-reference part is
disabled.

Change-Id: I4023613bc14ac90989e699989b49582fbd4793d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372816
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-02-20 15:45:23 +00:00
John Stiles
6e88e041d9 Migrate convertSwizzle to Swizzle::Make.
There are two forms. Swizzle::Make supports components XYZW only;
Swizzle::MakeWith01 also supports the 01 components, and restructures
the zeros and ones into a constructor (as IRGenerator::convertSwizzle
has historically done). This means that once we are past the initial
IR generation stage, and we know that the 01 components have been
eliminated, we can avoid the extra 01-handling logic and just call
Swizzle::Make directly. This isn't a huge deal but it means that call
sites like the inliner can avoid some extra work that will never happen.

Change-Id: I46690c3d6b07feb6327ee72e8f66f15592a35554
Bug: skia:11342
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371398
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-19 21:26:58 +00:00
Michael Ludwig
b7218c1e04 Remove deprecated magnifier filter header
Bug: skia:11230
Change-Id: I54f3ca4b0a8e492c18986f760f2a2b077a05e68a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371960
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-19 21:13:08 +00:00
John Stiles
463fad21ba Add test for duplicate default switch-case.
Surprisingly, this error is actually caught by our parser, which
interprets the default label in a unique way. From the parser comments:

  "Requiring default: to be last (in defiance of C and GLSL) was a
   deliberate decision. Other parts of the compiler may rely upon this
   assumption."

The comment is true--we don't check for duplicate default switch-case
labels anywhere else in the code, just here in the parser.

We rely on this, so we should have a test for it.

Change-Id: I6df5c565aca4d4b8565b96638dce9504efc39ccc
Bug: skia:11340
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372617
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-19 20:31:50 +00:00
Michael Ludwig
a50940da6d Delete deprecated SkLightingImageFilter header
Bug: skia:11230
Change-Id: I8983d160ff0317514572d13aa2a3f1218e15da8e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371959
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-02-19 13:18:47 +00:00
Mike Klein
af8db303f7 promote the runtime mixer CF to the only mixer CF
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I898fc64d8df625d22750cfe1145ba4b02acdfbb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372078
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-02-19 11:43:47 +00:00
Michael Ludwig
91bfda0ac8 Rename SkImageSource to SkImageImageFilter
Also deletes the unnecessary old header file.

Bug: skia:11230
Change-Id: Ie7c3926fe635a37e617e5e1fcac7c05eb576bbf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368617
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-18 22:42:37 +00:00
Ben Wagner
e75021e2dd Allow optional targets to specify tests.
Add sources_for_tests to optional targets. If set, a taget_name_tests
source_set will be created which matches the target_name target except
that the sources are the sources_for_tests.

This allows the tests for these targets to be obviously related to the
target they test instead of having to diplicate the logic of the
optional's enabled predicate in the test target. The test target can
just directly depend on the optional test target in the same way it can
depend directly on module tests.

This was motivated by the existence of two such tests and the need to
soon introduce another (for CoreText).

Change-Id: Idc6138044ade063f47a763f14aa7a406e613af26
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371481
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2021-02-18 19:32:55 +00:00
Mike Reed
c957bfbe2c Opt into new image-shaders with sampling
Change-Id: I2d48046f68eb25a12c0c0ce4fb7cd285e53a5c21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372036
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-02-18 18:44:01 +00:00
Michael Ludwig
e548dcbf1b Delete deprecated SkDropShadowImageFilter header
Bug: skia:11230
Change-Id: I9da638b5e1de50aee9a805547f51e013e55747b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368598
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-18 18:20:42 +00:00
Ben Wagner
bded42ab51 Split :tests into :test and :tests.
Split the :tests target into a :test target which contains the test
framework and :tests which collects all of the test cases. This allows
for all targets which define tests to depend on :test in order to define
tests, with :tests then depending on all targets which define tests. A
similar split should be considered for gms, samples, and benches.

Change-Id: Ic9f373ec0c1a8ea842fa68327e854db23477caae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371696
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-02-18 17:01:23 +00:00
Michael Ludwig
1d60c19a08 Rename SkDisplacementMapEffect to SkDisplacementMapImageFilter
Also deletes unnecessary header and deprecated types
associated with implementation.

Bug: skia:11230
Change-Id: Ibfd7dcf305febae794edfe777fc64efc0559909b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368597
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-18 16:51:14 +00:00
Brian Osman
2fe67f9680 Disallow initializers on uniform variables
Bug: skia:11335
Change-Id: I88c952cbfe2d2c5920e17675da1674928f37b982
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371480
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-18 01:01:38 +00:00
Brian Osman
b41a1f9025 Add runtime effect test for global variables
Includes variables with and without initializers. Note that both the
.skvm and .stage output is incorrect right now. (No declarations for
global variables in .stage, and the initializer is dropped in .skvm).

Bug: skia:11295
Change-Id: Icb6d797616be6a1bc7cbdc9db4fefa7e30c65656
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371143
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-17 18:11:46 +00:00
Brian Osman
6e2dccb979 Runtime Effects: Disallow all operators on arrays or arrays-in-structs
None of these are legal in GLSL ES 1.0. Added a new test that previously
compiled without error. Started out with just assignment and equality,
then realized that sequence and ternary should be blocked, too.

Bug: skia:11323
Change-Id: I02691f819565afabeadbb12cab6c07acf40093f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370880
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-17 18:05:04 +00:00
Michael Ludwig
bf43df6478 Delete compose image filter header
Bug: skia:11230
Change-Id: Ifa677319a04379dc36ff155590ba85d45790567e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368596
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-02-17 01:05:21 +00:00
Ben Wagner
2478c70a03 Use current variation position in cloning typeface.
The FreeType and CoreText ports would use the default value for an axis
instead of the current value for any unspecified axes. Change this so
that when cloning a typeface any unspecified axes preferentially use the
current axis value if it is known.

Also adds a test that unspecified axes are not changed when cloning.

Change-Id: I751ee5517f1d6b827c6d4ab245e9d681c8df6b42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370456
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-02-16 18:06:19 +00:00
Brian Salomon
ed76e8109b Reenable Wdeprecated-copy-dtor
Change-Id: Id28ed827c4a896805c6d4eead339146fdd49e35f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359560
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-02-16 17:53:28 +00:00
Michael Ludwig
72140a9969 Delete deprecated color filter image filter header
Bug: skia:11230
Change-Id: I3ce314916f1fd8dafaf79598de0b6f30eff3b208
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368244
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-16 14:39:43 +00:00
John Stiles
92d83b7b9d Add test to demonstrate out-param semantics violation.
GLSL ES2 documentation on out parameters: "Evaluation of an out
parameter results in an l-value that is used to copy out a value when
the function returns."

The inliner does not do any alias checking when inlining an `out` param.
That is, passing the same variable to two separate `out` parameters
would not generate two distinct lvalues in the inlined code; it reuses
the same variable for each out-params in the inlined code.

(Amusingly, our CFG can fully optimize away this test code so it just
returns "red".)

Change-Id: Ib781d2cfdac54f01b6abe159af0c84ff24ff6976
Bug: skia:11326
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370256
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-16 14:28:49 +00:00
Mike Klein
7a2ff98ce6 clean up SK_SUPPORT_LEGACY_RUNTIME_EFFECTS
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Change-Id: I4475982f0a5b17bcc4bae4b3f75557969cc70fd2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369856
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-02-13 22:01:14 +00:00
John Stiles
80b02af6ba Fix assertion when arrays are double-declared.
Multi-dimensional arrays aren't legal in GLSL/SkSL, so this should be
caught and flagged as an error. The parser now verifies that a
variable's type isn't an array-type before accepting a `[` token to
open an array on the variable name.

This CL also refactors the IR generator's `convertArraySize` method to
make sure that various checks are made for all callers. Originally this
restructuring was used to verify array multi-dimensionality, but that
didn't detect errors inside struct declarations (which get no error
checking inside the IR generator) so the IR generator updates no longer
need to check the array dimensions.

Bug: skia:11322
Change-Id: Id33f4bdfb544019ddf995a8196c3c09cfe5a4525
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369916
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-12 23:49:04 +00:00
John Stiles
8dabeac58c Improve error reporting for invalid var-decls.
We now interpret any statement of the form `Type identifier...` as a
var-declaration and report errors as such. Previously, if a var-decl
statement generated an error during parse, we'd report errors as if it
were an expression-statement, which meant that slightly-invalid code
could return out-of-context, misleading errors.

Bug: skia:11287
Change-Id: I2c6cf2984760eb34593c80cb30f8c4e007d42027
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370036
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-02-12 22:26:36 +00:00
Brian Osman
6c3b23fcf3 SkSL: Ensure struct declarations contain at least one member
Bug: skia:11314
Change-Id: I66476543462ae378a5bfb6cbd902dfa2f5fc45f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369917
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-12 20:57:56 +00:00
Michael Ludwig
b604452761 Delete deprecated blur filter header
This also deletes the type conversions between the legacy
tile mode and SkTileMode and cleans up the serialization
logic around that just a little bit.

Bug: skia:11230
Change-Id: If404a73e13f42055a0fe7638dcd9f58cf7e9b896
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368243
Reviewed-by: Robert Phillips <robertphillips@google.com>
2021-02-12 13:49:45 +00:00
Dominik Röttsches
691a794bee Support COLRv1 color fonts
Implement support for COLRv1 color gradient vector forms. COLR v1 is an
extension to the OpenType COLR tables that introduces support for
gradients, transforms and compositing. [1]

COLRv1 fonts contain an OpenType COLR table with format v1. In a COLR v1
table, glyphs are defined by a directed, acyclic graph of Paint
operations. The task for the Skia implementation is to extract the COLR
v1 information from the font using FreeType's COLRv1 API, then traverse
the glyph graph and translate information from the font into Skia
operations on SkCanvas.

Care needs to be taken for transformations to work correctly. FreeType
sends a top level transform that includes the scaling from font units to
actual glyph size, as well as optional transforms configured on FreeType
using FT_Set_Transform. This is set up as the starting transform at the
beginning of drawing a COLRv1 glyph. At the stage of setting a clip for
a PaintGlyph operation, the glyph outline is retrieved from FreeType
unscaled and untransformed. Since the starting transformation is applied
to the SkCanvas, the unscaled glyph is properly scaled and positioned.

Similarly, computing the initial bounding box for the COLRv1 glyph needs
to consider transformations. COLRv1 glyphs have a base glyph entry in
the glyf table which can use a minimum of two points for defining a
bounding box. This bounding box is an imaged rectangle enclosing those
two points at the identity transform. We need to compute the bounding
box scaled, but at identity transform, then make a rectangle from it,
that we then transform so that we get a large enough area to paint
in. If those two points from the glyf table would be transformed first,
then we would compute the bounding box, the resulting bounding box ends
up too small.

As a test font, add a version of the samples-glyf_colr_1.ttf from [2]
with one glyph added for testing PaintColrGlyph functionality and
compositions.

Add a basic GM test that produces color glyphs untransformed, with
skew and with rotation and combinations of those.

[1] https://github.com/googlefonts/colr-gradients-spec/
[2] https://github.com/googlefonts/color-fonts

Bug: skia:11264
Change-Id: I8357cd0c7ac0039bb2eac18f21fa343bf61871eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300558
Commit-Queue: Dominik Röttsches <drott@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Dominik Röttsches <drott@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-02-11 22:51:13 +00:00
Michael Ludwig
820921e542 Rename SkXfermodeImageFilter to SkBlendImageFilter
Also deletes the old header under the deprecated name.

Bug: skia:11230
Change-Id: Iac42d2b980d3306a544077719ca62903a673210a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368242
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-11 20:39:25 +00:00
Ethan Nicholas
570506db41 Added DSL FP codeAppend function.
This also adds the relevant Start() / End() calls so that the DSL
is put into the correct state.

Change-Id: I844b0ab5dff06e3f7b0a69458bf4442a5da0f33e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364857
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-02-11 20:37:24 +00:00
Michael Ludwig
d2fded8f6c Delete deprecated arithmetic filter header
Bug: skia:11230
Change-Id: I966d9511d6124627308146f1b5f9e18f5d7fb4d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368241
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-11 14:47:05 +00:00
Michael Ludwig
5693e5c4ae Reland "Delete deprecated alpha threshold header"
This reverts commit 140adc6762.

Reason for revert: sksl issue addressed in https://skia-review.googlesource.com/c/skia/+/368813

Original change's description:
> Revert "Delete deprecated alpha threshold header"
>
> This reverts commit 5441188637.
>
> Reason for revert: this couldn't really be breaking angle-only sksl compilation, right? Let's find out!
>
> Original change's description:
> > Delete deprecated alpha threshold header
> >
> > Bug: skia:11230
> > Change-Id: Icd927cfdcca71a48dce16bcd6c40489dad92a259
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368238
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,reed@google.com,michaelludwig@google.com
>
> Change-Id: Ie5b51e6cca39acb34dbf7b1e702209aba69ea437
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11230
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368798
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,reed@google.com,michaelludwig@google.com

# Not skipping CQ checks because this is a reland.

Bug: skia:11230
Change-Id: I6d5bb2f42edd73f5ee4e121aaaff2f348661cf18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369056
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-11 13:41:23 +00:00
John Stiles
0ac6c15075 Reduce self-assignment expressions (x = x) into just x.
Change-Id: I44356aa781f208f4941dbeb617a30318e36c1081
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367062
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-10 20:00:05 +00:00
James Clarke
b8c0dab90b Add UWP support
Bug: skia:11102
Change-Id: I4ed9e44099cd780c5cdede3eb179c0e6a92d3ce5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345219
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Chris Bracken <cbracken@google.com>
2021-02-10 19:04:42 +00:00
John Stiles
a0e407d4b7 Add SkSL test for matrix equality/inequality operators.
Disabled on Adreno 5xx/6xx as the tests do not pass on those GPUs:
http://screen/3Dkgs9syj37cjBV

Change-Id: Ib935d01e8f06dbfe7decd5cc4e52e0688b48be08
Bug: skia:11306, skia:11308
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368805
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-10 18:57:22 +00:00
Michael Ludwig
140adc6762 Revert "Delete deprecated alpha threshold header"
This reverts commit 5441188637.

Reason for revert: this couldn't really be breaking angle-only sksl compilation, right? Let's find out!

Original change's description:
> Delete deprecated alpha threshold header
>
> Bug: skia:11230
> Change-Id: Icd927cfdcca71a48dce16bcd6c40489dad92a259
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368238
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,reed@google.com,michaelludwig@google.com

Change-Id: Ie5b51e6cca39acb34dbf7b1e702209aba69ea437
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11230
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368798
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2021-02-10 14:09:03 +00:00
Adlai Holler
9e2c50edaa Revert "Remove deferred proxy machinery"
This reverts commit a3987cc587.

Reason for revert: Keeping it

Original change's description:
> Remove deferred proxy machinery
>
> These aren't used any more in favor of lazy proxies.
>
> Bug: skia:11288
> Change-Id: I992e1a3dd343e0ebc7f3a4f18c0054453dfebbaf
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366896
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com

Bug: skia:11288
Change-Id: Iafa9ed18a772e451349dfad61ee462df963028be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2021-02-10 12:28:42 +00:00