From 77320dbabcddf05c0a1489eaf1f496729dc8de0e Mon Sep 17 00:00:00 2001 From: brianosman Date: Wed, 7 Sep 2016 08:09:10 -0700 Subject: Add color gamut xform helpers to GrGLSLShaderBuilder New helper functions inject the necessary shader function. Texture lookup functions can now insert the gamut xform at the appropriate place, too. As written, could be used to transform non-texture colors (e.g. vertex colors) as well. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2180803005 Review-Url: https://codereview.chromium.org/2180803005 --- src/gpu/SkGpuDevice.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gpu/SkGpuDevice.cpp') diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 64df998e2f..ca84121015 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1010,7 +1010,8 @@ void SkGpuDevice::drawBitmapTile(const SkBitmap& bitmap, } sk_sp colorSpaceXform = - GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace()); + GrColorSpaceXform::Make(bitmap.colorSpace(), fDrawContext->getColorSpace(), + bitmap.alphaType()); SkScalar iw = 1.f / texture->width(); SkScalar ih = 1.f / texture->height(); @@ -1134,8 +1135,12 @@ void SkGpuDevice::drawSpecial(const SkDraw& draw, SkPaint tmpUnfiltered(paint); tmpUnfiltered.setImageFilter(nullptr); + sk_sp colorSpaceXform = + GrColorSpaceXform::Make(result->getColorSpace(), fDrawContext->getColorSpace(), + result->alphaType()); GrPaint grPaint; - sk_sp fp(GrSimpleTextureEffect::Make(texture.get(), nullptr, + sk_sp fp(GrSimpleTextureEffect::Make(texture.get(), + std::move(colorSpaceXform), SkMatrix::I())); if (GrPixelConfigIsAlphaOnly(texture->config())) { fp = GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(fp)); -- cgit v1.2.3