From 9aa30c6ee0e5e2ba4ccc25a4913966a65f808f28 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Mon, 2 Jul 2018 15:21:46 -0400 Subject: Remove sRGB config checks based on color space All of the restrictions/assumptions that led to this code are gone, so we can always use appropriate color space. For the YUV provider, if/when we re-introduce 8888 sRGB, the color space will have a linear transfer function, so the color space xform will automatically do what was happening here. That removes the last usage of framebuffer sRGB control, so we can remove all kinds of GrPaint and GrPipeline plumbing for that feature. Change-Id: I24af1d498dbc75210f92f8c61b10aa31eec022f6 Reviewed-on: https://skia-review.googlesource.com/138986 Reviewed-by: Mike Klein Commit-Queue: Brian Osman --- src/image/SkImage_Gpu.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src/image') diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 8a7a789ec9..1a89ba42ae 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -230,29 +230,8 @@ bool SkImage_Gpu::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size flags = GrContextPriv::kUnpremul_PixelOpsFlag; } - // This hack allows us to call makeNonTextureImage on images with arbitrary color spaces. - // Otherwise, we'll be unable to create a render target context. - // TODO: This shouldn't be necessary - we need more robust support for images (and surfaces) - // with arbitrary color spaces. Unfortunately, this is one spot where we go from image to - // surface (rather than the opposite), and our lenient image rules break our (currently) more - // strict surface rules. - // GrSurfaceContext::readPixels does not make use of the context's color space. However, we - // don't allow creating a surface context for a sRGB GrPixelConfig unless the color space has - // sRGB gamma. So we choose null for non-SRGB GrPixelConfigs and sRGB for sRGB GrPixelConfigs. - sk_sp surfaceColorSpace = fColorSpace; - if (!flags) { - if (!dstInfo.colorSpace() || - SkColorSpace::Equals(fColorSpace.get(), dstInfo.colorSpace())) { - if (GrPixelConfigIsSRGB(fProxy->config())) { - surfaceColorSpace = SkColorSpace::MakeSRGB(); - } else { - surfaceColorSpace = nullptr; - } - } - } - sk_sp sContext = fContext->contextPriv().makeWrappedSurfaceContext( - fProxy, surfaceColorSpace); + fProxy, fColorSpace); if (!sContext) { return false; } -- cgit v1.2.3