Commit Graph

1305 Commits

Author SHA1 Message Date
Kevin Lubick
f3b959c000 [canvaskit] Respect Exif metadata for animated images.
Change-Id: I58a5095ea3314a21d895f34a4b8cab9484c29b1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340717
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-12-07 11:10:07 +00:00
Kevin Lubick
e7c1a731ff [canvaskit] Remove 2d point arrays from API.
I kept in an array of Color (Float32Array) because it's very convenient
and not worth the hassle of removing.

Change-Id: I34c430c2b5112b6d073b049a81994e946428f21c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340797
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-12-07 11:09:49 +00:00
Julia Lavrova
b42686ad01 Painting styled text blocks in RTL
Bug: skia:11017
Change-Id: I13bd210a0d38614bab4a5a98c4507150043224cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340317
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-12-03 21:51:40 +00:00
Florin Malita
38921cafe1 Reland "[skottie] Add image sampling and transform options"
This reverts commit b81842aa28.

Reason for revert: reland with fixes

Original change's description:
> Revert "[skottie] Add image sampling and transform options"
>
> This reverts commit 2f24405250.
>
> Reason for revert: broke Win/shared 
>
> Original change's description:
> > [skottie] Add image sampling and transform options
> >
> > Expand the SkImageAsset API to support controlling sampling options and
> > pass an additional transform.
> >
> > Bug: skia:10944, skia:10942
> > Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Florin Malita <fmalita@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
>
> TBR=fmalita@chromium.org,fmalita@google.com,reed@google.com,aparchur@google.com
>
> Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10944
> Bug: skia:10942
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619
> Reviewed-by: Florin Malita <fmalita@google.com>
> Commit-Queue: Florin Malita <fmalita@google.com>

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

# Not skipping CQ checks because this is a reland.

Bug: skia:10944
Bug: skia:10942
Change-Id: I91892f4db6366ceb07d1a49a7bc54da17cea5399
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340657
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 19:21:57 +00:00
Tyler Denniston
041f6656dc [svg] Remove kInherit from several SVG types
We can now remove kInherit from all of the SVG types, but this CL does
just a few to get us started / prove the concept.

SkSVGPaint, SkSVGClip and SkSVGLineCap now do not contain kInherit as an
enum value. Also, SkSVGLineCap (and eventually others) can be a bare
enum class now.

Change-Id: I7de001459bcb1f5586d66b975f92fecedb125dde
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335827
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-12-03 17:36:54 +00:00
Florin Malita
b81842aa28 Revert "[skottie] Add image sampling and transform options"
This reverts commit 2f24405250.

Reason for revert: broke Win/shared 

Original change's description:
> [skottie] Add image sampling and transform options
>
> Expand the SkImageAsset API to support controlling sampling options and
> pass an additional transform.
>
> Bug: skia:10944, skia:10942
> Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Mike Reed <reed@google.com>

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

Change-Id: I59d4161356ffdc20588f1bd3beb33c54e44807a2
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10944
Bug: skia:10942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340619
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2020-12-03 17:11:00 +00:00
Florin Malita
2f24405250 [skottie] Add image sampling and transform options
Expand the SkImageAsset API to support controlling sampling options and
pass an additional transform.

Bug: skia:10944, skia:10942
Change-Id: I7bad0b2ab58ed40fe4b425de0eb6970a4c7d7117
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340097
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-12-03 16:17:24 +00:00
Julia Lavrova
f9433fa316 Fixing some round problems with metrics
Bug: skia:10996
Change-Id: I003086d3625bb713f4f6c682346ab190dddd7426
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339856
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-12-03 14:52:23 +00:00
Herb Derby
c9a24c9815 default to using new/delete for GrOp
Currently, new/delete is not on for Google3. After this
CL new/delete will be used on all platforms.

Change-Id: Idfc6217b809c9eb986e618ffa575004893b3aa0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339859
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-12-02 15:15:26 +00:00
Kevin Lubick
658cb7173a [canvaskit] Fix drawPoints to be flattened point array
Bug: skia:11012
Change-Id: I0866f791f6fba82d073b5b5acd37aa8509b6fdef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/339836
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-12-02 15:07:57 +00:00
Tyler Denniston
4c6f57a23e [svg] Use new code path for rest of presentation attrs
This is another necessary step in order to remove kInherit from all of
the base SVG type enums.

