diff options
author | 2018-02-13 09:25:22 -0500 | |
---|---|---|
committer | 2018-02-13 14:48:23 +0000 | |
commit | 366093f2124c38fa5c590c9ed2d1811817fed8ee (patch) | |
tree | a4d4d1b15a425704a7ea09575d7ce7c97bc4c2a7 /src/gpu/GrResourceProvider.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/GrResourceProvider.cpp')
-rw-r--r-- | src/gpu/GrResourceProvider.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp index 13c326a96a..df09e27d7e 100644 --- a/src/gpu/GrResourceProvider.cpp +++ b/src/gpu/GrResourceProvider.cpp @@ -135,8 +135,17 @@ sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, fit, budgeted); if (proxy) { + // We use an ephemeral surface context to do the write pixels. Here it isn't clear what + // color space to tag it with. That's ok because GrSurfaceContext::writePixels doesn't + // do any color space conversions. Though, that is likely to change. However, if the + // pixel config is sRGB then the passed color space here must have sRGB gamma or + // GrSurfaceContext creation fails. + sk_sp<SkColorSpace> colorSpace; + if (GrPixelConfigIsSRGB(desc.fConfig)) { + colorSpace = SkColorSpace::MakeSRGB(); + } sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeWrappedSurfaceContext( - std::move(proxy)); + std::move(proxy), std::move(colorSpace)); if (sContext) { if (sContext->writePixels(srcInfo, mipLevel.fPixels, mipLevel.fRowBytes, 0, 0)) { return sk_ref_sp(sContext->asTextureProxy()->priv().peekTexture()); |