Commit Graph

798 Commits

Author SHA1 Message Date
Brian Osman
f28e55d5a1 Add SkPMColor4f support to SkSL
Convert GrConstColorProcessor to store SkPMColor4f

Bug: skia:
Change-Id: I6c505856653a02e576ae11fca59dc307545437f7
Reviewed-on: https://skia-review.googlesource.com/c/159152
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-10-04 14:55:04 +00:00
Brian Salomon
2213ee94c7 Add support for per-edge AA to GrTextureOp.
Outsetting in perspective case outsets the original homogeneous quad
points rather than the homogenized 2d points in order to avoid seaming
issues along shared edges.

Currently there is no way to trigger this from the public API and it
is tested by directly accessing GrRenderTargetContext from the added gm.

Change-Id: I24e0d53cc5821c8c8be07c23aca5bfafb4935c33
Reviewed-on: https://skia-review.googlesource.com/157600
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-10-02 16:45:07 +00:00
Brian Osman
1d5b598c4e Towards removing GrColor4f
We'd really like to converge on SkRGBA4f everywhere. This CL continues
to store GrColor4f in the GPU backend, but changes the constantColor
optimization logic to use SkPMColor4f.

GrColor[4f] have "unknown" alpha type, but in this context, they are
nearly always premul, so let's take advantage of our SkRGBA4f type
safety. We lose some of the semantic benefits and helpers that are
present in GrColor4f (OpaqueWhite, TransparentBlack).

The biggest thing that would probably help is a direct path to/from
bytes (GrColor).

Bug: skia:
Change-Id: Ic0838ad3f95d207163b3af51e5f5cf6f499c2047
Reviewed-on: https://skia-review.googlesource.com/157840
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-10-01 18:32:56 +00:00
Robert Phillips
e8e2bb1384 Test YUV images in DDL
The main two CLs calved off (and landed independently) from this CL are:

https://skia-review.googlesource.com/c/skia/+/156761 (Add SkImage_Gpu::MakePromiseYUVATexture)
  -- adds internal place holder for YUVA promise images (only returns Y channel)

https://skia-review.googlesource.com/c/skia/+/156140 (Add SkImage_Base API to access planar data)
  -- adds ability to grab planes for testing purposes (not externally visible)

Bug: skia:7903
Bug: skia:8424
Change-Id: Id0f2f84851dacc66c2c266a30cafa0b628b12eb4
Reviewed-on: https://skia-review.googlesource.com/151983
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-10-01 12:12:29 +00:00
Leon Scroggins III
5dd47e4f15 Make SkCodec truly default to sRGB
Remove SkEncodedInfo::ICCProfile::MakeSRGB. Instead of creating
this object whenever there is no encoded color profile, just
treat null as sRGB, like skcms does.

This may help with crbug.com/887372. Regardless it simplifies the
code.

Also fix a bug where SkCodec could have passed a null
skcms_ICCProfile to skcms_ApproximatelyEqualProfiles (related
to b/116608007).

Bug: chromium:887372
Change-Id: I2374e8d8a1aed261f1291b7f6fd6c7ea662f26fd
Reviewed-on: https://skia-review.googlesource.com/157561
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-09-27 20:08:06 +00:00
Brian Osman
d25b7c10b5 Introduce SkRGBA4f, templated on SkAlphaType
Most functionality is shared, but this lets us get type safety.
SkColor4f = SkRGBA4f<kUnpremul>
SkPMColor4f = SkRGBA4f<kPremul>

Change-Id: I27408565dc92e722f42a185cecbf7af15d1dde3f
Reviewed-on: https://skia-review.googlesource.com/156243
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2018-09-21 20:37:04 +00:00
Ben Wagner
0d96a4bc71 Remove SkAutoTCallIProc.
No longer used anywhere.

Change-Id: I029d0caf1bb60ba3e77761648193c01d39c37183
Reviewed-on: https://skia-review.googlesource.com/155843
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2018-09-20 17:42:02 +00:00
Brian Osman
653c6b5b8e Remove (unused) GrBlend.cpp, and some GrColor helpers
Bug: skia:
Change-Id: I9a99cb28fd239371ca21b4a918e802606afe9da0
Reviewed-on: https://skia-review.googlesource.com/155840
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-09-20 15:25:17 +00:00
Brian Osman
a5c578ff3d Add Short4 vertex attributes, and benchmark them as 4.12 colors
This reverts commit 90d2d9381e.

