Commit Graph

34 Commits

Author SHA1 Message Date
Kevin Lubick
8499e372ce [includes] Remove more includes of SkColorSpace
While I was fixing up Chrome's uses, I found some failures
there that I did not see in Skia, and tracked them down
to a few other places where we include SkColorSpace
and it is not strictly necessary

 - SkCustomMesh.h
 - GrColorInfo.h
 - GrColorSpaceXform.h
 - SkColorSpaceXformSteps.h

For these files (and their .cpp files), I added enforcement
of include-what-you-use, and then fixed the myriad of places
which were depending on these transitive includes.

One change to help Chrome is the manual overloads of
SkImage::MakeFromAdoptedTexture instead of using default
parameters. This makes it so callers of that function
do not need to include SkColorSpace if they were going
to pass nullptr for it anyway.

Bug: skia:13052
Change-Id: I16bf8ed5e258225d887f562f2c189623b1ca9c23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527056
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-04-06 21:58:24 +00:00
John Stiles
c766dd5f7b Fix p3_ovals GM on high-DPI displays.
On a Mac with a retina display running Viewer, our canvas' total matrix
has a 2x scale factor applied. This change prevents an assertion from
occurring while viewing slides in Viewer.

(I tried actually compensating for the canvas scale factor as well, but
it didn't actually matter, because the canvas provided by Viewer doesn't
support readPixels either way.)

Change-Id: Ib378c79da96cea8d36815860889ca529d7314adc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419799
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-18 17:30:20 +00:00
Mike Reed
607a382298 drawBitmap is deprecated, use drawImage
Change-Id: Ib66517fe26036704ccb8328ef92fa0f5240c79f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358222
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-25 01:44:55 +00:00
Mike Reed
5ec22387ff Simplify common case of linear filtering with no mips
Change-Id: I08b4a7bc088705b93a0aa680f6733d09c7ad23dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354221
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-15 16:47:16 +00:00
Mike Reed
057fcbec5d Use sampling for bitmap shaders
Change-Id: Ifa656ffc83a1adb5670cff1e2ce77f2edb1d6b03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343776
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-12-12 20:10:41 +00:00
Mike Klein
8aa0edfed2 move SkTPin to include/private
Change-Id: Ib0dc823d331a7cddc5da1d1be83136ce803a7871
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327783
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-10-16 19:45:11 +00:00
Mike Klein
21e82889d6 use precise is-normalized test in gm/p3.cpp
Change-Id: I894658882da92cb221be8355c8b1c7590c09895f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/303650
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-07-17 19:58:33 +00:00
Mike Klein
d5cba9d000 add SkColorSpace param to SkPixmap::erase()
We don't have a way to erase with a non-sRGB color.

Update the P3 gm to test this, removing the SkBitmap erase case where
there's no option for even an SkColor4f, let alone non-sRGB.  I'm not
sure it's really important to have one when we've got this on pixmap.

Updated release notes.

Change-Id: Ie98270d3f83e041593b4c6b2da8e325b36d4ff18
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/285341
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-04-24 14:20:54 +00:00
Mike Klein
b147aceed7 DCI-P3 -> Display P3 in Skia
This keeps an alias so code keeps building.

Bug: skia:9792
Change-Id: If8575468d929d2ca28bc2f9e82de27291fb19aa1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264691
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-01-16 21:24:16 +00:00
Ben Wagner
7fde8e1728 IWYU for gms.
This almost gets gms to be iwyu clean. The last bit is around gm.cpp
and the tracing framework and its use of atomic. Will also need a way
of keeping things from regressing, which is difficult due to needing to
do this outside-in.

Change-Id: I1393531e99da8b0f1a29f55c53c86d53f459af7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211593
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-02 17:48:53 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Mike Reed
50acf8f04b add makeShader() to SkBitmap, and deprecate SkShader version
Bug: skia:8937
Change-Id: I42f011e04937a751222bd8ecc6c69b45cf9626a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206681
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2019-04-08 17:56:34 +00:00
Mike Reed
fae8fceb4a Use SkTileMode instead of nested enum
Add guard to transition clients

Change-Id: Ia7a3e8f95722f91e84af262168dadf89a78707da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205720
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 15:24:18 +00:00
Mike Klein
4dc70ecbdb fix labels in P3 gm
We first draw interpolating in P3, UPM+PM, then in sRGB, UPM+PM.
Looks like the last gradient got its labels as a copy and paste
from the second.

Add a todo to test the middle color somehow.  That's where we
either are or were going wrong, and it's an easy way to test
interpolation.

