diff options
author | 2017-10-30 13:47:41 -0400 | |
---|---|---|
committer | 2017-10-31 14:55:14 +0000 | |
commit | f06ead925c631c42fae734de1e7c72237a2e91f4 (patch) | |
tree | d2ae0175607b41087df6bcc55d6fe4342eecc739 /src/core | |
parent | 761f44853fcead7e7a105e1870cb970646814058 (diff) |
Add support for transfer functions to GrColorSpaceXform
With this change, untagged sources (eg N32) are treated as
sRGB data, which causes a huge number of GMs to render more
correctly in GPU sRGB/F16/etc... configs. Also, because the
sources are treated as having a color space, we actually do
gamut conversion for wide or narrow gamut outputs.
This change also applies the transfer function math to
individual colors in the case of gradient stops and color
shaders. (The CPU backend doesn't do this yet, but I think
we've decided there's no reason not to support it).
Bug: skia:
Change-Id: If76e9e4a268f9f74110ff4bbe4fe189ba5d19d9f
Reviewed-on: https://skia-review.googlesource.com/64100
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkImageFilter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index cdea2d1ccc..bf34ae3180 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -368,8 +368,11 @@ sk_sp<SkSpecialImage> SkImageFilter::ImageToColorSpace(SkSpecialImage* src, // object. If that produces something, then both are tagged, and the source is in a different // gamut than the dest. There is some overhead to making the xform, but those are cached, and // if we get one back, that means we're about to use it during the conversion anyway. - sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(src->getColorSpace(), - outProps.colorSpace()); + // + // TODO: Fix this check, to handle wider support of transfer functions, config mismatch, etc. + // For now, continue to just check if gamut is different, which may not be sufficient. + auto colorSpaceXform = GrColorSpaceXform::MakeGamutXform(src->getColorSpace(), + outProps.colorSpace()); if (!colorSpaceXform) { // No xform needed, just return the original image |