Make it so that GrSurfaceContext with a sRGB GrPixelConfig must have a
color space with a sRGB-like gamma.
Change-Id: I99b80a9846caacd6848b0f9f55ed0f7f23e69b90
Reviewed-on: https://skia-review.googlesource.com/106640
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index af28409..b8d2474 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -184,10 +184,14 @@
// because Vulkan will want to do the copy as a draw. All other copies would require a
// layout change in Vulkan and we do not change the layout of borrowed images.
GrMipMapped mipMapped = willNeedMipMaps ? GrMipMapped::kYes : GrMipMapped::kNo;
+ sk_sp<SkColorSpace> colorSpace;
+ if (GrPixelConfigIsSRGB(desc.fConfig)) {
+ colorSpace = SkColorSpace::MakeSRGB();
+ }
sk_sp<GrRenderTargetContext> rtContext(context->makeDeferredRenderTargetContext(
- SkBackingFit::kExact, info.width(), info.height(), proxy->config(), nullptr, 1,
- mipMapped, proxy->origin(), nullptr, SkBudgeted::kYes));
+ SkBackingFit::kExact, info.width(), info.height(), proxy->config(),
+ std::move(colorSpace), 1, mipMapped, proxy->origin(), nullptr, SkBudgeted::kYes));
if (!rtContext) {
return nullptr;