Commit Graph

10495 Commits

Author SHA1 Message Date
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