Commit Graph

10649 Commits

Author SHA1 Message Date
Adlai Holler
14dc791bc4 Reland "Migrate SkImage::MakeFromTexture to GrRecordingContext"
This reverts commit 74b83a4ea9.

Reason for revert: Flutter is updated

Original change's description:
> Revert "Migrate SkImage::MakeFromTexture to GrRecordingContext"
> 
> This reverts commit daa9e7455d.
> 
> Reason for revert: Broke Build-Debian9-Clang-arm-Release-Flutter_Android_Docker
> 
> Original change's description:
> > Migrate SkImage::MakeFromTexture to GrRecordingContext
> > 
> > Android migration landed in Android CL 12234077
> > Chrome migration is landing in Chrome CL 2335812
> > 
> > Note: makeFromCompressedTexture is not used by Chrome.
> > 
> > Bug: skia:104662
> > Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Auto-Submit: Adlai Holler <adlai@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> 
> Change-Id: I570945521c6cd78dfeea81e492b7e2b31dd0e6f5
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308505
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

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

Bug: skia:104662
Change-Id: Ie1d7fd9e597e6e6e5bd91bec086e83a8c1f45a37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309321
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-12 18:35:51 +00:00
Robert Phillips
079455c739 Make the GrSmallPathAtlasMgr a flush-time object
This will allow the small path renderer to be used w/ DDLs.

This is broken out of the omnibus CL:

https://skia-review.googlesource.com/c/skia/+/307776 (Split the small path renderer into record-time and flush-time pieces)

Bug: 1108408
Change-Id: I64cc6ff677d0aead7cf2f097c0e7fbb15b49d49d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309304
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-12 13:30:56 +00:00
Leon Scroggins III
4f4be9bd4b GrVkTypes: Change externalFormat to be uint64_t
This matches the Vulkan type. This also fixes a warning when comparing
to another uint64_t.

Update GrVkSamplerYcbcrConversion::Key to match as well.

Change-Id: I6fc5d9456ee466dc3d98240acf935139a7808a02
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309325
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-11 20:33:18 +00:00
Adlai Holler
c41ae2a3cf Reland "Migrate MakeCrossContextFromPixmap to GrDirectContext"
This reverts commit ae04cc9099.

Reason for revert: Flutter g3 roll complete

Original change's description:
> Revert "Migrate MakeCrossContextFromPixmap to GrDirectContext"
> 
> This reverts commit 066f7d6b1a.
> 
> Reason for revert: Cant land until flutter PR 20235 reaches g3
> 
> Original change's description:
> > Migrate MakeCrossContextFromPixmap to GrDirectContext
> > 
> > This function isn't used by Chrome so we migrate directly.
> > Flutter migration is at https://github.com/flutter/engine/pull/20235
> > 
> > Bug: skia:104662
> > Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> 
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
> 
> Change-Id: I100a87075ffdf5c0cda78c95f1cfe3310f97630e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308501
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

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

Bug: skia:104662
Change-Id: I32e36aa1c70902296e7f28d0f8b52d4e55b264a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309320
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-11 19:53:06 +00:00
Jim Van Verth
765c5928ef MSAA improvements for Direct3D.
* Fixes quality value
* Enables grabbing sample positions
* Enables centering samples for non-hardware AA

Change-Id: I5cabc0804b4a57347b7072b100c17310155c0ebc
Bug: skia:10476
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308798
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2020-08-11 14:21:05 +00:00
Robert Phillips
5edf510941 Add plumbing for access to the flush-time GrSmallPathAtlasMgr
This isn't connected to anything yet and parallels what is done
for the text GrAtlasManager.

The rough pattern is that the GrContext hierarchy implements creating
the atlas but it is only exposed/made available via the flush state
(which derives from GrDrawMeshOp::Target).

TBR=bsalomon@google.com
Bug: 1108408
Change-Id: Iad7b5648877dbd20840e8d47c1d24131098ded94
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309128
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-11 12:53:55 +00:00
Brian Osman
a4b9169fb6 Remove 'in' variables from SkRuntimeEffect
Runtime effects previously allowed two kinds of global input variables:
'in' variables could be bool, int, or float. 'uniform' could be float,
vector, or matrix. Uniform variables worked like you'd expect, but 'in'
variables were baked into the program statically. There was a large
amount of machinery to make this work, and it meant that 'in' variables
needed to have values before we could make decisions about program
caching, and before we could catch some errors. It was also essentially
syntactic sugar over the client just inserting the value into their SkSL
as a string. Finally: No one was using the feature.

To simplify the mental model, and make the API much more predictable,
this CL removes 'in' variables entirely. We no longer need to
"specialize" runtime effect programs, which means we can catch more
errors up front (those not detected until optimization). All of the API
that referred to "inputs" (the previous term that unified 'in' and
'uniform') now just refers to "uniforms".

Bug: skia:10593
Change-Id: I971f620d868b259e652b3114f0b497c2620f4b0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309050
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-08-10 22:00:44 +00:00
Robert Phillips
3262bc8f66 Clarify that the GrDirectContext uniquely holds the text atlas manager
Bug: 1108408
Change-Id: Iad0b634a8a0d6dac64e3571a32e755d124401f66
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309077
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-08-10 17:23:54 +00:00
Mike Reed
375721d7bb SkPathView for ownerless (can live on stack) SkPaths
Follow-on CLs will push higher up in SkDraw, so that everywhere today
we have to cons-up (with the associated mallocs) a temp SkPath we can
replace it with a stack-based SPath...
- drawRect
- drawOval
- drawRRect
- drawLine(s)
(similar to how this CL already handled quads and triangles)

Bug: skia:10566
Change-Id: I882b4f4c60e80235ca83c86c926e905b269a7afd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307784
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-07 20:39:38 +00:00
John Stiles
ec9b4aab87 Enable ClangTidy check readability-const-return-type.
https://clang.llvm.org/extra/clang-tidy/checks/readability-const-return-type.html

`const` on a non-pointer/reference return type typically doesn't add
value and can have negative side effects. (i.e., returning a
`const std::string` isn't meaningfully different from returning a
`std::string`, but can sometimes inhibit move-related optimizations.)

In Skia's case, the priv() functions are a notable exception where const
return types are intentional and valuable. These calls have been marked
with NOLINT to exclude them from the check.

This check does not affect pointer and reference returns, where
constness is important.

Change-Id: I86cab92332f164e5ab710b4127182eec99831d7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308564
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-07 17:42:38 +00:00
Brian Osman
871aa74797 Add support for children to runtime color filters
Like shaders, sampling a null child will return the input color (in
this case, the output of the skia shader stage). This gives us a path
to removing the implicit input color passed to main, which is the real
goal. Using this to create more interesting color filters is also
possible, although we need to add the versions of sample() that take a
color to really unlock the potential.

Change-Id: I6a7506055120756497d7583f14d6f928180825fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308515
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-08-07 14:50:36 +00:00
John Stiles
a6841be235 Enable ClangTidy check llvm-namespace-comment.
This fixes a large number of SkSL namespaces which were labeled as if
they were anonymous, and also a handful of other mislabeled namespaces.
Missing namespace-end comments have been added throughout.
A number of diffs are just indentation-related (adjusting 1- or 3-
space indents to 2-space).

Change-Id: I6c62052a0d3aea4ae12ca07e0c2a8587b2fce4ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308503
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-08-06 19:07:52 +00:00
Adlai Holler
74b83a4ea9 Revert "Migrate SkImage::MakeFromTexture to GrRecordingContext"
This reverts commit daa9e7455d.

Reason for revert: Broke Build-Debian9-Clang-arm-Release-Flutter_Android_Docker

Original change's description:
> Migrate SkImage::MakeFromTexture to GrRecordingContext
> 
> Android migration landed in Android CL 12234077
> Chrome migration is landing in Chrome CL 2335812
> 
> Note: makeFromCompressedTexture is not used by Chrome.
> 
> Bug: skia:104662
> Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Auto-Submit: Adlai Holler <adlai@google.com>

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

Change-Id: I570945521c6cd78dfeea81e492b7e2b31dd0e6f5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308505
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-06 17:25:09 +00:00
Adlai Holler
ae04cc9099 Revert "Migrate MakeCrossContextFromPixmap to GrDirectContext"
This reverts commit 066f7d6b1a.

Reason for revert: Cant land until flutter PR 20235 reaches g3

Original change's description:
> Migrate MakeCrossContextFromPixmap to GrDirectContext
> 
> This function isn't used by Chrome so we migrate directly.
> Flutter migration is at https://github.com/flutter/engine/pull/20235
> 
> Bug: skia:104662
> Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: I100a87075ffdf5c0cda78c95f1cfe3310f97630e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308501
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-08-06 16:17:28 +00:00
Brian Osman
92aac1e1b3 Disallow runtime effect color filters that depend on position
Some of these checks are currently redundant (we don't allow color
filters to have children right now). But the next CL will re-add that
capability, and the unit tests here will ensure we don't re-break things
by allowing child-sampling to violate the color filter invariant.

Change-Id: I54c10d8b1d1e376c13347296765185d42b9f644a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308285
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-08-06 16:06:47 +00:00
Mike Klein
81b276ea98 add SkGraphics::AllowJIT()
Change-Id: I82aeea670c19e08e51ddc094f66f41244e4f5ec8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308497
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-06 14:38:26 +00:00
Adlai Holler
daa9e7455d Migrate SkImage::MakeFromTexture to GrRecordingContext
Android migration landed in Android CL 12234077
Chrome migration is landing in Chrome CL 2335812

Note: makeFromCompressedTexture is not used by Chrome.

Bug: skia:104662
Change-Id: Ibbe6d412cf22e87188926383d10b21f780208e48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305102
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-06 14:02:56 +00:00
Adlai Holler
066f7d6b1a Migrate MakeCrossContextFromPixmap to GrDirectContext
This function isn't used by Chrome so we migrate directly.
Flutter migration is at https://github.com/flutter/engine/pull/20235

Bug: skia:104662
Change-Id: I9d875acdbd162f50a6d86b3a4cae3f400e4dd38f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305180
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-08-06 14:00:57 +00:00
Mike Klein
0d6f81593b iwyu fixes for VS 16.7's STL
This lets us build with the STL from the new Visual Studio 16.7 release,
https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes#16.7.0

Specifically, I think this is from STL updates,
https://github.com/microsoft/STL/wiki/Changelog#vs-2019-167

Probably this one,

    <array> no longer includes <algorithm>, <iterator>, and <tuple>; this is
    a source-breaking change for projects that weren't strict about
    including what they use. #482

Change-Id: Id95a7966c636b70b56522bc80e6daa626749e916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308496
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-08-06 13:45:07 +00:00
Leon Scroggins III
f21d6b9b71 Reland "Add an SkImageGenerator that uses NDK APIs"
This reverts commit 07438b0cda.

Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: I4ca07d832dbd6a9d8cff0faea975fd70da00718f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308185
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 18:55:30 +00:00
Adlai Holler
2bc83187bf Remove staging API for SkImage::makeWithFilter
Chrome migration landed in CL 2335640

Bug: skia:104662
Change-Id: I787d7f469ff474bec1e7e2803cdd492e18821a6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308191
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-05 17:51:46 +00:00
Adlai Holler
f7129fc173 Migrate MakeFromAdoptedTexture to GrRecordingContext
This also follows up on the comments Rob left in his zombie review.

Bug: skia:104662
Change-Id: I7031f7b2832eb3f47025e5d269248b854cc912e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307780
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-05 17:47:25 +00:00
Leon Scroggins
07438b0cda Revert "Add an SkImageGenerator that uses NDK APIs"
This reverts commit cfef980939.

Reason for revert: Breaking Google3 roll