Updated to use float in the shader (many ES2 implementations
don't support integral types as attributes).

Bug: skia:
Change-Id: I0898f1730da60ff03f8165b2f1a3ee18a7b2fec8
Reviewed-on: https://skia-review.googlesource.com/155162
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-09-19 18:56:49 +00:00
Hal Canary
c2d0fb17de include: whitespace changes for clang-format
Change-Id: I76ab59d963cebf6cbb450e1873c3e0c63f3f2da0
Reviewed-on: https://skia-review.googlesource.com/155560
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-09-19 14:54:57 +00:00
Mike Klein
0191ed8e87 Make listener lists threadsafe with a mutex.
PS1 reverts commit 6c8d242b14.
PS2 uses an SkMutex for thread safety.

Change-Id: I9318f92cc028844b3dc5a99a00282c2762057895
Reviewed-on: https://skia-review.googlesource.com/155060
Reviewed-by: Mike Klein <mtklein@google.com>
2018-09-18 15:46:26 +00:00
Herb Derby
6c8d242b14 Make atomic lists list for bitmaps and paths
Make the listner list for bitmas and paths use a simple atomic
stack. This stack implementation does not have the ABA problem
because you can only pop the entire stack at once
with exchange(nullptr).

BUG=skia:8324

Change-Id: I7b0438a42c473b36cd4b0cbf236bf1692c5afab3
Reviewed-on: https://skia-review.googlesource.com/154861
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2018-09-17 20:54:06 +00:00
Brian Osman
90d2d9381e Revert "Add Short4 vertex attributes, and benchmark them as 4.12 colors"
This reverts commit d2ca0473f6.

Reason for revert: Various bots failing.

Original change's description:
> Add Short4 vertex attributes, and benchmark them as 4.12 colors
> 
> This is likely our best widely portable option for encoding wide gamut
> colors that doesnt sacrifice too much performance. The benchmark uses
> them as we're likely to do: 4.12 fixed point, in the destination color
> space. We're using SINT vertex attributes for simplicity, so the encode
> and decode are simple multiply/divide by 4096.
> 
> Bug: skia:
> Change-Id: I9b544f3e187b775d81f83dc9dd44611570ad33c2
> Reviewed-on: https://skia-review.googlesource.com/155001
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

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

Change-Id: I921e29cf9a121c5752ec7d99a03470b5193afd4a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/154883
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-09-17 20:41:30 +00:00
Brian Osman
d2ca0473f6 Add Short4 vertex attributes, and benchmark them as 4.12 colors
This is likely our best widely portable option for encoding wide gamut
colors that doesnt sacrifice too much performance. The benchmark uses
them as we're likely to do: 4.12 fixed point, in the destination color
space. We're using SINT vertex attributes for simplicity, so the encode
and decode are simple multiply/divide by 4096.

Bug: skia:
Change-Id: I9b544f3e187b775d81f83dc9dd44611570ad33c2
Reviewed-on: https://skia-review.googlesource.com/155001
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-09-17 20:19:07 +00:00
Brian Osman
d4c29709ca Specify CPU (buffer) and GPU (shader) types explicitly in Attribute
The CPU type is still specified using GrVertexAttribType.
The GPU type is specified directly using GrSLType.

kHalfX_GrVertexAttribType now really means half-float buffer
data, rather than float. (Caveat: The GL enum is only correct
with ES3/GL3 - ES2+extension needs a different value. Sigh.)

Bug: skia:
Change-Id: Ife101db68a5d4ea1ddc2f6c60fbec0c66d725c16
Reviewed-on: https://skia-review.googlesource.com/154628
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-09-14 21:54:03 +00:00
Chris Dalton
b68bcc4398 ccpr: Remove the dangling pointer from GrCCDrawPathsOp
Actually takes a ref on fOwningPerOpListPaths, instead of just
asserting it continues to exist. Removes unnecessary asserts
surrounding dangling pointers.

Bug: skia:8359
Change-Id: Ie80da55510f320452bd9ee3a4b38bd59d48681a0
Reviewed-on: https://skia-review.googlesource.com/154684
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2018-09-14 16:32:58 +00:00
Mike Klein
8f5a7a6f50 first start on a P3 GM
We don't have anything drawing colors outside sRGB,
but now that we've got SkPaint::setColor4f(), that's easy.

Looks like we have lots of work to do.

Pin GrColor4f floats before converting to unsigned.
Underflowing floats would get pinned to 255 spuriously
instead of to 0.  I think this fixes the failing CQ
bot, and the white square problem.

Change-Id: I866963ff026e6ab891b4c7d57decc43538000099
Reviewed-on: https://skia-review.googlesource.com/153640
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-09-11 19:17:06 +00:00
Florin Malita
3d413c5761 Reland: add SkPath::shrinkToFit
Original CL: https://skia-review.googlesource.com/c/skia/+/150967

  * expanded tests
  * fixed shared pathref copying

Change-Id: I4bfe89f597485aa2db68f58d99112188615faceb
Reviewed-on: https://skia-review.googlesource.com/153553
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
2018-09-11 18:33:00 +00:00
Mike Reed
a21a16b5dd Revert "add SkPath::shrinkToFit"
This reverts commit 3d69be51bb.

Reason for revert: breaks on SAN builds

Original change's description:
> add SkPath::shrinkToFit
> 
> Bug: skia:
> Change-Id: Ief647bcea53c0aeae2750473288bd31f16521772
> Reviewed-on: https://skia-review.googlesource.com/150967
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ic3d6497268df1eb86392f83844d3fdcdb0674373
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/153261
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-09-10 21:03:53 +00:00
Mike Reed
3d69be51bb add SkPath::shrinkToFit
Bug: skia:
Change-Id: Ief647bcea53c0aeae2750473288bd31f16521772
Reviewed-on: https://skia-review.googlesource.com/150967
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2018-09-10 20:49:31 +00:00
Brian Osman
086679bc11 Revert "increase Builder's prealloc size after colorspace change"
This reverts commit e53de48393.

Reason for revert: Key size distribution has changed back.

Original change's description:
> increase Builder's prealloc size after colorspace change
> 
> BUG=skia:
> 
> Change-Id: I003dcbde7d987404ae823df6621e13664cf440a1
> Reviewed-on: https://skia-review.googlesource.com/9523
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

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

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

Bug: skia:
Change-Id: I506a1ec791e6d99df1836cbf3262747fbfa224a7
Reviewed-on: https://skia-review.googlesource.com/153008
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-09-10 20:49:30 +00:00
Mike Klein
d9187c085b Revert "SkMath takes some functions from from SkTypes"
This reverts commit 3b347232bc.

Reason for revert: tree done gone red.

Original change's description:
> SkMath takes some functions from from SkTypes
> 
> Moved to include/core/SkMath.h: Sk{Is|}Align{2|4|8|Ptr}, SkLeftShift,
> SkAbs{32|}, SkM{ax|in}32 SkTM{in|ax}, SkTClamp, SkFastMin32, SkTPin.
> 
> Change-Id: Ibcc07be0fc3677731048e7cc86006e7aa493cb92
> Reviewed-on: https://skia-review.googlesource.com/133381
> Auto-Submit: Hal Canary <halcanary@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Hal Canary <halcanary@google.com>

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

Change-Id: I44073cf397e2a3a6a941a90f0aa63c6396d4c742
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/152587
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-09-07 17:32:54 +00:00
Hal Canary
3b347232bc SkMath takes some functions from from SkTypes
Moved to include/core/SkMath.h: Sk{Is|}Align{2|4|8|Ptr}, SkLeftShift,
SkAbs{32|}, SkM{ax|in}32 SkTM{in|ax}, SkTClamp, SkFastMin32, SkTPin.

Change-Id: Ibcc07be0fc3677731048e7cc86006e7aa493cb92
Reviewed-on: https://skia-review.googlesource.com/133381
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-09-07 17:18:46 +00:00
Leon Scroggins III
36f7e3298e Reland "Switch SkCodec to use skcms plus fixes""
This reverts commit 83988edfd3.

The CTS failure was actually due to another CL.

TBR=brianosman@google.com
TBR=djsollen@google.com

Bug: skia:6839
Bug: skia:8052
Bug: skia:8278
Change-Id: Id9f152ec2c66467d90f49df223cb9b7c168ac2ac
Reviewed-on: https://skia-review.googlesource.com/149483
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2018-08-27 16:16:14 +00:00
Leon Scroggins
83988edfd3 Revert "Reland "Switch SkCodec to use skcms" plus fixes"
This reverts commit 49894f450f.

Reason for revert: Breaking a CTS test on the Android roll:

java.lang.AssertionError: expected:<67043583> but was:<50266367>
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.failNotEquals(Assert.java:834)
	at org.junit.Assert.assertEquals(Assert.java:645)
	at org.junit.Assert.assertEquals(Assert.java:631)
	at android.graphics.cts.BitmapColorSpaceTest.verifyGetPixel(BitmapColorSpaceTest.java:301)
	at android.graphics.cts.BitmapColorSpaceTest.inColorSpaceP3ToSRGB(BitmapColorSpaceTest.java:612)

Expected: 3FF00FF Actual: 2FF00FF

Original change's description:
> Reland "Switch SkCodec to use skcms" plus fixes
> 
> This reverts commit 33d5394d08,
> relanding 81886e8f94 as well as
> "Fix CMYK handling in JPEG codec" (commit
> f8ae5ce20c)
> 
> Add a test based on the CTS test that failed in the original commit.
> purple-displayprofile.png is the image used in the CTS test, with the
> Android license.
> 
> This also adds a fix for SkAndroidCodec, ensuring that we continue to
> use a wide gamut SkColorSpace for images that do not have a numerical
> transfer function and have a wide gamut. This includes a test, with
> wide-gamut.png, which was created with Photoshop and the profile
> "sRGB_Calibrated_Homogeneous.icc" from the skcms tree.
> 
> Bug: skia:6839
> Bug: skia:8052
> Bug: skia:8278
> 
> TBR=djsollen@google.com
> As with the original, no API change
> 
> Change-Id: I4e5bba6a3151f9dc6491e8eda73d4de0535bd692
> Reviewed-on: https://skia-review.googlesource.com/149043
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Reviewed-by: Leon Scroggins <scroggo@google.com>

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

Change-Id: Ie71e1fecc26de8225d2fe603765c1e1e0d738634
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:6839, skia:8052, skia:8278
Reviewed-on: https://skia-review.googlesource.com/149262
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2018-08-24 21:41:37 +00:00
Leon Scroggins III
49894f450f Reland "Switch SkCodec to use skcms" plus fixes
This reverts commit 33d5394d08,
relanding 81886e8f94 as well as
"Fix CMYK handling in JPEG codec" (commit
f8ae5ce20c)

Add a test based on the CTS test that failed in the original commit.
purple-displayprofile.png is the image used in the CTS test, with the
Android license.

This also adds a fix for SkAndroidCodec, ensuring that we continue to
use a wide gamut SkColorSpace for images that do not have a numerical
transfer function and have a wide gamut. This includes a test, with
wide-gamut.png, which was created with Photoshop and the profile
"sRGB_Calibrated_Homogeneous.icc" from the skcms tree.

Bug: skia:6839
Bug: skia:8052
Bug: skia:8278

TBR=djsollen@google.com
As with the original, no API change

Change-Id: I4e5bba6a3151f9dc6491e8eda73d4de0535bd692
Reviewed-on: https://skia-review.googlesource.com/149043
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
2018-08-24 17:46:25 +00:00
Leon Scroggins III
33d5394d08 Revert "Switch SkCodec to use skcms" and follow on change
This reverts commit 81886e8f94 and
f8ae5ce20c
("Fix CMYK handling in JPEG codec")

This fixes the Android build, which was failing a CTS test with this
change.

Bug: skia:6839
Bug: skia:8052

TBR=djsollen@google.com
As with the original, no API change

Change-Id: Ic744a610e9f431707f871de44f9f64040bc60d14
Reviewed-on: https://skia-review.googlesource.com/148810
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2018-08-22 21:13:50 +00:00
Leon Scroggins III
81886e8f94 Switch SkCodec to use skcms
Bug: skia:6839
Bug: skia:8052

Create an skcms_Profile instead of an SkColorSpace when creating an
SkCodec. Eventually we'll move the SkImageInfo (and its SkColorSpace)
entirely to clients (e.g. SkAndroidCodec, SkCodecImageGenerator), but
for now, create it with SkEncodedInfo::makeImageInfo.

Create new SkEncodedInfo::Colors for the special PNG cases that we
want to map to specific SkColorTypes.

SkEncodedInfo:
- Add ICCProfile, which owns an skcms_ICCProfile
 - FIXME: maybe we should have a single instance for
  SRGB like SkColorSpace?
- Add kXAlpha_Color, for kAlpha_8. Since I'm not longer creating
  an SkImageInfo (at least in SkPngCodec), it needs a way to pass
  this info to the caller.
- Add k565_Color, for the same reason. Matt originally had this in
  https://codereview.chromium.org/2212563003/#ps120001, but didn't
  land that version. I like it though. Mike didn't like the bits
  per component for 565, but it seems like a sensible hack, much
  like the existing one for kAlpha_8
- Add width and height. These were removed for redundancy with
  SkImageInfo, but it makes sense to have them here without it.
BUILD.gn:
- Build the new SkEncodedInfo.cpp
SkCodec:
- Remove the constructor with an SkImageInfo. Edit the other one
  to drop width and height (now in SkEncodedInfo) and take a RHS
  reference to SkEncodedInfo
- Create the SkImageInfo from fEncodedInfo (for now)
- Consolidate choosing skcms_AlphaFormat for Transform here
- Call conversionSupported from initializeColorXform, with a new
  parameter for whether there is a color Xform, allowing SkJpegCodec
  and SkHeifCodec to override that method instead of having another
  method.
SkBmpCodec (etc)
- Adapt to the changes above
- Create a new SkEncodedInfo w/o profile for the swizzler.
SkPngCodec:
- use the new SkEncodedInfo::Colors rather than a custom SkImageInfo
SkRawCodec:
- Remove SkEncodedInfo from SkDngImage, which doesn't actually need it.
  This is helpful since we don't know all the info yet.
- Rewrite gAdobeRGB_toXYZD50 as an skcms_Matrix3x3
SkWebpCodec:
- Remove premul_step computation, and simplify to just rely on
  the base class' handling of applying the transform.
SkSwizzler:
- Add cases for the new SkEncodedInfo::Colors

TBR=reed@google.com
No public API changes. Only private/public members of SkCodec.h are
modified.

Change-Id: Ic0d3bb752b03f13be886b80331987aa5a5713fc0
Reviewed-on: https://skia-review.googlesource.com/136062
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-08-22 18:16:20 +00:00
Mike Klein
12d4b6e545 let's like, chill out about all these rules, man
There's really no reason to prevent any of these conversions;
they all have somewhat reasonable behavior:

   - converting between grey in different color spaces
     should probably work just fine
   - we'll convert color to gray using a fixed set of
     luminance coefficients, but that's better than failing
   - we'll invent {r,g,b} = {0,0,0} if we convert alpha
     to something with color
   - converting to opaque formats without thinking about
     premul/unpremul is probably fine, better than just
     not working at all
   - a missing src color space can always be assumed to be sRGB

Updates to ReadPixelsTest:
   - skip more supported test cases in test_conversion(),
     each with a TODO
   - conversions from non-opaque to opaque should now work
   - conversion from A8 to non-A8 should sometimes now
     work on GPUs, and the test needed a little bit of
     a tweak to not expect A8 to carry around color somehow.

Updates to SRGBReadWritePixelsTest:
   - writing untagged pixels shouldn't fail anymore;
     instead, it should behave like it was tagged sRGB

Change-Id: I19e78f3a6c89ef74fbcbc985d3fbd77fa984b1c2
Reviewed-on: https://skia-review.googlesource.com/147815
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-08-21 22:23:54 +00:00
Chris Dalton
916c498c04 Consolidate the scissor enums into one "GrScissorTest" enum
Bug: skia:
Change-Id: If8d40b54860acb5c18d3a9a82cb2a61e3c42025f
Reviewed-on: https://skia-review.googlesource.com/147172
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-08-15 13:53:42 +00:00
Mike Klein
015c899d34 port most SkAtomic<T> to std::atomic<T>
The only SkAtomic<T> left are the ones overriding the default memory
order in SkPath.  I think I'd like to try switching them to std::atomic
too, but in another CL.

Trim unused APIs in SkAtomics.h.

Change-Id: Ia1c283355902ccb8fcdad70cdf27bb577e8ca407
Reviewed-on: https://skia-review.googlesource.com/146529
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-08-09 23:40:31 +00:00
Mike Reed
b547579d00 switch SkTDArray from push to push_back
Bug: skia:
Change-Id: I5d7252cf67a201612813597047f1ea3584c57854
Reviewed-on: https://skia-review.googlesource.com/146386
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 21:13:57 +00:00
Mike Reed
5edcd31f2c migrating SkTDArray towards std::vector api
fix for https://skia-review.googlesource.com/c/skia/+/146140

Change from original was to include <initializer_list>

Bug: skia:
Change-Id: Ie36426fcf7ce778a95e2b656ce80a9a394a8307c
Reviewed-on: https://skia-review.googlesource.com/146160
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-08-08 15:51:44 +00:00
Mike Reed
f9ecb4e67e Revert "migrating SkTDArray towards std::vector api"
This reverts commit 79884be809.

Reason for revert: broke flutter build -- initializer_list?

Original change's description:
> migrating SkTDArray towards std::vector api
> 
> push -> push_back
> add some aliases to match std::vector: count, reserve, ...
> 
> Bug: skia:
> Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
> Reviewed-on: https://skia-review.googlesource.com/145884
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Ib6132b725aaed7c01287e3e8c2b5a14da3d3d7e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/146140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 15:14:37 +00:00
Mike Reed
79884be809 migrating SkTDArray towards std::vector api
push -> push_back
add some aliases to match std::vector: count, reserve, ...

Bug: skia:
Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
Reviewed-on: https://skia-review.googlesource.com/145884
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 14:43:28 +00:00
Brian Salomon
7eae3e04e3 Reland "Move GrGeometryProcessor's textures out of classes and into"
This reverts commit fdf05f4ff4.

Reason for revert: Android fixed after removing multitexture support from TextureOp.

Original change's description:
> Revert "Move GrGeometryProcessor's textures out of classes and into"
> 
> This reverts commit af87483873.
> 
> Revert "GrGeometryProcessor derives from GrNonAtomicRef not GrProgramElement."
> 
> This reverts commit 607be37e3d.
> 
> Revert "Store GrMeshDrawOps' meshes in GrOpFlushState's arena."
> 
> This reverts commit b948572c78.
> 
> Revert "Remove multitexturing support from GrTextureOp."
> 
> This reverts commit 986f64c601.
> 
> Revert "Make result of GrOp::combineIfPossible be an enum."
> 
> This reverts commit 641ac7daa8.
> 
> Bug: b/112244393
> Change-Id: I579491a3f2f2f2093f1e2a6141fa1e4cc7b760a4
> Reviewed-on: https://skia-review.googlesource.com/145646
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>

TBR=bsalomon@google.com

Change-Id: I1d41c2ecf7862e31fb025a7a00bb07bae9d83a47
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: b/112244393
Reviewed-on: https://skia-review.googlesource.com/145780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-08-07 14:02:49 +00:00
Robert Phillips
e6d0618f67 Add list of dependents to GrOpList class
This is pulled out of: https://skia-review.googlesource.com/c/skia/+/143113 (Reduce arbitrary opList splitting when sorting (take 3)) and is necessary for incremental tological sorting of opLists.

Change-Id: I080cee2c54f5a61dceea67037242f6c6b3e01b8d
Reviewed-on: https://skia-review.googlesource.com/145641
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-08-07 12:27:17 +00:00
Brian Salomon
fdf05f4ff4 Revert "Move GrGeometryProcessor's textures out of classes and into"
This reverts commit af87483873.

Revert "GrGeometryProcessor derives from GrNonAtomicRef not GrProgramElement."

This reverts commit 607be37e3d.

Revert "Store GrMeshDrawOps' meshes in GrOpFlushState's arena."

This reverts commit b948572c78.

Revert "Remove multitexturing support from GrTextureOp."

This reverts commit 986f64c601.

Revert "Make result of GrOp::combineIfPossible be an enum."

This reverts commit 641ac7daa8.

Bug: b/112244393
Change-Id: I579491a3f2f2f2093f1e2a6141fa1e4cc7b760a4
Reviewed-on: https://skia-review.googlesource.com/145646
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-08-06 22:27:48 +00:00
Brian Salomon
607be37e3d GrGeometryProcessor derives from GrNonAtomicRef not GrProgramElement.
It probably doesn't need to be ref counted at all and should be stored
in GrOpFlushState's arena but that's a larger change for another day.

Change-Id: I5f593fb426b8e7794f2ca81194f5a8d9e0f0a072
Reviewed-on: https://skia-review.googlesource.com/145332
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-08-03 20:51:48 +00:00
Brian Salomon
af87483873 Move GrGeometryProcessor's textures out of classes and into
GrPipeline::FixedDynamicState.

This will allow specification of different textures for different
GrMeshes using GrPipeline::DynamicStateArrays in a future change.

Change-Id: I4a7897df33a84e4072151149e5d586dca074393f
Reviewed-on: https://skia-review.googlesource.com/145264
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-08-03 17:24:05 +00:00
Brian Salomon
ee783966d4 templatize GrSurfaceProxyRef
Change-Id: I23e848d852a0c126a6581d2682af3f9e927e876f
Reviewed-on: https://skia-review.googlesource.com/144607
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-08-01 15:15:56 +00:00
Brian Salomon
fd98c2c871 Make some GrSurfaceProxy and GrTextureProxy methods easier to access
Move peek[Surface|Texture|RenderTarget]() from GrSurfaceProxyPriv to
to GrSurfaceProxy.

Move proxyMipMapped(), textureType(), and hasRestrictedSampling()
from GrTextureProxyPriv to GrTextureProxy.

Change-Id: I259114d0508c4613d55f7f1faccac362fa6fb281
Reviewed-on: https://skia-review.googlesource.com/144641
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-08-01 12:00:47 +00:00
Brian Salomon
e782f8472f Remove GrResourceIOProcessor.
Fold its functionality into GrPrimitiveProcessor and GrFragmentProcessor.

Make each have its own TextureSampler nested class. Currently the only
difference is that fragment processors lose the ability to inject their
samplers into the vertex shader. However, this facilitates refactoring
GrPrimitiveProcessor's TextureSampler class such that the textures are
specified separately from the TextureSampler.

Bug: skia:
Change-Id: I1e590187e7a6ae79ee3147155d397fcdcf5e4619
Reviewed-on: https://skia-review.googlesource.com/142814
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
2018-07-31 18:16:11 +00:00
Ethan Nicholas
0054311bf3 Re-re-land "added GrSkSLFP and converted DitherEffect to use it"
This reverts commit 6c48e4d11c.

Bug: skia:
Change-Id: I7ee78990fc30eec545d1856e59eb6e0573089426
Reviewed-on: https://skia-review.googlesource.com/144348
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
2018-07-31 15:18:03 +00:00
Brian Salomon
7226c232d7 Make GrTextureProxy store a GrTextureType.
Removes flag indicating rectangle or external as its now redundant.

Bug: skia:
Change-Id: Ia475b557390e7a6b0f19f6e189cf8c27090e397c
Reviewed-on: https://skia-review.googlesource.com/144346
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-07-30 19:32:13 +00:00
Brian Salomon
60dd8c7464 Introduce enum class for texture type.
This represents the GL texture "target" but at the API-neutral level. It
will be needed here because proxy's that wrap imported texture's need to
know about sampling restrictions.

Change-Id: Ie811a6f6d04ba1b04faa6908422dca64e8e447c8
Reviewed-on: https://skia-review.googlesource.com/144304
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-07-30 14:54:25 +00:00
Brian Salomon
4818244804 Remove unused kTexture2D_GrSLType and kSampler_GrSLType
Also remove unused GrSLTypeIs2DCombinedSamplerType

Bug: skia:
Change-Id: I9c670535dbbc30ddeb3636acb5b784580a968ee4
Reviewed-on: https://skia-review.googlesource.com/144035
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-07-27 19:49:18 +00:00
Brian Salomon
db10ed097f Remove unused kBufferSampler_GrSLType
Change-Id: I3e0476d92dfde928ef7d49155afdc3685c4ca03e
Reviewed-on: https://skia-review.googlesource.com/144023
Auto-Submit: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2018-07-27 19:42:46 +00:00
Chris Dalton
9acfc6cac2 Add kAAHairline to GpuPathRenderers
With the upcoming ccpr stroking, this will no longer be the only path
renderer that can handle hairlines.

Bug: skia:
Change-Id: I45b30ccd578bee1388a3a07a234af76a19768de6
Reviewed-on: https://skia-review.googlesource.com/142272
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-07-27 13:30:17 +00:00
Robert Phillips
01a9128a6f Maybe fix numStencilBits TSAN crash
Bug: skia:7390
Change-Id: Ied9c92147324ddb1245df796cd201df35657bbe0
Reviewed-on: https://skia-review.googlesource.com/143304
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2018-07-26 13:37:26 +00:00