Revert of Lots of progress switching to SkColorSpace rather than SkColorProfileType (patchset #10 id:180001 of https://codereview.chromium.org/2069173002/ )
Reason for revert:
Mac crashes in GrUploadPixmapToTexture
Original issue's description:
> Lots of progress on switching to SkColorSpace rather than SkColorProfileType
>
> Fixed a bunch of code in Ganesh, as well as usage of SkColorProfileType in most of our tools (DM, SampleApp, Viewer, nanobench, skiaserve, HelloWorld).
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2069173002
>
> Committed: https://skia.googlesource.com/skia/+/6a61a875467646f8dbc37cfecf49e12d1f475170
TBR=reed@google.com,herb@google.com,msarett@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/2072813002
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 45100f09..c2e2841 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -243,7 +243,7 @@
GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(pixmap.info(), *caps);
if (caps->srgbSupport() && !GrPixelConfigIsSRGB(desc.fConfig) &&
- pixmap.info().colorSpace() && pixmap.info().colorSpace()->gammaCloseToSRGB()) {
+ kSRGB_SkColorProfileType == pixmap.info().profileType()) {
// We were supplied sRGB as the profile type, but we don't have a suitable pixel config.
// Convert to 8888 sRGB so we can handle the data correctly. The raster backend doesn't
// handle sRGB Index8 -> sRGB 8888 correctly (yet), so lie about both the source and
@@ -418,7 +418,7 @@
// alphatype is ignore for now, but if GrPixelConfig is expanded to encompass
// alpha info, that will be considered.
-GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, const SkColorSpace* cs,
+GrPixelConfig SkImageInfo2GrPixelConfig(SkColorType ct, SkAlphaType, SkColorProfileType pt,
const GrCaps& caps) {
// We intentionally ignore profile type for non-8888 formats. Anything we can't support
// in hardware will be expanded to sRGB 8888 in GrUploadPixmapToTexture.
@@ -432,10 +432,10 @@
case kARGB_4444_SkColorType:
return kRGBA_4444_GrPixelConfig;
case kRGBA_8888_SkColorType:
- return (caps.srgbSupport() && cs && cs->gammaCloseToSRGB())
+ return (kSRGB_SkColorProfileType == pt && caps.srgbSupport())
? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig;
case kBGRA_8888_SkColorType:
- return (caps.srgbSupport() && cs && cs->gammaCloseToSRGB())
+ return (kSRGB_SkColorProfileType == pt && caps.srgbSupport())
? kSBGRA_8888_GrPixelConfig : kBGRA_8888_GrPixelConfig;
case kIndex_8_SkColorType:
return kIndex_8_GrPixelConfig;