Original change's description:
> Add an SkImageGenerator that uses NDK APIs
> 
> Bug: skia:10369
> Bug: skia:10371
> 
> This will allow Skia clients developing for Android 11+ to rely on
> Android's NDK APIs for decoding, which will allow them to decode
> without including their own decoding libraries (e.g. libjpeg-turbo).
> Using these APIs also provides support for static HEIF images.
> 
> Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
> visually.
> 
> Add tests and a grayscale png.
> 
> Update some test bots running Android R to specify ndk_api so they will
> run the new code.
> 
> Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=djsollen@google.com,mtklein@google.com,scroggo@google.com,brianosman@google.com,reed@google.com

Change-Id: Ifed506a76a0ff5903d101c1bf7330d319b8376a6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10369
Bug: skia:10371
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/308180
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 14:42:51 +00:00
Leon Scroggins III
cfef980939 Add an SkImageGenerator that uses NDK APIs
Bug: skia:10369
Bug: skia:10371

This will allow Skia clients developing for Android 11+ to rely on
Android's NDK APIs for decoding, which will allow them to decode
without including their own decoding libraries (e.g. libjpeg-turbo).
Using these APIs also provides support for static HEIF images.

Run ImageGenSrc in kPlatform_Mode on Android to verify decoding
visually.

Add tests and a grayscale png.

Update some test bots running Android R to specify ndk_api so they will
run the new code.

Change-Id: Ica782339b2414d472ede0b61729a127ce41892a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305689
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-08-05 13:44:39 +00:00
Adlai Holler
273bc3000d Remove two staging APIs post-Chrome-migration
These two staging flags were removed in Chrome CL 2327135

Bug: skia:104662
Change-Id: I5b794f0c5e2c53cca82ec471dda3da3a722f5c9e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307781
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-08-04 18:48:00 +00:00
Ben Wagner
6fbd92db65 Better serialize variations, separate SkFontData.
SkFontDescriptor and its serialization and usage are updated to better
reflect how variations should be serialized. In addition this begins
teasing apart SkFontData since it is now mostly an artifact of how the
FreeType port works than anything else.

This also removes SkTypeface::MakeFromFontData since it is no longer
used and since SkFontData (which it takes as a parameter) was never
public. SkFontMgr::makeFromFontData now only exists to support older
skps and may be removed in the future.

Change-Id: I266bd5e87de85788661cdf5c571592ea1f2ae669
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307344
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-08-04 16:38:26 +00:00
Mike Reed
093de4eb2c Use more of pathbuilder
Bug: skia:9000
Change-Id: Ia5c16ffbaeebbdd027c692c96095cfa181030d35
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307702
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-03 21:04:55 +00:00
John Stiles
fbd050bd0b Enable ClangTidy check modernize-make-unique.
The majority of existing call sites were automatically updated using
clang-tidy -fix. A small handful required a manual update,
e.g. CppCodeGen.

This check is a bit lenient, and in particular will not flag cases like
`std::unique_ptr<Base>(new Derived())` which is still pretty common
throughout our codebase. This CL does not attempt to replace all the
cases that ClangTidy does not flag.

Change-Id: I5eba48ef880e25d22de80f321a68c389ba769e36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307459
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-08-03 17:53:52 +00:00
Mike Reed
cfb130c662 Add arc methods to path builder
Bug: skia:9000
Change-Id: I0a25c6f792f59230762651386da74e547b073930
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307558
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-03 15:50:01 +00:00
Mike Reed
74a7a81b98 fix addOval and addRRect on builder
Need to notify the underlying pathref if we've made oval or rrect

Bug: skia:9000
Change-Id: I57a801f1fb446b99634d7b028249a812a5a978f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307516
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-03 13:18:17 +00:00
Mike Reed
b746d5c02b add static factories for SkPath
Bug: skia:9000
Change-Id: I474d512cafd79d7c74b42ee86cb34c039fd960b1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307458
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-02 23:40:06 +00:00
Mike Reed
4b4cd13d44 Builder has addPolygon, plus start hiding edit methods
Bug: skia:9000
Change-Id: I5d7df2d720090a6d9c80443b39041fb17ede4b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307347
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-02 21:33:06 +00:00
Mike Reed
5bc663a55b add relative segment methods
Bug: skia:9000
Change-Id: I1e7a4f3c799b7f6cd20e415880300a577a5a3c16
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307346
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-01 18:07:24 +00:00
Mike Reed
2243d77c5c use pathbuilder
Bug: skia:9000
Change-Id: I08a50c9f5e9993d9dd427f154077c56f6097e947
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307345
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-08-01 02:32:04 +00:00
Leon Scroggins III
577536aa1a Remove "dummy" to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 162536543
Change-Id: I40df639e2f42da6d99d897a02cf05aecff682061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307226
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-07-31 19:11:23 +00:00
Jose Dapena Paz
dc4da5ac9a GCC: fix type passed to vcvt_f32_f16 to be a float16x4_t in SkVx.h
GCC intrisics type validation is stricter than the one in Clang, so
passing a uint16x4_t to a function expected to accept float16x4_t
is not valid.

Bug: chromium:819294
Change-Id: I6d68e5458345e78bdb05dd028481fe9cae36c5ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307276
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-31 19:09:33 +00:00
Florin Malita
76e22a31a8 Fix path builder initial gen ID
kEmpty means 'empty path', we want 0 to recompute as needed.

Change-Id: Ia9b2eb4f8e4b73ab2d5c05721cc9189be3653acb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/307223
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-31 18:46:03 +00:00
Brian Salomon
17dc63f01d Don't define SK_GL when no other GPU backends are enabled
SK_GL must explicitly be defined to enable the GL backend,
e.g. by setting skia_use_gl in gn args.

Change-Id: I61008b5422f4690e6f012609b239cd74e63d9f92
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306732
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-31 14:14:35 +00:00
John Stiles
f8869a24e7 Remove SK_REQUIRE_LOCAL_VAR macro.
The ClangTidy check `bugprone-unused-raii` has been enabled at
review.skia.org/306838; this check provides equivalent protection.

Change-Id: I9f3858bfd2bede107d509a5a206a08293d5f914c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306953
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-31 02:32:01 +00:00
Mike Reed
dab30349d7 mark SkPathBuilder as SK_API
Bug: skia:9000
Change-Id: I9c557460bc9cfbfa6c0506219452ae149b43546c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306950
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-30 22:06:21 +00:00
Elliot Evans
6b2602ed2d Remove remaining usages of skvx::mad
This CL attempts to remove the remaining subset of skvx::mad usages.
https://skia-review.googlesource.com/c/skia/+/304853 removes all usages
of skvx::mad but causes small differences in rendering, so it is not
suitable for landing.

https://skia-review.googlesource.com/c/skia/+/306702/ removes all
non-nested usages of skvx::mad

Change-Id: Iab5d4cfd0feb856c38b3ebbfe3bf3ed5aad20fe6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306722
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Elliot Evans <elliotevans@google.com>
2020-07-30 20:41:09 +00:00
Adlai Holler
e34b282ed0 Migrate MakeFromAdoptedTexture to GrDirectContext
More recontexting for SkImage. Chrome flag in CL 2323135.
Flutter migration landed in https://github.com/flutter/engine/pull/19962

Bug: skia:104662
Change-Id: Id725eb130310639457ba90f378ecdb334dd5f3cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306182
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-29 20:15:00 +00:00
Ben Wagner
0795361b45 SkUNREACHABLE should fail, not be UB.
The use of __builtin_unreachable() and __assume(false) are actually
injections of undefined behavior. They do not crash and they may allow
the compiler to assume that any values which could cause that location
to be reached cannot occur. They should only be used after code which
cannot return but the compiler cannot know that (such as inline assembly
which does not return and calls to functions which should have been
declared noreturn but were not).

Replace their use with __builtin_trap() and __failfast(). These are
similar to __builtin_debugtrap() or __debugbreak() but also indicate
that execution should not be resumed.

Change-Id: I46c1362f4e86944cc8e03f6f5837875ac71b69f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297024
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-29 17:24:29 +00:00
Adlai Holler
52ea577f93 Migrate MakeFromYUVATexturesCopy* to GrRecordingContext
These methods aren't used by our clients – plus we're only de-powering the
arg here so we should do fine on canaries.

Bug: skia:104662
Change-Id: I2ff5a4e06a5e82458148d555b6dc8643e7e5f60f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306336
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-29 15:00:36 +00:00
Mike Reed
8c7ecc1c06 Revert "Revert "Never share pixels when we make a subset image""
This reverts commit 39d1c1ebb6.

Fix: update gm to handle failures from (bad) gpu: PreAbandonGpuContext


Change-Id: I5a8584ec3493df6c9b9bb94fb84716fda0aadccb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306378
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-29 12:42:16 +00:00
Mike Reed
3a608e5bc9 remove (unused) DirectTo... methods
Change-Id: Ie5eea2902c64fc44e4e6e53b1ee3b869d430d482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306331
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-28 23:47:07 +00:00
Mike Reed
39d1c1ebb6 Revert "Never share pixels when we make a subset image"
This reverts commit 3eff2459d4.

Reason for revert: did I break abandongpu bot?

Original change's description:
> Never share pixels when we make a subset image
> 
> - mostly just affects Lazy images (raster was already always copying)
> - issue with other factories that offer subsetting
>    - (e.g. MakeFromGenerator)
>    - can we remove those options, and require makeSubset() afterwards?
> - greatly simplifies dealing with mipmaps
> 
> Landing this would obsolete
> https://skia-review.googlesource.com/c/skia/+/305960
> 
> Related: https://skia-review.googlesource.com/c/skia/+/306136
> 
> Related: https://bugs.chromium.org/p/skia/issues/detail?id=10544
> 
> Change-Id: I074420543bd2fcd46ed1620bbf0eed00371ab018
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305970
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>

TBR=mtklein@google.com,bsalomon@google.com,robertphillips@google.com,scroggo@google.com,brianosman@google.com,reed@google.com

Change-Id: Iab2f92855fe61e48f0e432b7257eb7ddef78fcfa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306377
Reviewed-by: Mike Reed <reed@google.com>
2020-07-28 21:29:45 +00:00
Mike Reed
3eff2459d4 Never share pixels when we make a subset image
- mostly just affects Lazy images (raster was already always copying)
- issue with other factories that offer subsetting
   - (e.g. MakeFromGenerator)
   - can we remove those options, and require makeSubset() afterwards?
- greatly simplifies dealing with mipmaps

Landing this would obsolete
https://skia-review.googlesource.com/c/skia/+/305960

Related: https://skia-review.googlesource.com/c/skia/+/306136

Related: https://bugs.chromium.org/p/skia/issues/detail?id=10544

Change-Id: I074420543bd2fcd46ed1620bbf0eed00371ab018
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305970
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2020-07-28 21:20:57 +00:00
John Stiles
ace773d8c0 Use SkScalar type where appropriate.
Change-Id: Iec4c3dedd0790fc637a914517b2abbb8e303520f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306320
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-07-28 20:13:37 +00:00
Ben Wagner
1e67f7fced Mark sk_abort_no_print [[noreturn]].
It isn't expected that sk_abort_no_print should return (it should
abort). This also allows removal of the SkUNREACHABLE from SK_ABORT.

Also make sk_abort_no_print actually not able to return.

Change-Id: Ibd5eda019820ed7e91de37a048efdfb0d1097aff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306188
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-28 17:40:31 +00:00
Mike Reed
564d49ec10 Remove subset parameter from making encoded/generator images
Since subsetting may require rasterizing/resolving the generator, we may
also need access to the GrDirectContext. To simplify apis, rely on
makeSubset() for that.

Related: https://skia-review.googlesource.com/c/skia/+/305970