Change-Id: I2185e744f7b27369f7bad36591f896d3a9982b42
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335817
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-30 21:27:04 +00:00
Julia Lavrova
611b2a6a0d Heuristic for filtering out too big editing text cases
Bug: skia:10487

Change-Id: Ie13db40ceee6edfcc1cfb28a131ff2cfa02038fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335664
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-11-25 15:54:27 +00:00
Julia Lavrova
36d06a806f Fixing background rectangle sizes for Flutter
Bug: skia:10982
Change-Id: Id5b352c1139293195ca421b069e8632079acf37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337181
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jason Simmons <jsimmons@google.com>
2020-11-24 23:03:46 +00:00
Julia Lavrova
748db70156 Make sure maxIntrinsicWidth is always no less than minIntrinsicWidth
Bug: skia:10992
Change-Id: Ifd3b8e799c76d09f6a01623747f646ce15de51b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338045
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-11-24 21:13:06 +00:00
Mike Reed
ce0c876ce2 hide legacy scalePixels and makeShader
Change-Id: Idae1e44aa0417adb943fd20112fb4f1fa81167f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337719
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-11-24 00:41:33 +00:00
Florin Malita
9a5aa0a295 [svg] Handle zero-radius radial gradients
Per [1]:

"A value of zero will cause the area to be painted as a single color
using the color and opacity of the last gradient stop."

[1] https://www.w3.org/TR/SVG11/pservers.html#RadialGradientElementRAttribute

Bug: skia:10981
Change-Id: I5c4c8444c4dd72d2224b1d8b2536e7aa8c1f4712
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337180
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2020-11-22 19:12:10 +00:00
Brian Osman
0006ad01ce Stop cloning builtin functions
Previously, any builtin functions would be optimized as a side-effect of
optimizing programs that used them. Now that shared elements aren't
being optimized in that way, we explicitly optimize any shared modules
when they are first created. We don't remove dead elements, but we
we do substitute settings, simplify, and inline.

Bug: skia:10905
Change-Id: I701b5e9f52fb880ef3e6f4c67694d08602f47e95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/336440
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-20 15:02:54 +00:00
Brian Salomon
94584f4574 Remove unused macros from GrGLConfig.h, GrGLConfig_chrome.h, and scripts
Change-Id: I5a9e7d490fd71f326ac37a72eb942fc64f557733
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335666
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-11-18 20:23:35 +00:00
Florin Malita
c743164d30 [skottie] More robust font style parsing
- both weight and slant are optional
  - handle arbitrary whitespace separators
  - case insensitive keys

Change-Id: Iadd3a43167cd71654d7578549bd331fde243c28f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335822
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-11-18 19:16:45 +00:00
Kevin Lubick
ae0d3ffe6d [canvaskit] Document and tweak MakeImage API
Change-Id: I84b8bc8b84e0b79ea4a8a6b53bb3358e0ec9c138
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335665
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-11-18 17:43:56 +00:00
Tyler Denniston
79832e3151 [svg] Parse "inherit" generically for SkSVGProperty
This generic parsing will allow us to later remove kInherit and
"inherit" parsing from all other specific SVG types.

Also convert "filter" presentation attribute to new-style parsing
for compatibility with the setter.

Change-Id: Id917e12d77cdefb1a8f1404cac1e0c4e486d8b53
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/335660
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2020-11-18 16:51:55 +00:00
Tyler Denniston
75c38f94ef [svg] Add SkSVGProperty class for presentation attributes
This CL adds a new SkSVGProperty<T,B> class and uses it instead of
SkTLazy for the presentation attributes. Ideally this will form the
foundation for improvements to our presentation attribute parsing
as well as correctness for inherited/non-inherited properties.

Change-Id: Ie1cdb3db9674c55376e127cc1a8b8cb303a1bd13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334837
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-17 18:11:24 +00:00
Florin Malita
ebbacd8a37 [skottie] Initial direction for text shaping
Extend text properties to allow specifying an initial direction.

