aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGpuBlurUtils.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-11-06 11:27:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-06 16:48:39 +0000
commitce9c832c9125ecb6f803ba28cccb37c158bc31b5 (patch)
treefb1384562f9910e61f0ddc0db6a862be98bab599 /src/core/SkGpuBlurUtils.cpp
parente4aa0c4207c4bd8b4b63ed520f36110c71a9b062 (diff)
Fix another blurring bug with sRGB sources and legacy dests
By default, we propagate the input image's config to the temporary surface used for blurring. Without sRGB write control (eg Vulkan), we would end up unable to suppress the linear -> sRGB conversion, causing the blur results to be far too bright. Now, if we're rendering to a non-color correct dest, ensure that we never create an sRGB surface. Bug: skia: Change-Id: I18f5760005c11f788869251e58569029ce9f5c27 Reviewed-on: https://skia-review.googlesource.com/67845 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkGpuBlurUtils.cpp')
-rw-r--r--src/core/SkGpuBlurUtils.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index d1ee3a2c8a..7720c0ed04 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -222,7 +222,15 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
// setup new clip
GrFixedClip clip(localDstBounds);
- const GrPixelConfig config = srcProxy->config();
+ GrPixelConfig config = srcProxy->config();
+
+ if (GrPixelConfigIsSRGB(config) && !colorSpace) {
+ // If the context doesn't have sRGB write control, and we make an sRGB RTC, we won't be
+ // able to suppress the linear -> sRGB conversion out of the shader. Not all GL drivers
+ // have that feature, and Vulkan is missing it entirely. To keep things simple, switch to
+ // a non-sRGB destination, to ensure correct blurring behavior.
+ config = kRGBA_8888_GrPixelConfig;
+ }
SkASSERT(kBGRA_8888_GrPixelConfig == config || kRGBA_8888_GrPixelConfig == config ||
kRGBA_4444_GrPixelConfig == config || kRGB_565_GrPixelConfig == config ||