Change-Id: I1980e3c823fb6cf54f197c350942c2f82b03e20f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306136
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-28 17:33:12 +00:00
Adlai Holler
c0ca856c05 Change makeTextureImage staging to allow either API
This fixes a Chrome canary failure in skia CL 305970 where
Chrome has the flag set, and so we can't internally call the
GrDirectContext variant.

This matches the more recent migrations we've done. Hopefully
soon Chrome's GrDirectContext CL will get its final approvals and
all of this can go away.

Bug: skia:104662
Change-Id: I09cdff54e01c22578a970e5967815a2e470752bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306185
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-28 15:05:26 +00:00
Leon Scroggins III
a4c8098aea Remove gendered language
Bug: chromium:1101491
Bug: b/161896447

Found using

  git grep -wiEIl \ '(he)|(she)|(his)|(hers)|(him)|(her)|(guy)|(guys)'

Change-Id: I6b91853de067fd4c2e84f7ec70275522ce6c8bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306186
Commit-Queue: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-28 15:02:41 +00:00
John Stiles
9119625aae Remove unnecessary macros from SkString header.
They have been replaced with equivalent constants (and given the
requisite k prefix).

Change-Id: I70907eec234e0861cc97aac1ca03086faca42f9a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306160
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-07-28 15:00:21 +00:00
John Stiles
738c271b4a Update DataEntry struct to properly support move semantics.
Previously, DataEntry supported only move-construction but not move-
assignment.

Change-Id: I1dc1b2bc90a3dfe4cd74d4a6c2986b7d777f84d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306156
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-07-27 23:27:31 +00:00
John Stiles
0307e9114c Remove unreferenced function SkStrDup.
This isn't used, and doesn't seem like we will have a use for it going
forward. The SkString class should be used to allocate strings.

Change-Id: I024d1d7edb5d4946fa9ecfd4e10af84afc8b5df8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306065
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-27 21:31:37 +00:00
Herb Derby
53453f76b5 split transformed mask from SDFT
* transformed masks -> GrTransformedMaskSubRun
* GrMaskSubRun is SDFT -> GrSDFTSubRun

There is much duplicate code, which will be cleaned up shortly.

Change-Id: If54e388e89f7db15ddfd4b4354f0a1b4d6f5e36b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305686
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-26 16:59:44 +00:00
Greg Daniel
69267913ef Remove resource from GrD3DBuffer.
We will rely on the tracking of GrBuffers on the command list to manage
lifetime of d3d buffers. This also means we won't destroy the underlying
d3d buffer resource until the destructor.

Change-Id: I26084b8fffc65038891a0e48662d6a864c5dd8c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305719
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2020-07-24 20:30:00 +00:00
Brian Osman
b107a11f88 Add several more values to SkYUVColorSpace
Includes full-range Rec709 and BT2020, as well as more precise
matrices for 10 and 12 bit BT2020.

Bug: chromium:1108626
Change-Id: I28cbce982a00c082c8b510dbb7b144bdc1ce02e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305596
Reviewed-by: Dale Curtis <dalecurtis@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-24 18:49:10 +00:00
Kevin Lubick
7c8659256b Inclusive language
Bug: 842296
Change-Id: I4564f96d4f179211df19893270ccc222abcdd446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305439
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-24 13:33:53 +00:00
Robert Phillips
b25e0650dd Convert more tests to GrDirectContext/GrRecordingContext pair
TBR=bsalomon@google.com
Change-Id: I5bb78f4e36c4037669e7907cbe818da743480ef4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305009
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-23 12:49:06 +00:00
Mike Reed
3d30ca6d21 Add CubicResampler to makeShader
Only works on raster backend for the now.

Bug: skia:10344
Change-Id: I2c82d5345ae83a2bb2744ab27e3d971c57ea989e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303271
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 21:50:11 +00:00
Greg Daniel
95afafb2b0 Reland "Add GrContext api to update compressed backend textures."
This reverts commit ceebe424b1.

Reason for revert: relanding with fix

Original change's description:
> Revert "Add GrContext api to update compressed backend textures."
> 
> This reverts commit 2c180304dc.
> 
> Reason for revert: attempted workaround did not fix techno spark so needs further investigation
> 
> Original change's description:
> > Add GrContext api to update compressed backend textures.
> > 
> > Bug: chromium:1099255
> > Change-Id: I0c3f25ddb037e47e3b910fa89c3d8b3aa27b3114
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302265
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
> 
> Change-Id: Ib5433def02dc5dad97dcdbd4476ced6de2361e6a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1099255
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302576
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

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

Bug: chromium:1099255
Change-Id: Ie238a56b7f12fea8b6e251a050e5e2f4b20d2ede
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304741
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-22 16:46:55 +00:00
Adlai Holler
40ad5fd50a Migrate SkImage::flush methods to GrDirectContext
Flag landed in Chrome CL 2310889.

Bug: skia:104662
Change-Id: I616c7e6cd16104132bb0764c6d786a5cbeb4dd47
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304797
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>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-22 15:02:35 +00:00
Adlai Holler
247835b6c8 Reland "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit d13b97f94c.

Reason for revert: Fixed chromium canary

Original change's description:
> Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
>
> This reverts commit 7f0129d424.
>
> Reason for revert: Broke Chrome roll
>
> Original change's description:
> > Migrate SkImage::makeWithFilter to GrRecordingContext
> >
> > The staging flag landed in Chrome CL 2307531.
> >
> > Bug: skia:104662
> > Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:104662
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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


Bug: skia:104662
Change-Id: I815677659f776966b1c7e362ce3df444834dd482
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304803
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
2020-07-22 12:58:23 +00:00
Adlai Holler
01373555fe Remove GrContext variant of SkImage::isValid
Chrome was migrated in CL 2310974.

Bug: skia:104662
Change-Id: I0a49a7a6787fcce4c2a934c09140a3e4dad95869
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304776
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-22 12:49:23 +00:00
Brian Salomon
d007281c9a Fix clang 12 Wsuggest-override and Wsuggest-destructor-override
Change-Id: Ic44e24057b95bb014504f02a736fb4341afc8971
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304856
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-22 01:11:36 +00:00
Adlai Holler
d13b97f94c Revert "Migrate SkImage::makeWithFilter to GrRecordingContext"
This reverts commit 7f0129d424.

Reason for revert: Broke Chrome roll

Original change's description:
> Migrate SkImage::makeWithFilter to GrRecordingContext
> 
> The staging flag landed in Chrome CL 2307531.
> 
> Bug: skia:104662
> Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

Change-Id: I280dbffa26da71d53872266e62fa3bcaa3c00989
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:104662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304802
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 20:02:10 +00:00
Mike Reed
22874781cf make more constructors constexpr
Intended to help https://skia-review.googlesource.com/c/skia/+/303271

Change-Id: I9a66e39ae7de84c30900f208b7368bdc1e2d8f0e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304740
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-21 17:44:57 +00:00
Brian Salomon
8c82a87a6b Rename GrTexture/Proxy/Priv mip map members/functions
Change-Id: Ib55cab0ef76ced165d1936e7d084edc7fa579c55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304737
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-21 17:43:17 +00:00
Adlai Holler
7f0129d424 Migrate SkImage::makeWithFilter to GrRecordingContext
The staging flag landed in Chrome CL 2307531.

Bug: skia:104662
Change-Id: I8a483bfb83e890bb0566cd252a464a6add89df4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304003
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-21 17:37:27 +00:00
Herb Derby
1d17e49041 constify GrAtlasTextOp::Geometry
fSubRunPtr is currently mutable, but that will change in future CLs.

Change-Id: Ia3ab40855d7ea7c42eadf8889688fefb064f1bc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304696
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 16:56:27 +00:00
Brian Salomon
69100f05bb Rename GrCaps fields and methods from MipMap to Mipmap
Change-Id: I44d151dc80aca8fc6426735ee17224cb5b8aa576
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304603
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:56:21 +00:00
Greg Daniel
373d7dd0ed Add new GrContext::updateBackendTexture call that takes an SkColorType.
Change-Id: Iba71698f52eba3e7a99e0712a51ce48953b995db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304601
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-21 15:47:27 +00:00
Brian Salomon
40a40623c8 Rename GrBackendTexture::fMipMapped -> fMipmapped
Also mipMapped params to GrBackendTexture functions to mipmapped
GrBackendTexture::hasMipMaps -> GrBackendTexture::hasMipmaps

Misc test vars fMipMapped -> fMipmapped

Change-Id: Ic0651d14fc106c21b0ab45529875b95ed8dc2dfd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304598
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-07-21 15:29:06 +00:00
Brian Salomon
a6db510563 Rename GrMipMapsStatus GrMipmapStatus
For consistency with other enums and public APIs.

Change-Id: I026da5529f11051693cae5691c7ad92fad5ed446
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304597
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-21 15:12:30 +00:00
Brian Salomon
7e67dcaea6 Rename GrMipMapped GrMipmapped
Change-Id: Ia2cfbca8982b57399b6681cbb4501c2933ab4df7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304576
Auto-Submit: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-07-21 14:06:35 +00:00
Mike Klein
5333784c8c remove stray weakref include
Change-Id: I016de62543b5ba16a7193262cea343a77a71ba3b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304201
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-07-20 21:05:54 +00:00
Mike Reed
6d0ab954e9 read/write m44
Inspired by https://skia-review.googlesource.com/c/skia/+/303271

Change-Id: I64816f8db1742d263c8f668a7b44a08f20d82f5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304065
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-20 20:45:04 +00:00
Brian Osman
48a643daac SkRuntimeEffect: Always include GrTypesPriv, clean up variable type code
GrTypesPriv seems safe to include even without the GPU backend, which
lets us remove the condition from the struct layout. Hoisting and
reformatting the type conversion code just to make the core of the
factory easier to read. (More of this is coming).

Change-Id: I6e36b92789debc7b2630117c285c592ca7cbc37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304001
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-07-20 16:33:03 +00:00
Adlai Holler
9f1760bf73 Remove two unused deprecated SkImage functions
This is part of a larger effort to clean up the SkImage API and require
users to provide the direct GPU context for manipulating GPU images.

Bug: skia:104662
Change-Id: Ic7fd675a6ec09f001266fd79efdf084368ab6cd5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303630
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-17 17:02:10 +00:00
Herb Derby
c24a6afdb0 create SkAtlasSubRun API subclass SkMaskSubRun
The SkMaskSubRun is just a temporary name while I pull out the
different subclasses.

Change-Id: I363742a98a0596ba3d282b918cc0492ab1e0e5d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303357
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-17 15:55:20 +00:00
skia-autoroll
3164b4494f Roll skcms from c21106442079 to f73242142ce5 (1 revision)
https://skia.googlesource.com/skcms.git/+log/c21106442079..f73242142ce5

2020-07-16 mtklein@papyrus.localdomain add skcms_TransferFunction_isFooish()

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/skcms-skia-autoroll
Please CC nifong@google.com,mtklein@google.com on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/master/autoroll/README.md

Change-Id: I77846e3f984c295e25f7a72c38cdb0002de24a8f
Cq-Include-Trybots: luci.chromium.try:linux-blink-rel
Tbr: nifong@google.com,mtklein@google.com
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303442
Reviewed-by: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
Commit-Queue: skia-autoroll <skia-autoroll@skia-public.iam.gserviceaccount.com>
2020-07-16 21:50:37 +00:00
Mike Reed
fd6f709ce8 Revert "Revert "Serialize mipmaps""
Fix: use ImageGenerator factory instead of SkCodec, in case the client
provides generators in some other fashion (other than SkCodec).

This reverts commit 442d424a72.