Bug: skia:10946
Change-Id: Ia037aa060a4e2bb404cd50b0d6c8883ffe0ee38a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334677
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-11-13 20:57:03 +00:00
Florin Malita
4ad2cca236 [skottie] Fix font style parsing
1) avoid partial matches (e.g. "Extra" vs. "ExtraLight")

2) weight/slant are space-separated (e.g. "ExtraLight Italic")

Change-Id: Id2db44d8b4a32b97674ec7490992974135b39ae9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334164
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-11-12 18:36:49 +00:00
Kevin Lubick
83bbd7c0ad [canvaskit] Roll to 0.20.0
Change-Id: I5025a5ca8deca45dfe3e222e3bf4b6f047416eb4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334419
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-11-12 15:48:12 +00:00
Julia Lavrova
c90084a9a3 Revert "Some testing images in Google3 look slightly different with this change. Need to change them, too."
This reverts commit b776a105e5.

Reason for revert: This will be the first step of a staged change.

Original change's description:
> Some testing images in Google3 look slightly different with this change. Need to change them, too.
>
> Revert "Roll back #10487 fix (so now spaces always resolved in the main font)"
>
> This reverts commit ff5d8700b3.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Roll back #10487 fix (so now spaces always resolved in the main font)
> >
> > Bug: skia:10715
> > Change-Id: I06bb881998d00228c79a218967eda6468cbc5bed
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334053
> > Reviewed-by: Ben Wagner <bungeman@google.com>
> > Commit-Queue: Julia Lavrova <jlavrova@google.com>
>
> TBR=bungeman@google.com,jlavrova@google.com
>
> Change-Id: Icc1f262f60fa2ec9b4425ce3088b5eaac9313374
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10715
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334158
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

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

Change-Id: I0f2f46fc21eec795026ea98696f68112915f7979
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10715
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334159
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-11-12 15:32:48 +00:00
Kevin Lubick
6df5cd28db [canvaskit] Revert raster change.
Drawing to a Premul Raster Surface and then copying out Unpremul pixels
was 15x slower. Drawing to an Unpremul Raster surface was a little
slower than the previous RasterDirect surface.

Out of an abundance of caution, I'm going back to the way things were.
We can revisit drawing to a Raster surface in the future.

This also adds better error handling to the SkottieFrames test which
thankfully caught this regression.

Bug: skia:10717
Change-Id: Ib8b9d490c92e013c3311adb1d08de5fa0fc0351c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334356
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-11-12 14:49:47 +00:00
Kevin Lubick
43f0a7d724 [canvaskit] Fix the build
Change-Id: Ia3b3fa1183d5654bcfeab0bfd24ca04b8f622eed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334166
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-11-12 13:07:46 +00:00
Kevin Lubick
59bafeeaa7 [canvaskit] Deprecate measureText
After discussion on https://skia-review.googlesource.com/c/skia/+/334096
we decided to remove this misleading API.

Bug: skia:10480
Change-Id: I3daeb6251d5fed829742cfe39c7cade4f19e5a43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334101
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-11-11 22:49:10 +00:00
Kevin Lubick
15d7a38b04 [canvaskit] Use Raster instead of RasterDirect for Canvas2D surface
This also refactors some internal names to be more consistent
with the normal naming convention.

Bug: skia:10717
Change-Id: I69a0d95aaca359e121b3ff84002d0b5f7cadb260
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334041
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-11-11 22:48:53 +00:00
Leon Scroggins
70eba23828 Remove SkAnimatedImage::dimensions
The only caller is CanvasKit, and SkAnimatedImage already has getBounds
(from SkDrawable) which does the same thing, except it returns
SkScalars. It also takes scaling and cropping into account, which
CanvasKit does not use, and in a future commit, it will consider
orientation. Switch CanvasKit to use getBounds.

Change-Id: Ia956f91d241641aec450f3aba99583e95a3ff386
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333222
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-11-11 21:48:15 +00:00
Julia Lavrova
b776a105e5 Some testing images in Google3 look slightly different with this change. Need to change them, too.
Revert "Roll back #10487 fix (so now spaces always resolved in the main font)"

