aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGpuDevice.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-10-30 13:47:41 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-31 14:55:14 +0000
commitf06ead925c631c42fae734de1e7c72237a2e91f4 (patch)
treed2ae0175607b41087df6bcc55d6fe4342eecc739 /src/gpu/SkGpuDevice.cpp
parent761f44853fcead7e7a105e1870cb970646814058 (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/gpu/SkGpuDevice.cpp')
-rw-r--r--src/gpu/SkGpuDevice.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index df81d0494b..760e6064bb 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -992,6 +992,7 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
// Construct a GrPaint by setting the bitmap texture as the first effect and then configuring
// the rest from the SkPaint.
std::unique_ptr<GrFragmentProcessor> fp;
+ GrPixelConfig config = proxy->config();
if (needsTextureDomain && (SkCanvas::kStrict_SrcRectConstraint == constraint)) {
// Use a constrained texture domain to avoid color bleeding
@@ -1022,7 +1023,7 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap,
fp = GrSimpleTextureEffect::Make(std::move(proxy), texMatrix, samplerState);
}
- fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(),
+ fp = GrColorSpaceXformEffect::Make(std::move(fp), bitmap.colorSpace(), config,
fRenderTargetContext->colorSpaceInfo().colorSpace());
GrPaint grPaint;
if (!SkPaintToGrPaintWithTexture(this->context(), fRenderTargetContext->colorSpaceInfo(), paint,
@@ -1088,7 +1089,7 @@ void SkGpuDevice::drawSpecial(SkSpecialImage* special1, int left, int top, const
tmpUnfiltered.setImageFilter(nullptr);
auto fp = GrSimpleTextureEffect::Make(std::move(proxy), SkMatrix::I());
- fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(),
+ fp = GrColorSpaceXformEffect::Make(std::move(fp), result->getColorSpace(), config,
fRenderTargetContext->colorSpaceInfo().colorSpace());
if (GrPixelConfigIsAlphaOnly(config)) {
fp = GrFragmentProcessor::MakeInputPremulAndMulByOutput(std::move(fp));