Change-Id: Ia22f44ef83900413f905fe38570d18a640fca98e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303496
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-16 21:30:27 +00:00
Adlai Holler
4caa935bfe Migrate MakeTextureImage to take GrDirectContext
This is part of a larger effort to force SkImage users to specify
the direct context they want to use when manipulating GPU images.

Chrome CL 2299194 (landed) enables the staging flag.

bug: skia:10466
Change-Id: I959db57dd8dca5c2622eb5ffaa7de161c4d6d8f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302643
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-16 16:17:28 +00:00
Robert Phillips
07531a0f97 Switch the DDLRecorder over to holding a GrRecordingContext ...
and related changes. This is another CL in the series that is replacing
GrContext with the GrDirectContext/GrRecordingContext pair.

Change-Id: Id0a3cfd5a5f92f7680d9c58f3a1753322311221c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302637
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-15 23:17:03 +00:00
Ben Wagner
c0693db3f5 Remove SkFontArguments::Axis.
Replaced with SkFontArguments::VariationPosition and
SkFontArguments::VariationPosition::Coordinate since the arguments are
about a variation specification and it's coordinates.
SkFontParameters::Axis actually deals with axes and their properties.

Change-Id: I377c9c5efa8e7b7e2649fc038f765062e30391e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302905
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-15 20:59:22 +00:00
Mike Klein
4d680cdf07 a bunch of half-related stuff
- add f32<->f16 functions to skvx
  - add f32<->f16 x86 instructions to skvm::Assembler
  - add f32<->f16 ops to skvm,
    using the skvx functions in the interpreter

Still TODO:
    use the new x86 instructions in the JIT

(For now like in many other ways, the aarch64 JIT
continues to languish.  Will pick that back up one day.)

Change-Id: Ib8dc1ccdc75ecb23769ea4947d66d3ab22520f23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302942
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2020-07-15 20:47:31 +00:00
Elliot Evans
72b8aea019 Fix experimental_simd CanvasKit build.
Although it appeared that the experimental_simd CanvasKit build was
working, the build was not producing actual wasm SIMD operations. This
CL fixes that issue by changing the build arguments.

This issue also fixes an incorrect type issue with the SkVx wasm SIMD
implementation.

Bug: skia:10453
Change-Id: If26f84b09e4d84df36be589245878c821972dffc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302669
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-15 20:39:42 +00:00
Adlai Holler
3a22017402 Reland "Add a direct context arg to makeColorTypeAndColorSpace"
This reverts commit 779813a239.

Reason for revert: Avoid null dereference in DDL test case

Original change's description:
> Revert "Add a direct context arg to makeColorTypeAndColorSpace"
>
> This reverts commit a56da9ee92.
>
> Reason for revert: UBSAN complains in Vulkan OOPRDDL mode
>
> Original change's description:
> > Add a direct context arg to makeColorTypeAndColorSpace
> >
> > This is part of a larger effort to de-power SkImage and force users to
> > specify the GPU context for all new images.
> >
> > Staging flag landed in Chrome CL 2296632.
> >
> > Bug: skia:10466
> > Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> > Commit-Queue: Adlai Holler <adlai@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,adlai@google.com
>
> Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10466
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
> Reviewed-by: Adlai Holler <adlai@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

Bug: skia:10466
Change-Id: I59de0bd2b33989b1af08e8af2f8a52542b6b5db0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302829
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-15 17:21:44 +00:00
Mike Reed
13711ebe68 rename SkMipMap to SkMipmap
Change-Id: I1fa8a0482a717847236a30b4851061f4074b7755
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302644
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-15 13:26:13 +00:00
Adlai Holler
779813a239 Revert "Add a direct context arg to makeColorTypeAndColorSpace"
This reverts commit a56da9ee92.

Reason for revert: UBSAN complains in Vulkan OOPRDDL mode

Original change's description:
> Add a direct context arg to makeColorTypeAndColorSpace
> 
> This is part of a larger effort to de-power SkImage and force users to
> specify the GPU context for all new images.
> 
> Staging flag landed in Chrome CL 2296632.
> 
> Bug: skia:10466
> Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
> Commit-Queue: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>

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

Change-Id: Ide36bed6966d3d92ad6b8d05f897d22d287b40b1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10466
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302824
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-07-15 13:02:55 +00:00
Adlai Holler
a56da9ee92 Add a direct context arg to makeColorTypeAndColorSpace
This is part of a larger effort to de-power SkImage and force users to
specify the GPU context for all new images.

Staging flag landed in Chrome CL 2296632.

Bug: skia:10466
Change-Id: I6b7bbec10369f7d8ee884dd1bcc234d332c30a6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302290
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-14 22:36:49 +00:00
Herb Derby
b2db9797c5 subclass GrPathSubRun from GrSubRun
Move PathGlyph to GrPathSubRun, and make the array for the path
data directly in the alloc instead of in a vector.

Change-Id: I861cb934e356f526f96e593d25019b00451f77b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302640
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-14 20:49:07 +00:00
Herb Derby
252a3c0e11 make GrAtlasSubRun a subclass of GrSubRun
Add API for GrSubRun.

Make sure the API presented by GrSubRun works. Use the original
implementation as the first subclass. It's named SkAtlasSubRun for now
even though it handles both path and atlas drawing. The next subclass
will be pulling out paths.

Change-Id: Id9b2feaa2c9ad9214736ff4a9f577d1de4d4212d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302582
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-14 19:33:17 +00:00
Robert Phillips
c7228c604e Set up to use new GrDirectContext factories in Chrome
Here is the Chrome-side CL waiting on this CL:
https://chromium-review.googlesource.com/c/chromium/src/+/2297920 Use new GrDirectContext factories instead of deprecated GrContext ones)

Change-Id: Ic607c8f4d3b87b38b5a56a2c44012b7402e074dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302583
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-14 18:56:17 +00:00
Herb Derby
3d00a97bce extract and rename SubRun to GrSubRun
TBR=reed@google.com

Change-Id: I8be10fc421ab34de2d2307093f8eee0537d234ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302578
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-14 18:32:27 +00:00
John Stiles
955adbe02c Replace various one-liner sorting functor adapters with lambdas.
These tiny adapter classes aren't needed, since all of our clients have
support for lambdas.

Change-Id: Ibf22b1fd0adb3707db570432c50720df9c9329e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302581
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-14 17:45:26 +00:00
Ben Wagner
9d5c55cedf Move makeFontData to SkTypeface_FreeType.
SkTypeface_FreeType uses SkFontData and makeFontData as a way to lazily
create FT_Face objects. Other SkTypeface types do not need this, so
remove it.

Change-Id: I2f2f829deac9f7f6aac06f9ce84f856922d8a861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299443
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-14 17:00:23 +00:00
Mike Reed
2fe1569298 Create mipmaps when creating images
Follow-on CLs:
- add serialization for mips to pictures
- implement for other image types (e.g. lazy(?), gpu)
- improve generated mip quality

Bug: skia:10411
Change-Id: Id874f170e9cb8ae4405dc4f6249e1ea6274f20aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297739
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-14 16:02:26 +00:00
Greg Daniel
ceebe424b1 Revert "Add GrContext api to update compressed backend textures."
This reverts commit 2c180304dc.

Reason for revert: attempted workaround did not fix techno spark so needs further investigation

Original change's description:
> Add GrContext api to update compressed backend textures.
> 
> Bug: chromium:1099255
> Change-Id: I0c3f25ddb037e47e3b910fa89c3d8b3aa27b3114
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302265
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: Ib5433def02dc5dad97dcdbd4476ced6de2361e6a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1099255
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302576
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-14 15:05:58 +00:00
Greg Daniel
43833b028a Add GrContextOption to limit the number of cached secondary command buffers.
Bug: skia:10438
Change-Id: I3116fc1c7ee75f9b7a712c05199a9ed4a0d419c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302291
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Emircan Uysaler <emircan@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-14 13:51:26 +00:00
Robert Phillips
f4f8011aef Add Context factories to GrDirectContext
In order to stage the transition from GrContext to GrDirectContext, both
of them will have to have the factories for a while.

This CL also removes all internal uses of the old (GrContext) factories.

Change-Id: Ibe1edd0818ea23a0d54257c55f35f12526047ef3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302263
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-14 12:40:46 +00:00
Chris Dalton
5bdbdf44a9 Update glMultiDraw... to use GLuint* for baseInstances
There seems to be some inconsistency across specs, but GLuint* is the
correct type to use for this array.

TBR=bsalomon@google.com

Bug: skia:10419
Change-Id: I4106b98278850e30e748746159ea4efc05688c0c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302433
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-07-13 22:13:30 +00:00
Greg Daniel
2c180304dc Add GrContext api to update compressed backend textures.
Bug: chromium:1099255
Change-Id: I0c3f25ddb037e47e3b910fa89c3d8b3aa27b3114
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302265
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-07-13 20:42:38 +00:00
Robert Phillips
1a57857fb6 Retract GrContext.h from headers
GrContext is going away. These #includes have been letting it slip in
where it shouldn't.

Change-Id: Idbf24aeba4454d272ad3ebc8ea0d75ae4d9e6e10
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301978
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-13 20:03:58 +00:00
Mike Reed
2955973dca remove helper now that g3 is updated
Change-Id: If14455faac4554729dfc16bb1d5299f2458a2d2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302260
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-13 19:46:28 +00:00
Adlai Holler
74470aec51 Make GrAsDirectContext public
As soon as I started migrating Chrome, this function showed its
public usefulness. It'll keep coming up over and over again.

Change-Id: Ic6fd08af9b64a4c3287e7fedc9cd0e29bbaf837d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302259
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>
2020-07-13 15:30:00 +00:00
Mike Klein
5cb47d6a88 refactor skvx::if_then_else()
First move if_then_else() specializations inline using a
quasi-constexpr-if approach, letting them operate on any types of the
right vector and lane size.  We can't use constexpr-if per se because
this header is sometimes used in C++14 contexts.

Then, add AVX specialization for 8x32-bit types.

SkVM's interpreter uses if_then_else() on three i32x16, and these
changes allow that to vectorize ideally, as two vblendvps instructions.

Change-Id: I8355c47975c736c1fbc32b1f8ceddb772978d271
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302080
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-13 15:02:07 +00:00
Adlai Holler
872a32c58d Add an arg to SkImage::makeSubset to take a direct context
This is part of a larger effort to force users to provide a context
when manipulating GPU images which may be shared, instead of having
images themselves retain powerful context pointers.

Chrome flag landed in Chrome CL 2292800

Bug: skia:10466
Change-Id: Ic530a2c5eb1f4399db899d243ea944760fdf2055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300707
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-13 14:55:47 +00:00
Mike Reed
609ea210e2 more cleanup after removing volatile from bitmap
Change-Id: I3d7b2f59a5657640c3d60f5a2f6e1277d7593096
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302038
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-12 19:37:29 +00:00
Mike Reed
1434ce1aa9 Can we remove volatile from skbitmap?
Change-Id: I0faa324b91f2c291be56f5126361ffe7fd54eb65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/302037
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-12 17:48:59 +00:00
Robert Phillips
4a3ebc2d22 Switch SkImage's & SkImageGenerator's isValid call over to GrRecordingContext
This is another step towards replacing GrContext with the
GrDirectContext/GrRecordingContext pair.

Change-Id: I9336799a299e181fd56759f37dfed3da5da5d022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301856
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-10 18:08:13 +00:00
Chris Dalton
b490eb2c51 Add ANGLE's glMultiDraw*BaseInstance functions to the GL interface
This is how we will implement indirect draws in ANGLE and WebGL.
Emscripten will expose WEBGL_multi_draw through this extension.