This reverts commit ff5d8700b3.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Roll back #10487 fix (so now spaces always resolved in the main font)
>
> Bug: skia:10715
> Change-Id: I06bb881998d00228c79a218967eda6468cbc5bed
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334053
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Julia Lavrova <jlavrova@google.com>

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

Change-Id: Icc1f262f60fa2ec9b4425ce3088b5eaac9313374
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10715
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334158
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-11-11 20:47:16 +00:00
Julia Lavrova
ff5d8700b3 Roll back #10487 fix (so now spaces always resolved in the main font)
Bug: skia:10715
Change-Id: I06bb881998d00228c79a218967eda6468cbc5bed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334053
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-11-11 18:11:25 +00:00
Florin Malita
7006e15df5 [svg] Allow clients to pass a custom SkFontMgr
Introduce a Builder helper and plumb the client-provided SkFontMgr for
font resolution.

Also clean up some of the legacy SkSVGDom factories.

Bug: skia:10840
Change-Id: I6e1eabe7c257cb75dfdb5bf67054f93f25769027
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333577
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2020-11-11 01:51:44 +00:00
Tyler Denniston
a0a5146ba9 [svg] Use new parsing for gradient classes
- Added new SVG_OPTIONAL_ATTR macro for lazy properties
- Added SkSVGIRI type -- we need explicit types now to be able to
  dispatch via the templated parse function
- Converted several attribute parse functions to templated version

Change-Id: I270d35983083f368e36afd96a62c768161d49942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333518
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-10 19:04:49 +00:00
Kevin Lubick
a502878308 [canvaskit] Add support for woff2 fonts
Requested by Flutter. This adds about 80k of code size
due in large part to the brotli decoding logic.

This also updates the check_deps error to point at
a doc on how to create a new GOB mirror.

Brotli version is 1.0.9; the latest as of today.

Change-Id: I1580cb2189ff1205a9bffca3d887ff2b98a4042e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333218
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2020-11-10 15:07:26 +00:00
Tyler Denniston
b25caae788 [svg] Implement feComposite, basic filter result storage
- Plumbing to store filter results by id and resolve them as inputs
  when referenced
- Added implementation of feComposite filter
- Added call to resolve input in feColorMatrix
- Bugfix to SkSVGFilterType operator==

The tests filters-color-01-b and filters-composite-03-b should now be
passing.

Bug: skia:10841
Change-Id: I2cd099c60ac21710f25184806c5cc537656b42af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332723
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-10 14:00:56 +00:00
Martin Vejdarski
cd2e148ea4 [skshaper] Fix CoreText segfault and convert UTF16 indices to UTF8
Bug: skia:10899
Bug: skia:10898
Bug: skia:10897

Change-Id: I0a9499b919e27c6fa01f1748b98ebcbcae2ed885
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332896
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-11-10 02:53:01 +00:00
Julia Lavrova
1d1c5c1a18 Yet another workaround Thai \n problem (same as txtlib)
Bug: skia:10881

Change-Id: If451b662646e66e5d699ca0cca3795f5e078b84e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332257
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-11-06 19:33:39 +00:00
Florin Malita
8c42567377 [svg] Convert most presentation attributes to new style parsing
Change-Id: Ib430ce05f7e336ae82a51ee45194338e90d77c58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332751
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2020-11-06 19:29:54 +00:00
Tyler Denniston
70bb18d7c9 [svg] Implement feColorMatrix filter
Supporting this filter will also allow us to start implementing and
testing the filter result DAG via the filters-color-01-b test. That test
is one of the simplest that involves filter result storage, so it's a
good candidate to start with.

Bug: skia:10841
Change-Id: Id8317ccfb78031cc6af83c9f3e3f382dcb6dee98
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332599
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-06 18:40:24 +00:00
Kevin Lubick
b8123cc877 [canvaskit] Clean up readPixels API on Canvas and Image
This makes both APIs have the same arguments with the two
source coordinates first and all the destination params
(image info, optional buffer, optional rowBytes) after.

