This tests the case where the stroke has butt caps and its width
significantly larger than the path itself. There seems to be some
uncertainty over what should actually be drawn in some of these cases,
as evidenced by the variable results from different path renderers
here.
Change-Id: I5b62ec446bfbba73d09ddb4eac710e338bedfc6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296114
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Change-Id: I1c9cd865c3fd37b5d4c911790713d9ca2283aeee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296724
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Previously, all backends allowed the SkSL to be edited, and GL allowed
GLSL to be edited. Now any backend's source can be seen, and they can
all be edited (other than SPIR-V). Tested with HLSL and SPIRV. I don't
have a Mac available, but MSL should work, too.
Change-Id: Ia2a11bb5922dd49a5f25840e48384e0246a28b69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296856
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
We were always tagging the stored shaders as SkSL, so they (naturally)
didn't compile when we loaded them.
Change-Id: I96062808751b6233c9e90b29150f66270d0dd198
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296836
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
A follow up CL will use the availability of this information - the full
list of targets of a GrRenderTask – to enable faster storage of the
lastRenderTask association for a given surface proxy in a given drawing
manager.
Bug: skia:10320
Change-Id: I3eb3276b483a7f09481774896a024172b73a4c84
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296729
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Change-Id: Id6df54efa6d71d35b682e6910d08371fc8065c88
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296799
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Some clients already have SkTypeface objects, and forcing them to pass
these as SkData is awkward - especially since Skottie immediately turns
them into SkTypeface again.
Replace the existing loadFont() callback with loadTypeface().
(for compatibility, we try both for now, but the plan is to phase-out
loadFont)
Change-Id: Ib4c2446a96cb6a5f95581c405d0a1b4ecff7ddb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296718
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
In order to emulate OOP-R's behavior, GM needs to pass GPU-backed resources to a DDL recorder.
This change allows GMs to create GPU resources first (in onGpuSetup w/ a direct context) and then use them in onDraw (with only a GrRecordingContext).
Change-Id: Ifa3002af73eb9926f653fb4c4bf4542c0749d658
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294336
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Currently supports SkSL & HLSL. We should see if we can safely serialize
the shader blobs returned by D3DCompile.
We can't (yet) view the HLSL in Viewer - the shader viewer/editor needs
an overhaul to support backend-specific source formats (MSL, HLSL,
disassembled SPIRV). Going to look into that in a separate CL.
Change-Id: Ife1fd1d3d724674b24793df2d86c52a9b8f7de23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296734
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Change-Id: I42db2a887316e9e6487513c56afc730f98111a6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296735
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Don't sort thresholds and allow full 0..1 range
Change-Id: I228be036bb259bea53ac9885e758c9e46ced1d62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296717
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: I8e6309b5ae794b0291ecc45267f67328a0f52829
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296716
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
This arrangement allows the backend texture to outlive the YCbCr SkImage.
Change-Id: I34939d05bf1091c8efcacb687dc1900729d4cbe5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296478
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Make sure we take into account the origin when setting this rect.
Change-Id: I9cd35a25cb1489984597946bbeb7563a347c7c86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296518
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
We already have a stencil buffer class, so this adds the code to bind the
stencil and clear it.
Change-Id: I9af90d999881954cfb26ceb6a31a5ab2cf9bbe3b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296517
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Change-Id: I813a4e4a5b4b0dc4f8ea59056d125386e6049ab4
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296516
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Bug: skia:10139
Change-Id: I526f8ca77de0ed6ab1fe16b22201043ebf5c3716
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296477
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
We are updating FPs to receive their input via a child FP where
possible, instead of relying on the input color.
Additionally, made minor cleanups in CircularRRectEffect for parity
with EllipticalRRectEffect, and took advantage of the new API
cloneAndRegisterAllChildProcessors to reduce boilerplate.
Change-Id: I3b7d22cb2a9da4471bdfda763dac93fe7616d927
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296129
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Previously, when REPORTER_ASSERT reported a failure, there was no
additional information describing the FP that could not be cloned in the
error log. Now, we print out a very simple tree of the FP and its
children.
Change-Id: I141cfb17ca431864a6f555d56f0335293f259c4e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296452
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
CanvasKit.MakeImageFromEncoded, when used with Browser APIs for loading/decoding images.
- `CanvasKit.MakeImageFromCanvasImageSource` takes either an HTMLImageElement,
SVGImageElement, HTMLVideoElement, HTMLCanvasElement, ImageBitmap, or OffscreenCanvas and returns
an SkImage. This function is an alternative to `CanvasKit.MakeImageFromEncoded` for creating
SkImages when loading and decoding images. In the future, codesize of CanvasKit may be able to be
reduced by removing image codecs in wasm, if browser APIs for decoding images are used along with
`CanvasKit.MakeImageFromCanvasImageSource` instead of `CanvasKit.MakeImageFromEncoded`.
- Three usage examples of `CanvasKit.MakeImageFromCanvasImageSource` in core.spec.ts. These
examples use browser APIs to decode images including 2d canvas, bitmaprenderer canvas,
HTMLImageElement and Blob.
- Added support for asynchronous callbacks in perfs and tests.
Here are notes on the image decoding approaches we tested and perfed in the process of finding ways
to use Browser APIs to decode images:
1. pipeline:
ArrayBuffer → ImageData → ctx.putImageData →
context.getImageData → Uint8Array → CanvasKit.MakeImage
❌ Problem: ImageData constructor expects decoded bytes already.
2. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded (async function)
pipeline:
ArrayBuffer → Blob -> HTMLImageElement ->
draw on Canvas2d -> context.getImageData → Uint8Array →
CanvasKit.MakeImage
✅ Works
⏱ Performance: 3rd place (in my testing locally)
3. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded2 (async function)
ArrayBuffer → Blob → ImageBitmap → draw on Canvas2d →
context.getImageData → Uint8Array → CanvasKit.MakeImage
✅ Works
⏱ Performance: 2nd place (in my testing locally)
4. interface.js - CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded3 (async function)
ArrayBuffer → Blob → ImageBitmap →
draw on canvas 1 using bitmaprenderer context →
draw canvas 1 on canvas 2 using drawImage → context2d.getImageData →
Uint8Array → CanvasKit.MakeImage
✅ Works
⏱ Performance: 1st place (in my testing locally) - quite surprising, this in some ways seems to be a more roundabout way of CanvasKit.ExperimentalCanvas2DMakeImageFromEncoded2, but it seems bitmaprenderer context is fairly fast.
Bug: skia:10360
Change-Id: I6fe94b8196dfd1ad0d8929f04bb1697da537ca18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295390
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This will let us share this code with the pipeline stage code generator,
which doesn't use the helper.
Change-Id: I8df3a71d448697d98b1fcbabda524e48e42db591
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295561
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
In the "ignore input" mode, the input FP contributes nothing and is
never sampled. In the "modulate input" cases, the input FP is sampled
as one would expect.
Change-Id: I96717d63d8e3d7ef6aa4eaaf88154c6e5ce47e55
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296299
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
The way you access individual descriptors in a heap for d3d is that you
get a handle to the start of the heap, get the stride between
descriptors, and then you can do start + index * stride. Previously we
were assuming that the ptr handles for different heaps would not overlap.
Thus when recycling an individual descriptor we were using its handle ptr
to decide which heap it belonged to.
However, the spec doesn't require that these handles act like actual
pointer to memory. On a least some machines it was noticed that the start
handle for different heaps just incremented by 1 for each new heap even
though each used 32 as their stride. Long story short it is not valid
to do any sort of comparison of handles between different heaps Thus we
have to explicitly track which handles come from which heaps so we know
of to correctly recycle them.
This fixes the main/most common crash we were seeing on d3d viewer.
Change-Id: I5107104b245dc13a3b6b21e9e04b88ed8f55c80b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296448
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
When collapsing static switches, we were not handling the symbol table
in SkSL::Block correctly, which led to assertion failures in some cases.
This CL is based on the fixes in http://review.skia.org/296178
but removes the need to track pointers-to-unique-pointers.
We do this by splitting the work into two parts:
1 - determine range of statements to move
2 - actually move statements
Because the statements are all consecutive, keeping track of this range
is not actually that difficult and we don't need to do any checks twice.
Change-Id: I71ad745ef1e4b4f5f6b753762e65fa49b2399adc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296440
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This method should make it simpler for hand-written fragment processors
that have child FPs to implement clone() properly.
Change-Id: I1927d98857533406e732c8c6a8b228cb8cdb59b6
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296439
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
In PDF files, "names" and "strings" are not the same thing, but I was
conflating them. Separate out the interfaces for adding attributes to
PDF struct tree elements so there's a way to add either a name or a string,
and similarly for arrays of names or arrays of strings.
Fix the table test to correctly use a name for the "Scope" attribute
and an array of strings for the "Headers" attribute.
Bug: chromium:607777
Change-Id: Ib30bded2bbcf96e31ba6925fb062615558dea0db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296338
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Auto-Submit: Dominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
This will remove common boilerplate from our gen-code, and gives us a
place to put common child-cloning boilerplate.
Change-Id: I6101655af89d4c5844ec908b81ce4f6e5d59f834
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296177
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This reverts commit c34344989a.
Reason for revert: breaking the windows msvc compile bot as well as the flutter canary
Original change's description:
> Allow building with Wuffs v0.3, not just v0.2
>
> This is step 1 of a multi-step, multi-repository transition:
>
> 1. Let Skia work with either Wuffs v0.3 or v0.2. This repository
> defaults to v0.3 but other repositories' defaults remain at v0.2.
> 2. Update users' Skia version (automatic if they update regularly).
> 3. Update users' Wuffs version and opt them in to Skia-uses-Wuffs-v0.3.
> 4. Flip Skia choosing Wuffs version 0.3 from opt-in to opt-out.
> 5. Remove the option for Skia to work wih Wuffs v0.2.
>
> Change-Id: Ie5cf238057060f2a40cc7c0070d6e2a076943e2b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295976
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>
TBR=scroggo@google.com,nigeltao@google.com
Change-Id: I2c8a44962eb9b136b199dba5f52a860d756a0aa1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296441
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
This is step 1 of a multi-step, multi-repository transition:
1. Let Skia work with either Wuffs v0.3 or v0.2. This repository
defaults to v0.3 but other repositories' defaults remain at v0.2.
2. Update users' Skia version (automatic if they update regularly).
3. Update users' Wuffs version and opt them in to Skia-uses-Wuffs-v0.3.
4. Flip Skia choosing Wuffs version 0.3 from opt-in to opt-out.
5. Remove the option for Skia to work wih Wuffs v0.2.
Change-Id: Ie5cf238057060f2a40cc7c0070d6e2a076943e2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295976
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Change-Id: I44f64a8c98c019a8f4878b0b6f6d82489aa8252c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296179
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Mike Reed <reed@google.com>