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>
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>
There's really no reason for these classes to be separate at this
point. Also extracts a "GrStrokeOp" base class that has the
functionality that will be shared with indirect stroking.
Bug: skia:10419
Change-Id: I960d5e6d64f0814ccb4a3852bc627af2b8082a1f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331860
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Change-Id: If4f614510b3d2a5802e87350b8f09797d9c52c96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332036
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Previously, temp variables created by sample() calls were named after
the offset of the sample() call within the code. This was
straightforward but would fail if the sample() call were duplicated via
inlining of helper functions.
FP sample() temp variables are now named using a counter, starting from
zero and counting upwards.
Change-Id: I16f9a3426117677c0df13d15772320def99cc0d6
Bug: skia:10858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331415
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This will allow ASAN to detect use-after-free errors in pooled memory,
enabling our fuzzers to catch errors sooner.
Testing with oss-fuzz:26942 : http://screen/C5TEbu3CJvHzRqA
Change-Id: Ic47d6b043998e5069525490cd25b2390cad94360
Bug: skia:10885
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331482
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Previously, when a prototype was parsed, this added a function
declaration to the symbol table, but the prototype itself was not
re-emitted during code generation. This meant that the final code might
not be valid, since the absence of prototypes meant that the code might
attempt to invoke a function before its declaration. Now, prototypes are
stored in the ProgramElement list and re-emitted during code generation
for GLSL/Metal/CPP. (SPIR-V doesn't name its functions at all.)
Change-Id: I76446c796000eb0b56f964d82457122182c28b87
Bug: skia:10872
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331136
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
f01a9d9020
is the culprit
Revert "GrRefCntedCallback has Make function."
This reverts commit b2c42140ea.
Revert "Add SkImage::MakeFromYUVATexturesCopyToExternal"
This reverts commit f01a9d9020.
Bug: skia:10632
Change-Id: Ief076f168b63ff8ca15b607163a13d5f52a733d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331798
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
If a glyph's position is > 32K or < -32K, then it is not
on the device. Don't bother adding it to the GrOp. This
reduces the glyph position from SkIPoint to
Vec<2, int16_t>.
But, if some of the glyphs are dropped, and the blob is
scrolled, then the glyphs may be in range. Add a flag
to track if glyphs were dropped, and force a redraw if
not exactly the same matrix is used to draw.
In addition,
* Rename VertexData to DevicePosition
* Add needed calls to GrGlyphRect
Change-Id: Ifdb8aa86d3da0b69d46c11fce5f33803781d880c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330622
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This reverts commit 28eb592735.
Reason for revert: std::optional use is breaking bots, e.g.:
https://ci.chromium.org/raw/build/logs.chromium.org/skia/4fa8175011a1c411/+/annotations
Original change's description:
> Reland "heif: Add AVIF type and AVIF sniffing"
>
> This is a reland of 3ab5b73649
>
> Fix: Chromium does not use the heif decoder. So hide it behind
> an ifdef.
>
> Original change's description:
> > heif: Add AVIF type and AVIF sniffing
> >
> > AVIF is the image format based on the AV1 video codec. The
> > container for AVIF is very similar to that of HEIF. Add type
> > definitions for AVIF and sniffing code for detecting AVIF images.
> >
> > The underlying android platform's HEIF decoder implementation will
> > also support AVIF decoding.
> >
> > Bug: b/141654151
> > Change-Id: I7e31f4cedf0bffb8920ddf880a26601e48d0e833
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330059
> > Reviewed-by: Leon Scroggins <scroggo@google.com>
> > Reviewed-by: Derek Sollenberger <djsollen@google.com>
> > Reviewed-by: Chong Zhang <chz@google.com>
> > Commit-Queue: Leon Scroggins <scroggo@google.com>
>
> Bug: b/141654151
> Change-Id: Ie6840d6fc97789be619924fc60df8683cd58430f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331496
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>
TBR=djsollen@google.com,scroggo@google.com,chz@google.com,vigneshv@google.com
Change-Id: I25df9f65b9d56d81be70a5fa650c3d841bd5a15e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/141654151
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331800
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Previously, if this was a DF-based text op and the shader had local coords, onPrepare() and setupDfProcessor() would both invert the same matrix.
Change-Id: I1cf989045791aabf9223728d485ce09ffb6412bb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330939
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
When eliminating a CFG node, we now flag its exit nodes; if our
optimization pass reaches one of those flagged nodes, we stop the
current optimization process in its tracks and initiate a rescan.
We do NOT recursively mark the exits of the exit nodes, so this fix is
reliant on the CFG being ordered in a non-chaotic fashion, but in
practice this seems to be sufficient for the CFGs we generate today.
Change-Id: I892805361c5f4297e02146f37a759dfda83f5488
Bug: oss-fuzz:26942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331597
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This is a reland of 3ab5b73649
Fix: Chromium does not use the heif decoder. So hide it behind
an ifdef.
Original change's description:
> heif: Add AVIF type and AVIF sniffing
>
> AVIF is the image format based on the AV1 video codec. The
> container for AVIF is very similar to that of HEIF. Add type
> definitions for AVIF and sniffing code for detecting AVIF images.
>
> The underlying android platform's HEIF decoder implementation will
> also support AVIF decoding.
>
> Bug: b/141654151
> Change-Id: I7e31f4cedf0bffb8920ddf880a26601e48d0e833
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330059
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Chong Zhang <chz@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>
Bug: b/141654151
Change-Id: Ie6840d6fc97789be619924fc60df8683cd58430f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331496
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Change-Id: Ief57d9c102b3c7658738920cdf54ccd4d21c5c5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331656
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: I19a9564ac4d52b709b8fdd757b99222372c626f4
Bug: oss-fuzz:26942
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331598
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>
Change-Id: I16a5938f5156fac2e93b8cd0b2a8e2ed45b46386
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330938
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Each caller does not need to check for null function.
Also inherit from SkNVRefCnt.
Change-Id: I9a53c3c8e9dec1361db6cfb21b97d178173b23ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331490
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This brings back the 2px wide picture frame approach described in these
slides: go/thin-line-aa. This has been in place when the per-edge-aa
only needed to support rectangles but was scrapped when the code path
was updated to support arbitrary quadrilaterals.
I opted to have the GrQuadPerEdgeAA logic check for degeneracy and
update what it requests for the outset. This scale factor out to a 2px
wide shape makes sense in the context of anti-aliasing, but not so for
the generalized inset/outset logic defined in GrQuadUtils. It would have
been more efficient to implement it there, but would have locked it in
to being just AA inset/outset.
I also updated SkGpuDevice's drawStrokedLine to construct the quad of
the line directly, and to always turn a line path into a rect, instead
of restricting it based on matrix or stroked width. With this new change
the quality of the fill rect is much higher under rotations and
perspective compared to the hairline.
See rect case: https://drive.google.com/file/d/1xwgG5heADcdXYShsDodgbuv2tbHfuBNt/view?usp=sharing
Hairline case: https://drive.google.com/file/d/1duNLxiYLLJhsJ94Uc01rSxjB4ar6_Ud9/view?usp=sharing
Bug: chromium:820987
Change-Id: Ibd58b89a467ad5a61c5479d11259024259f1bb47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329418
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Bug: skia:10828
Change-Id: Ifab9c2b179fa981a94d03ff96718c3b31f745fee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331338
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This was the simplest one to start with. I need to add support for the
"filter effect subregion" in order to handle tile stitching property,
so this isn't quite complete. But I believe this is enough for the
basic filters-turb-01-f test to pass, which gives us a baseline for
further filter work.
Summary of changes:
- Added attribute type and parsing for SVG integer datatype
- Added new node class for feTurbulence
- Added several new properties and parsing for feTurbulence
Bug: skia:10841
Change-Id: I8c877a5e1a837bfd527782253062eeb58febdde6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330621
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Updated API for creating a RGBA texture-backed image from RGBA texture
planes with user-provided backing store using GrYUVABackendTextures.
Ultimately we would like to remove all such APIs and have the client
make a SkSurface and draw a YUVA texture image to the surface but
a recent attempt to do that in Chrome caused a not yet understood
perf regression.
Add wacky_yuv_formats variation that tests new api.
Bug: skia:10632
Change-Id: I89411216948682f13281a91a7575d5f345badda7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329956
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
We need to abandon all the GPU resources before dropping any
refs the thread-safe cache may be holding.
Change-Id: Id1a06adf9e0241bfaf55e3f58bf8c2db928ea141
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331536
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This method is only valid in the range 2^(+/-30) due to fp32 overflow.
Adds a comment to the function and updates its test.
TBR=bsalomon@google.com
Change-Id: Ifa2fc0ed4a7f9123f0bebaa02c666c61e06e62a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331481
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Prior to rendering a node, check the filter presentation attribute and
create a new canvas layer with a corresponding SkImageFilter set.
Also added the computation of the filter effect region and added a naive
(and incomplete) construction of the image filter DAG for a
<filter> element.
Bug: skia:10841
Change-Id: Ie94299757e059c39540ad316cddf438df5726d97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330619
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This method finds the locations a cubic needs to be chopped at before
it can be passed to the stroke tessellation shader. It's an integral
part of CPU stroke preparation and therefore extremely perf sensitive.
Bug: skia:10419
Change-Id: Ib23c2583b8cfc78814ce52425f7af2c8b2f8b420
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330314
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
You can use this to cross complie from an x86_64 mac if you have
at least XCode12 beta 2 installed, and you set target_cpu = "arm64"
in your gn args.
Change-Id: I3fcdcd162155ac0242c15260994de09177ff2f97
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328659
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Bug: chromium:1139750, skia:8389
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel,win10-blink-rel
Change-Id: I69c55f505947fdec5d9d391d2b2d2d3ff6dec9b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330216
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Some time ago FontConfig stopped being thread antagonistic and
documented that it was thread safe (or at least any thread un-safety was
a bug). However, until
447b9ccc7d
at least one of the basic atomic primitives was implemented incorrectly.
Resume using a mutex to serialize access to FontConfig until 2.13.93.
Bug: cl/339089311
Change-Id: I632f03bc575a37b5391390a0868aef256e3aacda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331339
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This has two advantages:
- sksl_gpu was on the verge of overflowing 255 program elements anyway
- this makes it easier to skip ProgramElements when generating the
dehydrated data; in particular, we don't have any need to dehydrate
function prototypes, but if we just skip them, the count would be
wrong
Change-Id: Idbcdec53518e9e6f42473a73a53dae408ce7c980
Bug: skia:10872
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331282
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Adds grvx, Ganesh's addendum to skvx. Here we introduce familiar names
and operations from GPU languages, as well as functions that are
approximate and/or have LSB differences from platform to platform.
The initial implementation has: fast_fma, fast_acos, and
fast_angle_between_vectors. When a function is approximate, its error
range is well documented and tested.
Also establishes GrWangsFormula as the first user of grvx.
Bug: skia:10419
Change-Id: Id0682599cf9c0303eff386095afc3ef9f3a7fa1b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330119
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
- Prototypes for never-declared functions
- Prototype before use
- Prototype after use
- A variety of inputs and outputs on the prototyped functions.
- Calling declared-but-undefined functions
Currently, the prototypes are not actually emitted in the generated GLSL
or Metal output at all. This CL is demonstrates our baseline before
proper prototype support is added.
Change-Id: I6112e0a89ab9bbecefccaca9fba985bb8011fff1
Bug: skia:10872
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331376
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
There are currently many tests skipped, but many more pass.
This changes the built binary to have a lot of debugging logic
in it so we should be able to get backtraces on those crashes
more easily when debugging.
gmtests.html was removed as it was superceded by run-wasm-gm-tests
and make run_local.
Bug: skia:10812, skia:10869
Change-Id: I72ab34d3db83a654dc8829831b3ecb795fe23d43
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329170
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
We finally have a reference and derivation of Wang's formula, thanks to
tdenniston@. And it turns out that the formula we had been using for
cubics wasn't quite right. It was overly conservative for certain types
of curves.
This CL fixes the incorrect cubic formulas and adds a citation to the
"Pyramid Algorithms" book. We should now be getting by with fewer linear
segments.
Bug: skia:10419
Change-Id: Ib850c7b4d17b8d9f9abed800cc7cb5f074df6e17
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/331156
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>