Bug: skia:10419
Change-Id: I3fc56b130b06cdcc05a25be69878b398b8820f50
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301736
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-07-10 16:39:53 +00:00
Mike Reed
f8a6b5b4b0 Impl SkFilterOptions for raster-images
Maintains the old and new code-paths:
- if the shader was made with explicit filteroptions, use those
- if not, infer the filteroptions from the filterquality enum
  (and the legacy heuristics of sniffing/snapping the ctm)

In either case, the bulk of the onProgram() is shared, driving off
the (possibly computed locally) filteroptions.

bench looks sort like we expect:

    509.28  	filteroptions_sampling_0_mipmap_0	8888
    495.76  	filteroptions_sampling_0_mipmap_1	8888
    642.52  	filteroptions_sampling_0_mipmap_2	8888

    942.40  	filteroptions_sampling_1_mipmap_0	8888
    976.94  	filteroptions_sampling_1_mipmap_1	8888
   1686.34  	filteroptions_sampling_1_mipmap_2	8888

Bug: skia:10344
Change-Id: I77a79f79f640986fdd6b14f163c1a03462c55dc0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297561
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-10 13:08:33 +00:00
Ben Wagner
fcfd0af9fd Notify when SkFontMetrics bounds are bogus.
OpenType and many other font formats have the concept of pre-computed
metrics for the union of all glyph bounding boxes. This allows for fast
though course quick rejecting of bounds, since the glyphs themselves may
potentially be quite a bit larger than the EM. With the introduction of
variable fonts OpenType does not vary these bounds, so the bounds are
only valid for the default non-varied font.

As a result the fTop, fBottom, fXMax, and fXMin reported in
SkFontMetrics may be bogus. Since simply always setting them to empty
zeros may be disruptive, provide a way forward for new users to check if
the bounds are valid.

This exposed an issue where SkTextBlobBuilder::TightRunBounds does not
handle SkTextBlob::kRSXform_Positioning, so add a test for that.

Change-Id: I872729e0f16e2a196229f9902addf4b07b461590
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301455
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-09 19:26:40 +00:00
Robert Phillips
dadc0819e9 Add missing recordingContext override to SkPaintFilterCanvas
This should fix the gpu-specific slides in Viewer.

Change-Id: I3ff069005bfe3639eb9608223b13c64f4c28c396
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301441
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-09 13:35:52 +00:00
Robert Phillips
16bf7d31c8 Make SkGpuDevice hold a GrRecordingContext (take 2)
This makes the code reflect what is actually going on. During DDL
recording the SkGpuDevice only holds a recording context.

This can't land until the following Chrome-side CL lands:

https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Change-Id: I6ef3896f5a270a4fa7af37f9121f68a66653cce2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300896
2020-07-09 12:28:22 +00:00
Greg Daniel
414418d55f Add option for client to own semaphores after telling to skia to wait.
Bug: chromium:1004772
Change-Id: Ifdad0b12925d13d3e896f6321c35312f9daa330c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301216
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-07-08 16:34:07 +00:00
Robert Phillips
2a4acf328c Remove all internal uses of (and deprecate) SkSurface::getContext
We are replacing GrContext with the GrDirectContext/GrRecordingContext
pair. This starts making that change visible to clients (and weaning
Skia off of GrContext).

Change-Id: I00cc9bf208499984de855a1646229bd7557fc925
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300706
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-08 16:09:27 +00:00
Ben Wagner
b37072556a Mark SkGetThreadID SK_SPI in debug.
Bug: skia:10381
Change-Id: I92feb4a668738d7f9375a6f204c663f1eb1b3a9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301009
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-07-07 21:50:55 +00:00
Adlai Holler
e3ad527e3f Add a convenience to downcast contexts into GrDirectContext
This pattern of needing a safe downcast will continue to grow as we
add more explicit use of GrDirectContext and it's causing long ternary
operations that span multiple lines.

Change-Id: I9e2ebe5156e4245524a52d7c92ed3a8509e53151
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300901
Commit-Queue: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-07-07 18:13:50 +00:00
Chris Dalton
05da783f87 Revert "Make SkGpuDevice hold a GrRecordingContext"
This reverts commit c8b721b086.

Reason for revert: Looks like it's causing build failures around
MakeRenderTargetContext on the roll.

Original change's description:
> Make SkGpuDevice hold a GrRecordingContext
> 
> This makes the code reflect what is actually going on. During DDL
> recording the SkGpuDevice only holds a recording context.
> 
> This can't land until the following Chrome-side CL lands:
> 
> https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)
> 
> Change-Id: I69cfa744226c315c25f68fc509b7b59ec38bbf31
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Adlai Holler <adlai@google.com>

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

Change-Id: I6a362daf7c40e36ed9f068c5b2d477c16a3f778e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300853
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-07-07 07:23:55 +00:00
Robert Phillips
c8b721b086 Make SkGpuDevice hold a GrRecordingContext
This makes the code reflect what is actually going on. During DDL
recording the SkGpuDevice only holds a recording context.

This can't land until the following Chrome-side CL lands:

https://chromium-review.googlesource.com/c/chromium/src/+/2277964 (Add GrContext.h include to skia renderer for upcoming Skia roll)

Change-Id: I69cfa744226c315c25f68fc509b7b59ec38bbf31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299867
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-07-07 01:35:30 +00:00
Florin Malita
8155976877 [skottie] Add line-spacing animator support
AE allows animating the line spacing text property [1].

Observed semantics:

  - spacing is applied as an offset to all fragments in a line
  - for selector/partial coverage, the spacing for a given line
    is the average of the computed spacing for each fragment
  - spacing is cumulative (applies to all lines following)

Plumb the new animator prop ("ls") and expand the existing line
tracking logic to also apply computed spacing offsets.

(also requires a Bodymovin update to export the line spacing property)

[1] https://helpx.adobe.com/after-effects/using/animating-text.html#text_animator_properties

Change-Id: I5517acea8dbc1b2fbae09cb0874f1e53cd2acb90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300377
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-07-06 15:41:12 +00:00
Herb Derby
bc4d13ad2f move GrTextBlobCache to GrContextThreadSafeProxy
ninja -C out/Release -j 800 skpbench && ./out/Release/skpbench \
--config gl --ddl --src skps/desk_nytimes.skp \
--ddlTilingWidthHeight 3 --gpuThreads 0 \
--pr ~small ~nvpr --cachePathMasks false --comparableDDL
Reports:
with out cl:
1.949     1.842     3.979     1.802      29%       99         50  cpu    ms      gl        desk_nytimes.skp

this cl:
1.476     1.388     3.342     1.365    34.2%       99         50  cpu    ms      gl        desk_nytimes.skp

Non-ddl perf:
./out/Release/skpbench --config gl --ddl --src skps/desk_nytimes.skp \
--ddlTilingWidthHeight 3 --gpuThreads 0 --pr ~small ~nvpr \
--cachePathMasks false --comparableSKP

 1.368      1.31     2.276     1.273    15.3%       99         50  cpu    ms      gl        desk_nytimes.skp

Change-Id: I879f779e34b5c717ab5602f23374aedaff56f96b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299197
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-07-06 15:16:22 +00:00
Stephan Hartmann
c1893f3f93 GCC: fix unknown attribute warnings for no_sanitize
Clang and GCC use different syntax to add no_sanitize
attribute on functions. This results in a large amount
of warnings for GCC, because responsible header is included
very often. Use SK_ATTRIBUTE to specify no_sanitize
attribute.

Change-Id: I589a851493788283c13fe4c7fb99eaa7ad753487
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300556
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-07-06 13:52:22 +00:00
Mike Reed
92c33f329a document Make for paths, and move from pathbuilder into path
Change-Id: I812b5315e06e38ec2c812c76634fe07227a30b39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300356
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-07-02 13:48:09 +00:00
Robert Phillips
b7bfbc299a Move GrRecordingContext.h and GrDirectContext.h into include/gpu
External clients will need access to these classes once GrContext
goes away.

This is a purely mechanical CL.

Bug: skia:10441
Change-Id: I7ffeb29d88bcc0f012412fba911e8362d046e24a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300206
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-01 17:32:14 +00:00
Brian Osman
1298bc46ac Change SampleMatrix to SampleUsage
It now tracks all sample calls of a child (matrix, explicit coords,
pass through). There is now just one registerChild() call, and the
sampling pattern of that child is fully determined by the SampleUsage
parameter.

Change-Id: Iaadcd325fca64a59f24192aadd06923c66362181
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299875
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-07-01 16:37:43 +00:00
Robert Phillips
f8f45d91b2 Make asDirectContext public
External clients will eventually have to call this to get access
to a direct context from an SkCanvas or SkSurface (which will
only have 'recordingContext' accessors).

