diff options
author | Brian Salomon <bsalomon@google.com> | 2018-02-13 09:25:22 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-13 14:48:23 +0000 |
commit | 366093f2124c38fa5c590c9ed2d1811817fed8ee (patch) | |
tree | a4d4d1b15a425704a7ea09575d7ce7c97bc4c2a7 /src/gpu/GrSurfaceProxy.cpp | |
parent | a3cc32c94579289e99ca46235602a13f20fe5996 (diff) |
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>
Diffstat (limited to 'src/gpu/GrSurfaceProxy.cpp')
-rw-r--r-- | src/gpu/GrSurfaceProxy.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp index e311a820e1..6c81fc0bec 100644 --- a/src/gpu/GrSurfaceProxy.cpp +++ b/src/gpu/GrSurfaceProxy.cpp @@ -275,11 +275,17 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::Copy(GrContext* context, dstDesc.fHeight = srcRect.height(); dstDesc.fConfig = src->config(); + // We use an ephemeral surface context to make the copy. Here it isn't clear what color space + // to tag it with. That's ok because GrSurfaceContext::copy doesn't do any color space + // conversions. However, if the pixel config is sRGB then the passed color space here must + // have sRGB gamma or GrSurfaceContext creation fails. See skbug.com/7611 about making this + // with the correct color space information and returning the context to the caller. + sk_sp<SkColorSpace> colorSpace; + if (GrPixelConfigIsSRGB(dstDesc.fConfig)) { + colorSpace = SkColorSpace::MakeSRGB(); + } sk_sp<GrSurfaceContext> dstContext(context->contextPriv().makeDeferredSurfaceContext( - dstDesc, - mipMapped, - SkBackingFit::kExact, - budgeted)); + dstDesc, mipMapped, SkBackingFit::kExact, budgeted, std::move(colorSpace))); if (!dstContext) { return nullptr; } |