Change-Id: Ib7ff385c9244e33ee13fd206279119de25ce2eb6
Reviewed-on: https://skia-review.googlesource.com/c/196581
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-03-01 16:09:49 +00:00
Mike Klein
b0243b29cb add Leon's gradient to p3 GM
Running...

  $ ninja -C out dm
  $ out/dm -m p3 --config 8888 srgb f16 esrgb p3 glp3 glesrgb glf16 -w foo
  $ open foo/*/gm/p3.png

... looks like esrgb and f16 are marked wrong, and all others right,
which points to a problem specific to the software backend.

Bug: skia:8730
Change-Id: Ibffe3014e6ed1ade9c04381530a3c84a690e6469
Reviewed-on: https://skia-review.googlesource.com/c/188028
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2019-01-30 17:43:11 +00:00
Hal Canary
df2d27e0c7 drawText Cleanup, part 2
Change-Id: I6765d623924d12c6eea2c402dd27eade61b73b66
Reviewed-on: https://skia-review.googlesource.com/c/182151
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-01-09 16:01:59 +00:00
Mike Klein
c46a7bcffe Revert "update p3 GM"
This reverts commit 754b5cb57d.

Reason for revert: will reland if the other CL does.

Original change's description:
> update p3 GM
> 
> The pixmap calls are pretty easy to update.
> There's no equivalent SkBitmap call, so bye bye.
> 
> Change-Id: I6eab40c69c0585d51b494e2761cd299a0758e79c
> Reviewed-on: https://skia-review.googlesource.com/c/181985
> Commit-Queue: Mike Klein <mtklein@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Auto-Submit: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

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

Change-Id: I29cb2685927731e22fc1dedef80f95c7dca49459
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/182102
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-01-08 13:34:12 +00:00
Mike Klein
754b5cb57d update p3 GM
The pixmap calls are pretty easy to update.
There's no equivalent SkBitmap call, so bye bye.

Change-Id: I6eab40c69c0585d51b494e2761cd299a0758e79c
Reviewed-on: https://skia-review.googlesource.com/c/181985
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-01-08 01:58:49 +00:00
Brian Osman
82ebe04caf Reland "Add SkColorSpace factory from 3x3 row-major gamut and transfer function"
Moved named common transfer functions and gamuts to constexpr values in
SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.

Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
new factory with the named values. Multiple clients want a way to
extract named transfer function and gamut - this still doesn't provide
that, but this may be a better path forward for honestly advertising how
SkColorSpace works internally.

Originally landed as:
https://skia.googlesource.com/skia/+/a9549ab31630fc244094e6f1692371cbaf87f666

Re-landing with a new serialization format, but maintaining ability to
load old serialized color spaces, for SKP compatibility.

Bug: skia:
Change-Id: Ib84a6e1cd5d7d9816175773fdbaff2ca32658667
Reviewed-on: https://skia-review.googlesource.com/c/181176
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-05 20:06:51 +00:00
Brian Osman
d4c7458f64 Revert "Add SkColorSpace factory from 3x3 row-major gamut and transfer function"
This reverts commit a9549ab316.

Reason for revert: SKPs changed?

Original change's description:
> Add SkColorSpace factory from 3x3 row-major gamut and transfer function
> 
> Moved named common transfer functions and gamuts to constexpr values in
> SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.
> 
> Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
> new factory with the named values. Multiple clients want a way to
> extract named transfer function and gamut - this still doesn't provide
> that, but this may be a better path forward for honestly advertising how
> SkColorSpace works internally.
> 
> Bug: skia:
> Change-Id: I9296d67e8f0dab5ceb49869cb3ba24e98a05f3c4
> Reviewed-on: https://skia-review.googlesource.com/c/180360
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>

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

Change-Id: Ie888f877b3c1dba33e1a8c0f5fa92594628de7fb
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/181300
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-04 17:07:48 +00:00
Brian Osman
a9549ab316 Add SkColorSpace factory from 3x3 row-major gamut and transfer function
Moved named common transfer functions and gamuts to constexpr values in
SkColorSpace.h, in SkNamedTransferFn and SkNamedGamut namespaces.

Converted nearly all SkColorSpace::MakeRGB calls within Skia to use the
new factory with the named values. Multiple clients want a way to
extract named transfer function and gamut - this still doesn't provide
that, but this may be a better path forward for honestly advertising how
SkColorSpace works internally.

Bug: skia:
Change-Id: I9296d67e8f0dab5ceb49869cb3ba24e98a05f3c4
Reviewed-on: https://skia-review.googlesource.com/c/180360
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-01-04 14:32:06 +00:00
Brian Osman
975197ce8f Fix sampling location for dashed circle in p3_ovals
I was sampling near the edge of the stroke, not the middle of it,
so some configs were picking up antialiased pixels.

Bug: skia:
Change-Id: I46314ba0bafe056505037deaa8dd32f4f68119f6
Reviewed-on: https://skia-review.googlesource.com/c/172503
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-21 21:17:04 +00:00
Brian Osman
e3caf2dfa1 Use GrVertexColor in various oval ops
p3_ovals GM exercises four different oval ops. Before, they all drew
wrong in extended range GPU configs. Now, they all draw correctly.

Bug: skia:
Change-Id: I4ea803b6325bfd20e9361880b1822cc6f0441cea
Reviewed-on: https://skia-review.googlesource.com/c/172480
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-11-21 20:26:29 +00:00
Brian Osman
d5ea99871c Remove SkRGBA4f pinning functions
Bug: skia:
Change-Id: I48ba39465a160e73502ee38d90062d955da6e8e6
Reviewed-on: https://skia-review.googlesource.com/c/167140
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-31 20:32:28 +00:00
Mike Klein
c9eace8194 add unpremul gm
Change-Id: I3126fb8b055b58e45f1bd0d913413b4d4d38f032
Reviewed-on: https://skia-review.googlesource.com/c/166740
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-31 15:41:30 +00:00
Brian Osman
3f4602f10f Add bitmap-as-shader case to P3 GM
This drew incorrectly before https://skia-review.googlesource.com/c/skia/+/163488

Bug: skia:
Change-Id: I81065f282191e1baa337370e575bd72edf5f8a09
Reviewed-on: https://skia-review.googlesource.com/c/163492
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-18 21:12:56 +00:00
Mike Klein
eee8315ed0 add (e)sRGB gradients to P3 GM
At the moment I'm actually a bit confused about
why the new pair of gradients appear to interpolate
in P3 when drawn in --config 8888.

--config gl works as I'd expect, interpolating the
existing gradients in P3 and the new gradients in
sRGB.

Change-Id: I74b77d834b495a7545753b76c8fd8ecaeb5c7b70
Reviewed-on: https://skia-review.googlesource.com/c/161586
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2018-10-12 21:05:30 +00:00
Mike Klein
983886e573 add interp-in-premul case to GM
Change-Id: I9811c76c3db38d5ab49ba0312e433aa46744df05
Reviewed-on: https://skia-review.googlesource.com/155781
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-09-20 18:36:21 +00:00
Mike Klein
62bd12f723 add a couple bitmap cases to P3 GM
This checks drawBitmap() and a few ways to create P3 bitmaps.

Change-Id: I6f891c641a44249d7562f2f5ddeed8cbaa40ad40
Reviewed-on: https://skia-review.googlesource.com/154863
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-09-17 17:33:23 +00:00
Mike Klein
be569494c4 add bitmap shaders to P3
Update SkImageShader/SkBlitter_sprite to use SkPaint::getColor4f().

Split the set_rgb into bounded and unbounded variants, just like we did
with uniform_color (the exact rgba variant).  Without this we'd try to
draw out-of-gamut colors in lowp for the non-scaled shader draw in
--config srgb, and that can't work.  SkRasterPipeline::append_set_rgb()
now checks to see if it's safe to use ::set_rgb and lowp, falling back
on ::unbounded_set_rgb and floats.

In the GM, the new "sprite" case is handled by SkImageShader, and the
old "sprite" case is handled as a uniform color draw through an A8 mask.
I'm having trouble constructing a call that reaches the A8 code in
SkBlitter_Sprite, but I have confirmed that it's definitely used by
quickly running the other GMs.  I've updated it to use the float paint
color just like SkImageShader.

Change-Id: I1ca8c08b79631165ac0c0032a1406add80e55c9f
Reviewed-on: https://skia-review.googlesource.com/154624
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-09-14 20:05:32 +00:00
Mike Klein
9fb5a53c8e add two more cases to P3 gm
These are a sprite and non-sprite A8 image draw,
where we pick up the color from the paint.

I'm slightly disturbed to see these working.
It turns out I had no idea how A8 draws happened.

There is probably some dead code to remove in
SkBlitter_Sprite (I think, never called for A8)
and in SkImageShader (only ever called with a black
paint color for A8), in this CL as TODOs.

Change-Id: I1d276f8d9b145b57e3ab793735fb184bdae670fb
Reviewed-on: https://skia-review.googlesource.com/154461
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-09-13 21:14:56 +00:00
Mike Klein
5e31ec6045 add a linear gradient to P3 gm
I've tweaked the indicators into overlays so there can be one for each
pixel sampled.  This lets me test both gradient corners.

I've dropped displaying the P3 value... not sure if it's as useful as
the other two, and I'm worried about information overload.  There's
already a lot to look at.

Change-Id: I57a41c3af0162e8132e50c47a0b967714a57e9e5
Reviewed-on: https://skia-review.googlesource.com/154220
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
2018-09-13 13:30:22 +00:00
Mike Klein
fd007644c8 revise p3 GM
I've added a little auto-grader.
I think it's logic makes sense, but I'd appreciate fresh eyes on it.

Now with anti-aliased text.

Change-Id: I43a6d69251d4d93fbd70533f5c4d1cc281e4498b
Reviewed-on: https://skia-review.googlesource.com/154000
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-09-12 17:56:54 +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