diff options
author | 2016-09-07 08:09:10 -0700 | |
---|---|---|
committer | 2016-09-07 08:09:10 -0700 | |
commit | 77320dbabcddf05c0a1489eaf1f496729dc8de0e (patch) | |
tree | 6dce3ee85d2206685279217db47e66dd47839e43 /src/gpu/SkGpuDevice.cpp | |
parent | d2e39dbc6a68a6cc2a480d0c8082eb204f6b6e77 (diff) |
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
Diffstat (limited to 'src/gpu/SkGpuDevice.cpp')
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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<GrColorSpaceXform> 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<GrColorSpaceXform> colorSpaceXform = + GrColorSpaceXform::Make(result->getColorSpace(), fDrawContext->getColorSpace(), + result->alphaType()); GrPaint grPaint; - sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(texture.get(), nullptr, + sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(texture.get(), + std::move(colorSpaceXform), SkMatrix::I())); if (GrPixelConfigIsAlphaOnly(texture->config())) { fp = GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(fp)); |