These don't return reliable portable results, so I don't want to promote
them as good ideas to use. You can get at least 5 different results
from these across the four main architectures we support, and they've
been the root cause of bugs uncovered only in production on undertested
platforms.
Luckily, unused outside of tests.
Change-Id: I532731fe4cddf127253341e5ace8d9c5c9ebb0f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326108
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Same idea as http://review.skia.org/325857; I just wanted to feel out
the options myself. A couple key ideas:
Prefer SkTo32() to separate range assertions and casts.
Keep using int indices, counting to this->count() where
fCount would have warned about signed/unsigned mismatch.
I've kept new comments and assertions to minimum. In the end we won't
change the max size of SkTArray, and I don't see much need to call out
how much it hasn't changed. Reading back over the accumulated changes,
I don't really see much that's newly error-prone.
Change-Id: I86a8a161b9ae44f24fc25093741945b75fbfa770
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326106
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
The original SkIRect* crop rect argument was a little too onerous.
First, as a pointer, it required you to declare your crop rect separately
just to take a pointer to it. Now, you can pass an SkIRect or SkRect in
directly when you are explicitly constructing a cropped filter.
Second, the crop rect is transformed by the same matrix as the other
filter parameters, so it can be scaled and translated. Allowing SkRect
instead of just SkIRect gives more precision and flexibility for local
coordinate systems. Now a crop rect could be defined to be from [-.5, .5]
and still map to real pixels after transformation (this was a request
from the skia-discuss mailing list, and also better matches the SVG spec).
The crop rect argument was always meant to be a convenience, since I
plan to refactor cropping into an indenendent image filter that will
give more explicit control over when the crop is applied in the DAG.
To maintain the convenience for the factories, the constructors of
the new CropRect type are not explicit so that callers don't ever need
to concern themselves with it.
Bug: skia:9296
Change-Id: I29a684cb925f1fca4dabc803114ab2b125660aaa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324622
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This basically adds the functionality to GrResourceProvider to handle
scrate MSAA attachments. There are not current users of this, but
users will be added in follow on changes.
Bug: skia:10727
Change-Id: Ieb8d247e034fb22ac9ff4fc549935310329a1c1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320267
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Just a little refactor no-op.
Change-Id: I1842a0190cd96c60da2fe3c7f88fa56c9f73af81
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325681
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Rewrite map() to allow any number of arguments,
now also used for 2-argument (pow) and 3-argument (fma) operations.
I left a note about fma()... I can't understand why, but calling as
map(fmaf, x,y,z) ends up with scalar calls to fmaf(), but with the
lambda indirection we see perfect vector codegen.
I had to break map() back into two parts. I don't see any way to pass
both a variadic number of arguments and play our trick with the default
std::index_sequence parameter. The lane lambda similarly exists only to
split up the expansion of the Rest... type pack from the I... index
pack; you can't use two pack expansions in the same expression.
Change-Id: Ia156a7fd846237f687d6018a7f95550c9fd4a56d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325736
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
A change made in the spirit of not being weird. C++ containers typically
expose their capacities to non-test code, with a function "capacity."
Change-Id: Icc7e175a20aff53ef9e144ac9620ced29ef5e95a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325657
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
The call order here is a little weird – it could use some refactoring
but for now it's just a cut-and-paste job.
Change-Id: I931493a421f7fd1df69f0c47055b90a2996c7dc3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325459
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
This is pretty much just cutting & pasting the code naïvely,
but it's the safe way to go so that we don't impact the
order of events during this housekeeping.
Change-Id: I8d9f2ffb560b34fd1a8d9603174ff1f17803e447
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324619
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
SkImageFilters::Paint did not use every slot of the SkPaint, with only
its color, alpha, color filter, and shader having a meaningful effect on
the image filter result. It was always blended into a transparent dst,
so blend mode wasn't very relevant, and it was always filled to whatever
required geometry, so stroke style, path effect, and mask filters were
ignored or not well specified.
Color, alpha, and color filter can all be combined into an SkShader, so
a more constrained SkImageFilters::Shader provides the same useful
capabilities without as many surprises.
SkImageFilters::Paint still exists, but is deprecated to be removed
once I've confirmed clients aren't depending on it.
Bug: skia:9310
Change-Id: I11a82bda1a5d440726cf4e2b5bfaae4929568679
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323680
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This reverts commit 48d8724097.
Reason for revert: Breaking MSVC bots
Original change's description:
> Merge GrContext::init into GrDirectContext ...
>
> And minor cleanups associated with the initialization of these classes.
>
> Change-Id: Ida0372d0b1a0b8bf5b309814de5418e47ea34fdb
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324122
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>
TBR=robertphillips@google.com,adlai@google.com
Change-Id: I00b2ddaeaef53e3fe05a338c88158cf235f325c4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324132
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
And minor cleanups associated with the initialization of these classes.
Change-Id: Ida0372d0b1a0b8bf5b309814de5418e47ea34fdb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324122
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Migration should be free because (1) the non-Android API is
only loosening up to GrRecordingContext and (2) the Android API
can only see GrContext through including GrDirectContext.h
Change-Id: I97aa75baba0b0969361db6eaef9f83ea94183700
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323557
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Once triangulated paths are added this will no longer just be storing proxy views.
Bug: 1108408
Change-Id: I82fa47b0b85f738d9a25330c29bc2892c9bfeda4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323999
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Like the destructors, most of these can just go unspoken.
SkTArray only knows its size in Debug builds, so it can't easily grow a
copy constructor. Instead just keep the explicit copies and moves on
SkTHashTable, and mark the others as explicitly default. I inverted the
pattern from assign-by-copy to copy-by-assign, but it's all basically
the same.
Change-Id: I0df552ef547ce9c7e232267c072a5f3b09197847
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324056
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This will enable us to use SkTHashMap to store our definition maps.
Change-Id: I6017dfa71e1c5e68a20c97e955bb3d3abf347f0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323891
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Currently there is nothing using these formats, but this change just adds
them along with a quaries about their properties. They will be used in a
follow up change.
Bug: skia:10727
Change-Id: Iaaf13baf372799d47c65bd974fd204a32be57617
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322622
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
and begin using it for cached SW-generated blur masks.
This is needed to begin mixing and matching HW & SW-generated blur
masks since they have different draw-rects.
It will also be useful if/when we add support for triangulated paths
to the thread-safe cache.
Bug: 1108408
Change-Id: I085ad1127dc2deb98b35d704b06e50b27c72fd1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322657
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
I wrote code that called SkAutoTArray::data() and discovered that it
was broken, but not generating compile errors because it's part of a
template and never instantiated anywhere else. I fixed the
implementation and added it to our container unit test to prevent later
regression. This revealed another issue, that "containers in
SkTemplates.h [should] all have a consistent api", according to
test_container_apis. However, data() was never added to the non-array
container APIs. So I added data() to the other containers as well.
Change-Id: I52532c91fdab3fc8c4539053ba8420815b7b0ee5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323276
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Adds a new helper that creates a GrBackendRenderTarget using
GrGpu and then wraps it in a SkSurface. Uses the SkSurface
release proc to delete the BERT using GrGpu.
Upgrades GrGpu::createTestingOnlyBackendRenderTarget to create MSAA
buffers.
Updates many tests/tool to call sites to use the helper instead of
SkSurface::MakeFromBackendTextureAsRenderTarget.
Adds syncToCpu bool to SkSurface:: and GrContext::flushAndSubmit.
Bug: skia:9832
Change-Id: I73a8f0ce09dc6523729af0814464c6b6657fda06
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293683
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
When flattening we always flatten to kTopLeft.
Rename some origin params to SkImage factories to make it clearer
that they refer to input texture origins.
Only preserve the origin in the variants that immediately flatten
to RGBA as part of contract (make SkImage_Gpu not SkImage_GpuYUVA).
Bug: skia:10632
Change-Id: I0ed9d693758086c4050f983b579d0d77daefc3d7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322486
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This is a reland of c1916c34fe
As it turns out, benches are not always given a canvas.
Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
Change-Id: I61a2ac058fafc99653e3304876cf4b97350dac8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322490
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This reverts commit c1916c34fe.
Reason for revert: Bots unhappy
Original change's description:
> Remove use of legacy display globals.
>
> In the ongoing effort to remove the display globals from Skia, allow
> their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
> in a normal Skia build and remove all use from Skia code.
>
> Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
> Reviewed-by: Herb Derby <herb@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
TBR=djsollen@google.com,bungeman@google.com,herb@google.com,reed@google.com
Change-Id: I365d2b1d19241a90130bc1b59663651817966f63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322400
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
In the ongoing effort to remove the display globals from Skia, allow
their use only if SK_LEGACY_SURFACE_PROPS is defined. Do not define this
in a normal Skia build and remove all use from Skia code.
Change-Id: I9ff550f5db246b9024aac687a1bc01321f1be4c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319343
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This adds docs or stubs for everything that is on the main CanvasKit
object.
Paragraph, Particles, and Skottie will be their own CLs.
Bug: skia:10717
Change-Id: I0f5027d73b2ac7d127f3a03a8f1aaa15f694ae38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321789
Reviewed-by: Nathaniel Nifong <nifong@google.com>
This also includes matrices (which I'm reminded I want to test with
TypedArrays and make optional).
Bug: skia:10717
Change-Id: I0f6565a46b766c1f81c28dfc1229d403bff32e69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321118
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Bug: skia:10632
Change-Id: Icb27e44d234063ab049fef95587f474323d7ada9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321537
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This will allow us in a follow on change to put in a "fake" gl stencil
format for the wrapped FBO.
Bug: skia:10727
Change-Id: Iba1eca5114b34d25e6a220591d28a20f7b36b12b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321545
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
The SkRasterClip on DeviceCM appears to be unused and just increased the
size of that struct. Now the clip is tracked on the MCRec or within
SkBitmapDevice itself.
This adjusts the reserved size for DeviceCM to match (as reported on my
machine), and moves it into an anonymous namespace.
Change-Id: Ifa8635f839fc3d75339a64c9378ee054fe0cc071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321250
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Instead of being passed separately.
Check sample count in various onWrap methods in GrMtlGpu.
Bug: skia:9832
Cq-Include-Trybots: luci.skia.skia.primary:Test-iOS-Clang-iPhone8-GPU-AppleA11-arm64-Release-All-Metal,Test-iOS-Clang-iPhone7-GPU-PowerVRGT7600-arm64-Release-All-Metal,Test-iOS-Clang-iPadPro-GPU-PowerVRGT7800-arm64-Release-All-Metal,Test-iOS-Clang-iPhone11-GPU-AppleA13-arm64-Release-All-Metal,Test-iOS-Clang-iPhone6-GPU-PowerVRGX6450-arm64-Release-All-Metal,Test-Mac10.15-Clang-MacBookAir7.2-GPU-IntelHD6000-x86_64-Release-All-Metal
Change-Id: If5813db95b07f5d272e80920486f461cc5a587fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320956
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Makes it simpler to call methods that update the internal ref counted
state.
Change-Id: Iecefab2c14ff13eae2fa34eafdcc7e031b3c85b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320957
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Remove separate constructor arg from GrBackendRenderTarget.
Add appropriate checks in onWrap functions in GrD3DGpu to limit to
previous functionality.
Bug: skia:9832
Cq-Include-Trybots: luci.skia.skia.primary:Test-Win10-MSVC-Golo-GPU-QuadroP400-x86_64-Debug-All-Direct3D,Test-Win10-Clang-ShuttleA-GPU-RadeonHD7770-x86_64-Debug-All-Direct3D
Change-Id: Ieba398d4bc00d18fdb0adffcda81f1a166db24b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320757
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Pre-req for allowing rendering to an externally created MSSA VkImage.
Bug: skia:9832
Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-Clang-NUC7i5BNK-GPU-IntelIris640-x86_64-Release-All-Vulkan,Test-Win10-Clang-NUC8i5BEK-GPU-IntelIris655-x86_64-Release-All-Vulkan,Test-Win10-Clang-ShuttleA-GPU-RadeonHD7770-x86_64-Release-All-Vulkan,Test-Android-Clang-GalaxyS9-GPU-MaliG72-arm64-Release-All-Android_Vulkan,Test-Android-Clang-GalaxyS7_G930FD-GPU-MaliT880-arm64-Release-All-Android_Vulkan,Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_Vulkan,Test-Android-Clang-Pixel4XL-GPU-Adreno640-arm64-Release-All-Android_Vulkan,Test-Android-Clang-P30-GPU-MaliG76-arm64-Release-All-Android_Vulkan
Change-Id: Ibf41944c6946dda7e27bdcd509ecd04976fc9ade
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320262
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Even when expanding clip ops were disabled, the max value allowed the
fuzzer to produce those disabled values. This should fix the fuzzer to
only produce valid intersect or difference clip ops.
Bug: chromium:1132687
Change-Id: I7368ff36a00e6b0e87ecbae5ba647d249299b9ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320064
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
We had lots of checks just checking defined but we always define
GR_TEST_UTILS
Change-Id: I588c50ddd91f71618a96ab6c9eda2050b423f611
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319682
Commit-Queue: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This is a reland of 2bded27a96
Original change's description:
> Allow rect and circle blur fast cases to be used with rotation matrices.
>
> For circles this is trivial. The existing shader works as is.
>
> For rects this requires back projecting from device space.
>
> Adds a GM for rotated rect blurs and modifies a circle blur GM to add
> rotation.
>
> Bug: chromium:1087705
>
> Change-Id: I6b969552fbcc9f9997cfa061b3a312a5a71e8841
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318757
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Bug: chromium:1087705
Change-Id: Ie3ef96c40461665f6207225a15e19b4cf5bcba94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319338
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>