Bug: skia:10717
Change-Id: I483e4f33f24e226793db6113d5ba5b1955cd892e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332622
Reviewed-by: Mike Reed <reed@google.com>
2020-11-06 18:22:14 +00:00
Florin Malita
401321d98e [svg] Minor parser tweaks
- remove the custom-func SkSVGAttributeParser::parse version and always
  dispatch via SkSVGAttributeParser::parse<T>(T*) - this should
  avoid adding any other parse helper declarations in the future
- relocate the turbulence parse helpers to SkSVGAttributeParser (while
  keeping the definition in SkSVGFETurbulence.cpp)
- update ParseResult initialization to use move semantics

Change-Id: I8ed9811671a6fbc5971f9d1f14e7b9c07da7dec0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332540
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2020-11-05 17:12:06 +00:00
Brian Osman
91292e9482 Runtime Effects: Support 'uniform shader' (vs. 'in shader')
The previous behavior leaked Skia-internal concepts into public SkSL.
Users coming from GLSL will expect that bindable/sampleable objects are
uniform (just like texture2D). This keeps the old support around (and
tested), but updates all of our examples to use 'uniform'.

Bug: skia:10679
Change-Id: I0c98162f5e21dad7014d9778ceb26143d2f6030e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332376
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-04 22:29:53 +00:00
Tyler Denniston
57154998a8 [svg] Add plumbing for bottom-up attribute parsing
One significant source of boilerplate in the SVG frontend is the
plumbing to ensure type safety all the way down from the XML layer to
the SkSVGNode layer. This is mostly an artifact of the top-down parsing
approach currently used by the SkDOM -> SkSVGDom building process.

One way to help remove some boilerplate is to perform attribute parsing
bottom-up, where each SVG node knows how to parse and populate its own
attribute values from a string-valued KV pair.

Additionally, bottom-up parsing allows us to support the case of the
same SVG attribute name having different meanings on different nodes
(e.g. the "type" attribute has different meaning on <feTurbulence>
versus <feColorMatrix>).

This CL adds some initial work to start us down that road, and ports the
attributes previously added for <feTurbulence> to use the new code path.

Change-Id: I2973cfab96891475d05ebf1228117626ca48ef4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331477
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-11-04 21:48:03 +00:00
Brian Osman
d7e7659cad Move GrShaderCaps from Program::Settings to Compiler
This ties the caps to the compiler instance, paving the way for
pre-optimizing the shared code. Most of the time, the compiler is
created and owned the GPU instance, so this is fine. For runtime
effects, we now use the shared (device-agnostic) compiler instance
for the first compile, even on GPU. It's configured with caps that
apply no workarounds. We pass the user's SkSL to the backend as
cleanly as possible, and then apply any workarounds once it's part
of the full program.

Bug: skia:10905
Bug: skia:10868
Change-Id: Ifcf8d7ebda5d43ad8e180f06700a261811da83de
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331493
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-11-04 19:38:33 +00:00
Kevin Lubick
c4ab08710d [canvaskit] Add option for readPixels to use pre-malloc'd data
Bug: skia:10565
Change-Id: I777f887794cd0524ced4d65e86bd285a854386e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331858
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-11-04 14:50:48 +00:00
Kevin Lubick
9fe83916e0 [canvaskit] Add fast pass for saveLayerPaint
Bug: skia:10586
Change-Id: I11c0de6181f73f4388e6b40d6869fce2265f34ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331361
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2020-11-04 14:49:34 +00:00
Kevin Lubick
e677f4ada0 [canvaskit] Properly expose getLineMetrics
This had previously been incompletely exposed. This does so
properly, by returning a JSArray of JSObjects with the metrics.

I am purposely not exposing fLineMetrics until that is explicitly
requested, as it looks complicated.

Bug: skia:10614
Change-Id: If3a2154e8ee39d8adcf416b4513b33a955c2482f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331359
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2020-11-04 14:49:16 +00:00
Kevin Lubick
a8f4c91114 [canvaskit] Expose MakeRasterDirectSurface
This will let clients have faster access to the drawn data
and give them control about calling Canvas2D.putImageData.

Bug: skia:10565
Change-Id: Ia3da7867be3f671ab20fdb182ec758b77c0f63b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331316
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-11-04 14:10:14 +00:00