Bug: skia:10441
Change-Id: I10e34081277b685fa59d03e1fce1887f3524e0fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300178
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-07-01 16:30:03 +00:00
John Stiles
d2f870c911 Fix modifier key handling in OS X to allow command-keys to work.
A variety of modifier key handling issues are addressed in this CL:
- Added a skui::Key for the Super key (this is ImGui's name for command)
- Added OS X event handling for `flagsChanged` (sent when modifier keys
  are pressed)
- OS X manually tracks modifier key state and sends key-up and key-down
  events to the ImGuiLayer as necessary
- OS X does not send key-up events when hotkeys are pressed, so these
  are manually synthesized and sent to ImGui (otherwise hotkeys are
  repeated forever)
- Replaced hardcoded Virtual Key valus in OS X code with named constants
- Our custom bitmask type was lacking the ability to XOR

This CL does NOT enable the OS X clipboard; this uses the ImGui internal
clipboard.

Change-Id: I76b55215858bfb6441dbef18ad638426fa8bc073
Bug: skia:10338
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/300182
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-07-01 16:07:03 +00:00
Elliot Evans
fe7e74b3a7 Add an experimental_simd build target to CanvasKit.
The `experimental_simd` build target builds
CanvasKit using the Emscripten `-msimd128` flag, to build CanvasKit
with SIMD instructions in the compiled WASM. This build of
CanvasKit works in Chrome Canary 86.0.4186.0
with chrome://flags#enable-webassembly-simd enabled.

Also add WebAssembly-specific intrinsics to SkVx.h to enable
support for almost all native SIMD operations in CanvasKit WebAssmebly.

Also add a Skia/modules/canvaskit/wasm_tools/SIMD folder which contains
build_simd_test.sh for testing whether WASM SIMD intrinsics operations
are actually being used by skvx, and for testing correctness of
WASM SIMD operations. Also contains simd_float_test.cpp and
simd_int_test.cpp which serve as documentation for which operations are
correctly turned into WASM SIMD operations by emscripten.

Bug: skia:10453
Change-Id: Icd312b4d189e8d8667d3ffe12a72bfa6febaab2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299705
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-30 22:52:31 +00:00
Robert Phillips
9eb0002b47 Double down on abandoned being publicly accessible on contexts
abandoned() is publicly accessible on GrContext. Since
GrRecordingContext is taking its place in many locations, make its
abandoned() call also publicly accessible.

This CL also removes abandoned() from GrContextPriv since it is
publicly accessible.

Change-Id: I72bdae369d06e34ec3f99a18a0feb72e2ae67666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299876
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-30 20:01:51 +00:00
Greg Daniel
ce9f016ed3 Remove unused GrFlushFlags.
This also adds back default flush() calls which simply do a flush
without any submit.

Change-Id: Ia8c92bbdecd515d871abfa6364592f502e98656b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298818
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-06-30 19:39:31 +00:00
Greg Daniel
746460e25a Fix d3d backend texture uploads when used formats need swizzling.
This does a few things. First when we are trying to upload a color via
our updateBackendTexture API we use GrClearImage to fill out a cpu buffer
with that data. But we need to know how to swizzle this cpu data so that
it falls into the correct channels when we copy it to the GPU texture.
This requires adding a couple more color types to handle some of the odd
4444 cases which are swizzled differently and what seems every backend.
We then can get the correct swizzle for the GrClearImage call.

This change also fixes the DXGI_FORMAT_B4G4R4A4_UNORM read and write swizzles.

In follow on change I will update other APIs which use GrClearImage to make
sure they are using the correct GrColorType to represent their internal
formats memory layout.

Change-Id: I92d1d7728dc6e317553e04c1ecfcd872f95a5f99
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299865
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-30 18:56:57 +00:00
Robert Phillips
44333c58f6 Make asDirectContext return a GrDirectContext
Change-Id: I373658d68582adc9728f3a75d84178a365f5b798
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299877
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Adlai Holler <adlai@google.com>
2020-06-30 18:48:17 +00:00
Robert Phillips
ad2484520d Make the GrDirectContext a thing and move it to include/private
This is somewhat of a departure from the original context refactoring
plan (i.e., keep GrLegacyDirectContext hidden and switch GrContext over
to be the GrDirectContext at some point). Having a GrDirectContext
earlier will allow us to change some important signatures earlier
(e.g., asDirectContext) and, hopefully, clarify some of the confusion
about the context class hierarchy.

Additionally, this will let us make onGpuSetup take a direct context -
clarifying its purpose vis a vis onDraw (which now takes a recording
context).

Change-Id: I8298a0649bc95843d20bee33ba7fe1d7e73bb839
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299768
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-30 14:57:24 +00:00
Michael Ludwig
8f3a83671a Write SkSL visitor pattern and consolidate sampling analysis
Besides moving the existing coord-overrides and sample matrix merging
logic on to a shared visitor pattern, this updates the sample coord
reference detection to actually look for references to that built-in.

Previously, we only had this behavior in the CPP code generator. The
.h generator just did a string search for sk_TransformedCoords2D, and
runtime effects just looked at the main signature. Now, the .h generator
is more robust, and runtime effects that declare the main coords parameter
but never use it will not be marked as using the sample coords directly.

Change-Id: I802d610dbda512cf3823c58f349307b3926aa58f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299458
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-30 14:04:23 +00:00
Heather Miller
22c6aa126d Update Skia milestone to 86
Change-Id: Id81c58007f74816a8c2ac0831d61c041c5a7468c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298916
Reviewed-by: Heather Miller <hcm@google.com>
2020-06-29 21:18:16 +00:00
Adlai Holler
f19bbb52b2 Finish the DDL sk_sp migration
This will not be landed until chrome CL 2269958 lands.

Bug: skia:10425
Change-Id: I2a5081201ca3faed5232e8540086bd4c6f865767
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299292
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-29 16:49:54 +00:00
Ben Wagner
d71cf40301 Remove SkFontMgr::matchFaceStyle.
This belongs on a SkTypeface which might have a back pointer to a font
collection in which it can do lookup. It makes little sense to pass a
random typeface into a potentially incompatible SkFontMgr. Some of the
existing implementations will crash if this happens.

This initial commit is 'conservative' in that it removes the public API,
the backing onMatchFaceStyle is left intact to avoid breaking
implementors (as opposed to users). It may also be used as an
implementation detail in a future SkTypeface API when the typeface holds
a reference on its collection.

It appears there are no users of this API and it is also untested.

Change-Id: I6e06f918ad73a500c254746b3957c3579fab3b9c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299198
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-28 01:43:04 +00:00
Ben Wagner
3d00fc9924 Make SkFontMgr::onMakeFromStreamArgs pure virtual.
Ensure that it always exists and that implementers don't forget about it
and wind up with an incorrect default.

Change-Id: I383cb1eb8e15de49fbbb007d719837804aca33af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299456
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-28 01:16:34 +00:00
Robert Phillips
f123f06aab Expose GrRecordingContext accessor on SkCanvas and SkSurface
We'll need this if we're ever to get rid of GrContext.

It is pulled out of:

https://skia-review.googlesource.com/c/skia/+/296704 (Downgrade GpuGMs to only receiving a GrRecordingContext)

Bug: skia:10441
Change-Id: I964b5caf3e947afbfc7d441a8e17ad298961d8f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299295
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-26 19:35:30 +00:00
Brian Salomon
63a0a758ce Reland "Add async rescale and read APIs to SkImage."
This reverts commit 1caf3789f8.

Makes the image GMs detect an abandoned context just like the surface
GMs.

Bug: skia:10431
Change-Id: I56a3631a75e6b0383f96a73f461cfa314ee29afa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299379
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-26 18:17:21 +00:00
Brian Salomon
1caf3789f8 Revert "Add async rescale and read APIs to SkImage."
This reverts commit 7ac9b5fdb6.

Reason for revert: abandon context bots breaking

Original change's description:
> Add async rescale and read APIs to SkImage.
> 
> These function the same as the already existing
> SkSurface APIs.
> 
> Bug: skia:10431
> 
> Change-Id: I4f1e842d8d4b72ee27bae5f8a85e499e130d420c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299281
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=egdaniel@google.com,bsalomon@google.com,brianosman@google.com

Change-Id: I351795274245fc9f553cd210d82178f497f22660
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10431
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299376
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-26 17:13:22 +00:00
Brian Osman
be1b837505 Support sample(matrix) with runtime effects
Added sksl_sample_chaining, which draws identically to
fp_sample_chaining, but uses runtime effects that implement each
strategy.

Change-Id: Ib54fbe4fc6d98b4a8e91cf0e3ae6b7e19283ad37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299076
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2020-06-26 16:27:50 +00:00
Brian Salomon
7ac9b5fdb6 Add async rescale and read APIs to SkImage.
These function the same as the already existing
SkSurface APIs.

Bug: skia:10431

Change-Id: I4f1e842d8d4b72ee27bae5f8a85e499e130d420c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299281
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-26 15:25:10 +00:00
Adlai Holler
96ead54a69 Reland "Consolidate GrDrawingManager <-> GrRenderTask lifecycle"
This reverts commit 65888b81cf.

Reason for revert: Fixed underlying issue http://crbug.com/1097620

Original change's description:
> Revert "Consolidate GrDrawingManager <-> GrRenderTask lifecycle"
>
> This reverts commit 6f1487fe80.
>
> Reason for revert: http://crbug.com/1097620
>
> Original change's description:
> > Consolidate GrDrawingManager <-> GrRenderTask lifecycle
> >
> > This creates a funnel in the drawing manager (removeRenderTasks) that
> > opens the door for tighter integration between the two classes. Also we
> > add some assertions about the relationship and cut out duplicated code.
> >
> > Bug: skia:10372
> > Change-Id: I0781ba7d45ac090cf7f6d430f0d56afe0f98b7e0
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297195
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
> > Commit-Queue: Adlai Holler <adlai@google.com>
>
> TBR=robertphillips@google.com,adlai@google.com
>
> Change-Id: I5d34ada1838d206d8a33294427d459c36ad6b740
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10372
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298137
> Auto-Submit: Adlai Holler <adlai@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

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

Bug: skia:10372
Change-Id: I9c83d4b2dc10b9db576d506b461b596b94afbc8d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298339
Reviewed-by: Adlai Holler <adlai@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-06-26 14:09:05 +00:00
Greg Daniel
c72d7a58a3 Add default flush calls to gpu backend.
Change-Id: I7cd8ff975502128dbde86397218b7e5c115cdaa6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299141
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-26 01:45:55 +00:00
Michael Ludwig
c19b9c5886 androidFramework_replaceClip proposal
Expose a android framework-only function to reset the saved clip geometry
a device-space pixel rect (e.g. the device clip restriction). Using a
regular intersect clip operation after this call should match the
behavior of the legacy replace operation with a clip restriction.

This is a step to removing the separate device clip
restriction API and the deprecated expanding clip ops, as part of the
plan described here: https://docs.google.com/document/d/1ddIk74A1rL5Kj5kGcnInOYKVAXs3J2IsSgU5BLit0Ng/edit?usp=sharing

Bug: skia:10207
Bug: skia:10209

Change-Id: I57d3bcc7b5b257935eb2bf2099d472f2ef354d5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298824
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-06-25 21:54:11 +00:00
Jim Van Verth
c1a67b5b15 Implement Direct3D semaphores
Change-Id: Iadfa14965bbe11cfea556ade5d46e264f0ace61a
Bug: skia:9935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298752
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-06-25 20:07:21 +00:00
Brian Osman
061a5cf82a Move SkSLSampleMatrix to include/private
Switch it to use std::string (not SkSL::String). Along these lines,
remove SkSL::String's operator SkString, and instead add an explicit
SkString constructor from std::string.

Other changes aren't strictly necessary, but I wanted to clean up some
of the other SkSL vs. Skia code barriers. VS (since 2015) has had
vsnprintf that conforms to the C99 standard, the only difference with
_vsnprintf is a different (nonstandard) return value for overflowing
calls. Remove the special-case (the only use of SKSL_BUILD_FOR_WIN).

Change-Id: I8826af10c8e78a8d935c601d00b8ae9ba0640041
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298816
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-25 15:53:33 +00:00
Michael Ludwig
e88320baec Update how sample(matrix) calls are invoked in SkSL
This removes the kMixed type of SkSL::SampleMatrix. All analysis of FP
sampling due to parent-child relationships is tracked in flags on
GrFragmentProcessor now.

The sample strategy is tracked as follows:
- An FP marks itself as using the local coordinate builtin directly (automatically done for .fp code based on reference to sk_TransformedCoords2D[0]).
- This state propagates up the parent towards the root, marking FPs as using coordinates indirectly. We stop the propagation when we hit a parent FP that explicitly samples the child because it becomes the source of the child's coordinates.
   - If that parent references its local coordinates directly, that kicks off its own upwards propagation.
- Being sampled explicitly propagates down to all children, and effectively disables vertex-shader evaluation of transforms.
   - A variable matrix automatically marks this flag as well, since it's essentially a shortcut to (matrix expression) * coords.
- The matrix type also propagates down, but right now that's only for whether or not there's perspective.
   - This doesn't affect FS coord evaluation since each FP applies its action independently.
   - But for VS-promoted transforms, the child's varying may inherit perspective (or other more general matrix types) from the parent and switch from a float2 to a float3.
- A SampleMatrix no longer tracks a base or owner, GrFragmentProcessor exposes its parent FP. An FP's sample matrix is always owned by its immediate parent.
   - This means that you can have a hierarchy from root to leaf like: [uniform, none, none, uses local coords], and that leaf will have a SampleMatrix of kNone type. However, because of parent tracking, the coordinate generation can walk up to the root and detect the proper transform expression it needs to produce, and automatically de-duplicate across children.

Currently, all FP's that are explicitly sampled have a signature of (color, float2 coord). FP's that don't use local coords, or whose coords are promoted to a varying have a signature of (color).
   - In this case, the shader builder either updates args.fLocalCoords to point to the varying directly, or adds a float2 local to the function body that includes the perspective divide.

GrFragmentProcessor automatically pretends it has an identity coord transform if the FP is marked as referencing the local coord builtin. This allows these FPs to still be processed as part of GrGLSLGeometryProcessor::collectTransforms, but removes the need for FP implementations to declare an identity GrCoordTransform.
   - To test this theory, GrTextureEffect and GrSkSLFP no longer have coord transforms explicitly.
   - Later CLs can trivially remove them from a lot of the other effects.
   - The coord generation should not change because it detects in both cases that the coord transform matrices were identity.

GrGLSLGeometryProcessor's collectTransforms and emitTransformCode has been completely overhauled to recurse up an FP's parent pointers and collect the expressions that affect the result. It de-duplicates expressions between siblings, and is able to produce a single varying for the base local coord (either when there are no intervening transforms, or the root FP needs an explicit coordinate to start off with).


This also adds the fp_sample_chaining GM from Brian, with a few more configurations to fill out the cells.

Bug: skia:10396
Change-Id: I86acc0c34c9f29d6371b34370bee9a18c2acf1c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297868
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-25 14:48:34 +00:00
Adlai Holler
7580ad47b7 Add an sk_sp API for DDLs with a macro for staging
Chromium CL 2261229 adds the temporary opt-out.

Bug: skia:10425
Change-Id: I54f32f9389b31f8f83124ab1ea3f16f58cf248e8
Depends-On: Ie090d0cdcc4f6aeee1a845cecf699f4e2f7bd617
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298509
Commit-Queue: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-25 13:13:58 +00:00
Mike Reed
b11e627644 Move impl into SkColorFilterBase
No expected changes to results (or public call-sites)

Change-Id: Ia0c5cfe2dc3beda82d91454527eda2e68287afb6
Bug: skia:10426
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298559
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-06-25 00:26:11 +00:00
Brian Salomon
24069ebd23 Add GrContext::oomed() and implement for GL and VK.
Surfaces to client whether GrContext has seen a GL_OUT_MEMORY,
VK_ERROR_OUT_OF_HOST_MEMORY, or VK_ERROR_OUT_OF_DEVICE_MEMORY error.

Bug: chromium:1093997
Change-Id: I8e9799a0f7d8a74df056629d7d1d07c0d0a0fe30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298216
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-24 16:04:06 +00:00
John Stiles
72e576492c Rename MakeResult so that it can be used more broadly.
MakeResult will be needed when migrating `asFragmentProcessor` calls.
However, the typename previously could not be forward-declared because
it was a type buried inside a class. Also, the name `MakeResult` seems
too tightly-coupled to the `Make` functions.

The type has been renamed to `GrFPResult` and moved out of
GrFragmentProcessor to allow `asFragmentProcessor` to use it without
actually #including GrFragmentProcessor.

Change-Id: Ic2c701b943aa64e0f922827b60084e58c67bfb8d
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298740
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-24 15:23:23 +00:00
Mike Reed
22f246f5ad add simple pathbuilder
88.26 ?	makepath_arrays_reserve	nonrendering
    235.97  	makepath_detach_reserve	nonrendering
    274.56  	makepath_snapshot_reserve	nonrendering
    537.61  	makepath_path_reserve	nonrendering
    472.98  	makepath_detach_noreserve	nonrendering
    482.56  	makepath_snapshot_noreserve	nonrendering
    750.83 ?	makepath_path_noreserve	nonrendering

Bug: skia:9000
Change-Id: I346537e899b08946c5778042a021f464006b029c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209403
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2020-06-24 01:50:30 +00:00
Greg Daniel
d79197dfb1 Add api to GrVkMemoryAllocator to return VkResult from allocate calls.
Change-Id: I344e5d70126cce210bb9fe442ae040d13ab74c2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298218
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Peng Huang <penghuang@google.com>
2020-06-23 15:27:53 +00:00
Dominic Mazzoni
2eb3c17ba3 Add appendNodeIdArray to avoid code duplication.
Add SkPDF::AttributeList::appendNodeIdArray so that clients
don't need to re-implement/duplicate NodeIdToString in order to
add attributes that express the relationship between nodes.

Follow-up to:
https://chromium-review.googlesource.com/c/chromium/src/+/2251058

This deletes appendNameArray and appendStringArray since there's
no immediate need for them, but we may add them back if needed.

Bug: chromium:607777
Change-Id: If9b1527f97c7b52bb1bdad3c0828067bb76f25f2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297277
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-23 14:25:33 +00:00
John Stiles
b444943db2 Update SkString::resize to preserve string contents efficiently.
Without this change, the following unit test failures would occur:

StringTest.cpp:425     [String_resize_grow]
StringTest.cpp:435     [String_resize_after_assignment]
StringTest.cpp:438     [String_resize_after_assignment]
StringTest.cpp:444     [String_resize_after_copy_construction]
StringTest.cpp:446     [String_resize_after_copy_construction]

Change-Id: Ib4f63d51604e55d32f1049136b733ee905b72039
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298217
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-06-22 23:08:55 +00:00
Adlai Holler
65888b81cf Revert "Consolidate GrDrawingManager <-> GrRenderTask lifecycle"
This reverts commit 6f1487fe80.

Reason for revert: http://crbug.com/1097620

Original change's description:
> Consolidate GrDrawingManager <-> GrRenderTask lifecycle
>
> This creates a funnel in the drawing manager (removeRenderTasks) that
> opens the door for tighter integration between the two classes. Also we
> add some assertions about the relationship and cut out duplicated code.
>
> Bug: skia:10372
> Change-Id: I0781ba7d45ac090cf7f6d430f0d56afe0f98b7e0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297195
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Adlai Holler <adlai@google.com>

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

Change-Id: I5d34ada1838d206d8a33294427d459c36ad6b740
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10372
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298137
Auto-Submit: Adlai Holler <adlai@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-22 18:08:50 +00:00
John Stiles
33e044fb16 Prevent non-trivial destructors from running after exit in DM.
Previously, DM destroyed a large number of non-trivial objects at
shutdown time. Because no shutdown order is promised across translation
units by the standard, this can lead to bugs which only reproduce
capriciously, at the whim of the linker.

http://go/totw/110#the-fix-safe-initialization-no-destruction

"Destruction issues are usually solved by defining your static data
in such a way that the destructor never runs. The most common way to do
this is to heap allocate the static object - pointers don't have
destructors."

http://go/cstyle#decision_on_destruction

"Global and static variables that use dynamic initialization or have
non-trivial destructors create complexity that can easily lead to hard-
to-find bugs. Dynamic initialization is not ordered across translation
units, and neither is destruction (except that destruction happens in
reverse order of initialization). When one initialization refers to
another variable with static storage duration, it is possible that this
causes an object to be accessed before its lifetime has begun (or
after its lifetime has ended). Moreover, when a program starts threads
that are not joined at exit, those threads may attempt to access objects
after their lifetime has ended if their destructor has already run."

Change-Id: I54eedcd813295a23923deb925b0ca2adfff69f7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297872
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-20 00:02:23 +00:00
Robert Phillips
e22c5caa84 Fix wacky_yuv_formats for *ooprddl configs
In OOPR/DDL mode, images wrapping backend textures must be able to exist past the end of the GM - residing in the DDL.

Change-Id: Icc78e407b45f91d3d47eebde2c316ff6bd962afb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297380
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-06-19 17:42:58 +00:00
Greg Daniel
5ed3c11a80 Reland "Don't release vk memory allocator until context is deleted."
This reverts commit c35c073c80.

Reason for revert: fix benches

Original change's description:
> Revert "Don't release vk memory allocator until context is deleted."
> 
> This reverts commit 11afa63693.
> 
> Reason for revert: breaking perf bots
> 
> Original change's description:
> > Don't release vk memory allocator until context is deleted.
> > 
> > Bug: chromium:1081806
> > 
> > Change-Id: I0a7a92408a3f2119e6b70d8eef6aa4f2d1982d4b
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297357
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> 
> TBR=egdaniel@google.com,bsalomon@google.com
> 
> Change-Id: I48d200cb72eb30c119359e89c5a9123213e62a5e
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:1081806
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297457
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

# Not skipping CQ checks because this is a reland.

Bug: chromium:1081806
Change-Id: I6d80af6a1fab2fd6e2e15e9a2c7deefd7a7866ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297475
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-18 22:04:23 +00:00
Adlai Holler
6f1487fe80 Consolidate GrDrawingManager <-> GrRenderTask lifecycle
This creates a funnel in the drawing manager (removeRenderTasks) that
opens the door for tighter integration between the two classes. Also we
add some assertions about the relationship and cut out duplicated code.

Bug: skia:10372
Change-Id: I0781ba7d45ac090cf7f6d430f0d56afe0f98b7e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297195
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
2020-06-18 17:42:43 +00:00
Greg Daniel
c35c073c80 Revert "Don't release vk memory allocator until context is deleted."
This reverts commit 11afa63693.

Reason for revert: breaking perf bots

Original change's description:
> Don't release vk memory allocator until context is deleted.
> 
> Bug: chromium:1081806
> 
> Change-Id: I0a7a92408a3f2119e6b70d8eef6aa4f2d1982d4b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297357
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>

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

Change-Id: I48d200cb72eb30c119359e89c5a9123213e62a5e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:1081806
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297457
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-18 17:38:31 +00:00
Greg Daniel
11afa63693 Don't release vk memory allocator until context is deleted.
Bug: chromium:1081806

Change-Id: I0a7a92408a3f2119e6b70d8eef6aa4f2d1982d4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297357
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-18 17:27:48 +00:00
John Stiles
9394dd59b9 Fix stack-buffer overrun in appendVAList.
Cleaned up SkString formatting APIs for consistency and removed hard-to-
use macros. Added printVAList API for orthogonality with existing
(append|prepend)VAList methods. Optimized append/prepend methods to
use printf if appending/prepending to an empty string, a surprisingly
common case.

Change-Id: I6fbc6dc84ebb060ca452f582cb4f13a3c0f7f6ec
Bug: chromium:1092743
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297276
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-18 15:41:23 +00:00
Dominic Mazzoni
8c662a7d6e Get rid of deprecated API to add children to PDF tag nodes.
fChildren/fChildCount was replaced with fChildVector and Chromium
migrated to the new API a while back, it's now safe to remove the
older interface.

Bug: chromium:607777
Change-Id: I7311d3b51f1b71209dcc024ae51637536d560619
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297260
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-18 13:57:23 +00:00
John Stiles
3b2c06c46b Remove HairlineAA from the clip-edge types.
GrQuadEffect and GrConicEffect were the only FPs that supported the
HairlineAA clip-edge type. These FPs have been updated to implicitly
always use HairlineAA, and other FPs no longer need to consider the
HairlineAA case.

This CL also updates the bezier-effects GM images to remove the non-
hairline test columns.

Change-Id: Ice942106344cf48480e972da4aab1c6055f9911e
Bug: skia:10393
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/297019
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-17 17:43:35 +00:00
Herb Derby
a08bde606a GrTextContext::Options -> GrSDFTOptions
Rename GrTextContext::Options to GrSDFTOptions. Remove GrTextContext.

TBR=reed@google.com

Change-Id: Ic89966cfe630cc6ee757977a6d63ae1da9e39ef0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296176
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-15 17:14:04 +00:00
Dominic Mazzoni
127c607818 Add separate PDF tag attribute interfaces for names and strings
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>
2020-06-15 15:46:29 +00:00
Mike Reed
82d619699d remove (unused) clipmask from savelayer
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>
2020-06-15 14:26:44 +00:00
Greg Daniel
9efe386978 Add SkSurface flush call that takes a GrBackendSurfaceMutableState.
This new api will eventually replace the version that takes an

SkSurface::BackendAccess.
Change-Id: I48cd013725e14027f386b0b111223459944ac44a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295567
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-12 20:40:54 +00:00
John Stiles
616da104ab Allow printf-style formatting to be used in SK_ABORT.
(This is a simple reland of
    https://skia-review.googlesource.com/c/skia/+/293272
and is functionally unchanged, but needed to be reconstructed
manually because JavaInputStreamAdaptor.cpp was deleted.)

SK_ABORT was already using SkDebugf to print the error message to the
console, so all the moving parts were there. This CL just adds a
mechanism for the calling code to pass in arguments.

Added a use case to demonstrate usage--when an allocation fails, the
requested size is now shown in the error message.

Change-Id: If8600a9febad15b7c8b7a04479a1d92442521f21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294705
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2020-06-12 20:26:34 +00:00
Herb Derby
3005c4815f Make explicit SDF default values.
Change-Id: I08023209a263cc50be9a9cac70e7184fd2fb2379
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296037
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-06-12 15:46:59 +00:00
Ethan Nicholas
77968f0d32 Revert "fixed sample(..., matrix) with runtime effects"
This reverts commit fb5ede576d.

Reason for revert: major performance regression due to constant shader recompilation

Original change's description:
> fixed sample(..., matrix) with runtime effects
> 
> Change-Id: Id5b7f1b5e992c587be000e112706bedfe00c90fd
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294697
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com

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

Change-Id: Ica8322e0eab8f00bfc1d4f6d33778eb6493b278f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295835
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2020-06-11 22:25:53 +00:00
Mike Reed
9290d01c6f Add filter-quality to imageshader factory
The old factories (makeShader) will behave as before: they will inherit
the filter-quality from the paint.

The new factory takes an explicit filter setting, and will use that
regardless of the paint.

Big follow-ups:
- update callers to not rely on setting in SkPaint
- revise/enhance settings in imageshader
    - settings for scaling up and down
    - control over trilerp, etc.
    - other: 4x4 kernels? trilerp bias?
- move mipmaps to always be explicit requests a SkImage factory time


Bug: skia:10344
Change-Id: If87b06d4fd6eafd8b9cdecda7c00d69897066ef8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295086
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-06-11 22:15:33 +00:00
Greg Daniel
e8d3ccadfe Remove GrPrepareForExternalIORequests from flush.
Now that we have the GrContext setBackendTextureState calls we no longer
need these to be on flush.

Bug: skia:10254
Change-Id: I7c44667a327de11dd853e3e71b114959a7bcee86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295447
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-10 20:00:20 +00:00
Brian Osman
ff7bee9817 Remove SkReader32, and some API from SkWriter32
After removing all unused API from SkReader32, it only had a handful
of functions, and it was (rightly) only used by SkReadBuffer. Remove
the temptation to use it by just folding it into SkReadBuffer.

SkWriter32 had some unnecessary functions as well (only used in unit
tests), so those are gone. There is still a strange relationship:
SkWriteBuffer is just an interface - SkReadBuffer is actually the
complement of SkBinaryWriteBuffer/SkWriter32. Those two classes produce
data in the exact same format, but with slightly different interfaces.
(The choice about which one is used is mostly about high-level
serialization vs. low-level helpers).

Change-Id: I1e823755febecd2e053ea732b21295d8f4d9d832
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295557
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-10 16:45:56 +00:00
Ethan Nicholas
fb5ede576d fixed sample(..., matrix) with runtime effects
Change-Id: Id5b7f1b5e992c587be000e112706bedfe00c90fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294697
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-06-10 13:59:15 +00:00
Greg Daniel
1db8e7990a Add GrContext API to allow updating GrBackendSurfaceMutableState.
This is currently only supported for the Vulkan backend

Bug: skia:10254
Change-Id: I9274799098dc00dec5abcbcec95ce7cc23fec537
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293844
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-10 13:15:55 +00:00
Robert Phillips
7eb0a5f7f2 Auto-resolve DDL targets in flushSurfaces
When a client uses flushSurface w/ an MSAA surface, Ganesh automatically
resolves it for them. This goes haywire with DDLs bc it is the DDL's
proxy that holds the MSAA state not the surface's innate proxy.

Bug: 1056730
Change-Id: I6385b4a8dcc6b38d3e43908fd516f357e2f4c9d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295064
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-06-09 20:00:49 +00:00
Brian Osman
5c9d18170b Make SK_DISABLE_EFFECT_SERIALIZATION trim out more code
This shrinks uncompressed CanvasKit by just over 15K

Change-Id: I2495b235cdbc201811195c93b9f3b31409dfd9c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295198
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-09 15:45:07 +00:00
Ben Wagner
0ef90dd5e9 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: Iac548f9fd920c426ea5c6dcdefe8da0a9b89ec90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294714
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-06 04:06:32 +00:00
Mike Klein
bb5b2a17c2 Revert "Split out coretext fontmgr factory."
This reverts commit 2c628340f4.

Reason for revert: ios-simulator chrome bot:

FAILED: obj/skia/x64/skia_unittests 
TOOL_VERSION=1591394828 ../../build/toolchain/mac/linker_driver.py -Wcrl,strippath,/opt/s/w/ir/cache/xcode_ios_11e146.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip ../../third_party/llvm-build/Release+Asserts/bin/clang++ -B /opt/s/w/ir/cache/xcode_ios_11e146.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/  -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -objc_abi_version -Xlinker 2 -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker obj/skia/skia_unittests.xcent -Wl,-fatal_warnings -arch x86_64 -Werror -nostdlib++ -isysroot sdk/xcode_links/iPhoneSimulator13.4.sdk -mios-simulator-version-min=12.0 -Wl,-ObjC -o "obj/skia/x64/skia_unittests" -Wl,-filelist,"obj/skia/x64/skia_unittests.rsp" -framework UIKit  -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework UIKit -framework Security
Undefined symbols for architecture x86_64:
  "SkCTFontGetSmoothBehavior()", referenced from:
      SkTypeface_Mac::onFilterRec(SkScalerContextRec*) const in libskia.a(SkFontHost_mac.o)
      SkScalerContext_Mac::generateImage(SkGlyph const&) in libskia.a(SkFontHost_mac.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Original change's description:
> Split out coretext fontmgr factory.
> 
> There can be only one SkFontMgr::Factory, so each should go in its own
> translation unit. In addition, the name SkFontHost_mac is now rather out
> of date and should now be SkFontMgr_mac_ct. Since the additional burden
> of additional build changes after the first is minimal, also split out
> SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
> SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
> which are replacing it. Once references to it are removed from all
> builds it can be removed.
> 
> This is intended to be a reorganization without much code change. Most
> changes are simple renaming of functions which are now shared between
> translation units. However, there are a few behavior changes here.
>   * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
>   * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
>   * SkFontMgr_New_CoreText takes a CTFontCollectionRef.
> 
> Change-Id: I897f69f2f5ea06819f5daa964c09cdd36490af85
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704

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

Change-Id: I5abeb7598c7f533477b4a4af5b568f7cbe6e8644
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294734
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-06-05 23:16:49 +00:00
Ben Wagner
2c628340f4 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: I897f69f2f5ea06819f5daa964c09cdd36490af85
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294704
2020-06-05 21:40:46 +00:00
Ben Wagner
aa10dfeec9 Revert "Split out coretext fontmgr factory."
This reverts commit 5c14d63297.

Reason for revert: chromium 'analyze' doesn't do a good job

Original change's description:
> Split out coretext fontmgr factory.
> 
> There can be only one SkFontMgr::Factory, so each should go in its own
> translation unit. In addition, the name SkFontHost_mac is now rather out
> of date and should now be SkFontMgr_mac_ct. Since the additional burden
> of additional build changes after the first is minimal, also split out
> SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
> SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
> which are replacing it. Once references to it are removed from all
> builds it can be removed.
> 
> This is intended to be a reorganization without much code change. Most
> changes are simple renaming of functions which are now shared between
> translation units. However, there are a few behavior changes here.
>   * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
>   * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
>   * SkFontMgr_New_CoreText takes a CTFontCollectionRef.
> 
> Change-Id: Iaf58a0371667f266ada20c918941fab6bc27d9df
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Ben Wagner <bungeman@google.com>

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

Change-Id: I469084efbfc71bba60e5fbfb4eb7152d57324d0c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294703
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-06-05 20:32:52 +00:00
Ben Wagner
5c14d63297 Split out coretext fontmgr factory.
There can be only one SkFontMgr::Factory, so each should go in its own
translation unit. In addition, the name SkFontHost_mac is now rather out
of date and should now be SkFontMgr_mac_ct. Since the additional burden
of additional build changes after the first is minimal, also split out
SkTypeface_mac_ct and SkScalerContext_mac_ct. The original
SkFontHost_mac.cpp is kept as a shell which #includes the cpp files
which are replacing it. Once references to it are removed from all
builds it can be removed.

This is intended to be a reorganization without much code change. Most
changes are simple renaming of functions which are now shared between
translation units. However, there are a few behavior changes here.
  * Drop SkTypefaceCache global for SkTypeface_Mac 'local' global.
  * SkCTFontCTWidthForCSSWidth returns CGFloat instead of 'int'.
  * SkFontMgr_New_CoreText takes a CTFontCollectionRef.

Change-Id: Iaf58a0371667f266ada20c918941fab6bc27d9df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294456
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-06-05 19:22:38 +00:00
Greg Daniel
288ecf60bd Use main command buffer for updateBackendTexture in vulkan.
Deletes support for the "side" temp command buffer

Bug: chromium:1087124
Change-Id: I97cda4e98faddd2d65f257613e19a825f52402c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294518
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2020-06-05 15:42:49 +00:00
Chris Dalton
b96995d05f Handle tessellated paths that require more segments than are supported
Adds a method to determine the worst-case number of tessellated line
segments that a path might require, and disables hardware tessellation
if it is more segments than are supported (falling back on indirect
draw shaders).

If the path requires even more segments than are supported by the
indirect draw shaders (1024), we crop the path to the viewport. The
required number of segments is proportional to the square root of the
bounding box's diagonal, so we won't start cropping paths until their
device-space bounding box diagonal is nearly 175,000 pixels long.

Change-Id: I8a9435e70bb93dda3464cc11a3e44fbe511744ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293691
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-06-05 15:33:19 +00:00
Herb Derby
396deb032b Move addToAtlas to GrAtlasManager
Change-Id: I24cee3587da3dabfc618e2c028d37bbdac52cde0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293938
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2020-06-04 16:16:13 +00:00
Herb Derby
64aa5138c7 Remove SkAtlasTextTarget
I can find no references to SkAtlasTextTarget in AOSP or in Chromium.
With google3 CL/314226466 there are no more uses in Google3.

Change-Id: I60b5f06fc17c0e4f8d008886c96645475e3d48e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293839
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2020-06-04 03:52:35 +00:00
Wan-Teh Chang
e84f96d712 Fix comments for SkYUVColorSpace
Document the range of video YUV values for the U and V components, which
is different from the range for the Y component.

Change-Id: I2c0101440e351013c7b3121573a591ad9860b2e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293868
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-03 17:37:28 +00:00
Kevin Lubick
2362022e7c [canvaskit] Make SkCanvas.drawColor/clear take SkColor4f
CanvasKit converts 4 floats to an int, just to have it be
converted back into 4 floats when it goes into the paint.

Change-Id: I93cf1c596283b83cc9452fb205b7000ceed09bb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293538
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-06-03 16:03:38 +00:00
Brian Salomon
3fdc49f357 Always call release procs on SkSurface GPU factories
Change-Id: Id1ca19630aea88200dfe2444aca1f8e9f679a616
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293762
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-06-03 15:29:38 +00:00
Mike Reed
63559a570c Revert "Revert "gms for SkParagraph""
This reverts commit e37d578796.

Change-Id: I7d979657d34e981998cd7c3ef3e05fd59e2721ab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293350
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2020-06-02 19:26:04 +00:00
Brian Osman
2ad3dfb46b For custom vector/normal/position attrs, let marker ID 0 mean CTM
Updated GM to draw a row of cases using CTM transform. For positions,
the resulting points are in absolute coordinates, so use a special
shader that takes that into account during the visualization.

Change-Id: I6985f7f451175a8d0d5116974edcaa5372560bfc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/290437
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-06-02 18:09:14 +00:00