diff options
-rw-r--r-- | dm/DM.cpp | 2 | ||||
-rw-r--r-- | include/core/SkImageInfo.h | 12 | ||||
-rw-r--r-- | samplecode/SampleApp.cpp | 2 | ||||
-rw-r--r-- | src/core/SkDraw.cpp | 2 | ||||
-rw-r--r-- | src/core/SkRasterPipelineBlitter.cpp | 2 | ||||
-rw-r--r-- | src/views/SkWindow.cpp | 4 | ||||
-rw-r--r-- | tools/flags/SkCommonFlagsConfig.cpp | 2 | ||||
-rw-r--r-- | tools/viewer/sk_app/GLWindowContext.cpp | 4 |
8 files changed, 8 insertions, 22 deletions
@@ -1143,7 +1143,7 @@ struct Task { const SkBitmap* bitmap) { bool gammaCorrect = false; if (bitmap) { - gammaCorrect = SkImageInfoIsGammaCorrect(bitmap->info()); + gammaCorrect = SkToBool(bitmap->info().colorSpace()); } JsonWriter::BitmapResult result; diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 8498f583fa..eac8c0f9cf 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -348,16 +348,4 @@ private: {} }; -/////////////////////////////////////////////////////////////////////////////// - -static inline bool SkColorAndColorSpaceAreGammaCorrect(SkColorType ct, SkColorSpace* cs) { - // Anything with a color-space attached is gamma-correct, as is F16. - // To get legacy behavior, you need to ask for non-F16, with a nullptr color space. - return (cs != nullptr) || kRGBA_F16_SkColorType == ct; -} - -static inline bool SkImageInfoIsGammaCorrect(const SkImageInfo& info) { - return SkColorAndColorSpaceAreGammaCorrect(info.colorType(), info.colorSpace()); -} - #endif diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index 6f0e95842e..6722429618 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -350,7 +350,7 @@ public: // With ten-bit output, we need to manually apply the gamma of the output device // (unless we're in non-gamma correct mode, in which case our data is already // fake-sRGB, like we're expected to put in the 10-bit buffer): - bool doGamma = (fActualColorBits == 30) && SkImageInfoIsGammaCorrect(win->info()); + bool doGamma = (fActualColorBits == 30) && win->info().colorSpace(); SkPaint gammaPaint; gammaPaint.setBlendMode(SkBlendMode::kSrc); diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index a3c2dff4ec..86dae5ccb2 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -1587,7 +1587,7 @@ private: uint32_t SkDraw::scalerContextFlags() const { uint32_t flags = SkPaint::kBoostContrast_ScalerContextFlag; - if (!SkImageInfoIsGammaCorrect(fDevice->imageInfo())) { + if (!fDevice->imageInfo().colorSpace()) { flags |= SkPaint::kFakeGamma_ScalerContextFlag; } return flags; diff --git a/src/core/SkRasterPipelineBlitter.cpp b/src/core/SkRasterPipelineBlitter.cpp index 9ad048257b..55ddbb2cee 100644 --- a/src/core/SkRasterPipelineBlitter.cpp +++ b/src/core/SkRasterPipelineBlitter.cpp @@ -107,7 +107,7 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst, uint32_t paintColor = paint.getColor(); SkColor4f color; - if (SkImageInfoIsGammaCorrect(dst.info())) { + if (dst.info().colorSpace()) { color = SkColor4f::FromColor(paintColor); } else { swizzle_rb(SkNx_cast<float>(Sk4b::Load(&paintColor)) * (1/255.0f)).store(&color); diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp index 7ae1263264..e54cfb773c 100644 --- a/src/views/SkWindow.cpp +++ b/src/views/SkWindow.cpp @@ -342,7 +342,7 @@ sk_sp<SkSurface> SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachment // so pretend that it's non-sRGB 8888: desc.fConfig = grContext->caps()->srgbSupport() && - SkImageInfoIsGammaCorrect(info()) && + info().colorSpace() && (attachmentInfo.fColorBits != 30) ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig; desc.fOrigin = kBottomLeft_GrSurfaceOrigin; @@ -353,7 +353,7 @@ sk_sp<SkSurface> SkWindow::makeGpuBackedSurface(const AttachmentInfo& attachment desc.fRenderTargetHandle = buffer; sk_sp<SkColorSpace> colorSpace = - grContext->caps()->srgbSupport() && SkImageInfoIsGammaCorrect(info()) + grContext->caps()->srgbSupport() && info().colorSpace() ? SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named) : nullptr; return SkSurface::MakeFromBackendRenderTarget(grContext, desc, colorSpace, &fSurfaceProps); } diff --git a/tools/flags/SkCommonFlagsConfig.cpp b/tools/flags/SkCommonFlagsConfig.cpp index 147f6f0c26..abd8bdb78d 100644 --- a/tools/flags/SkCommonFlagsConfig.cpp +++ b/tools/flags/SkCommonFlagsConfig.cpp @@ -185,7 +185,7 @@ SkCommandLineConfigGpu::SkCommandLineConfigGpu( if (useInstanced) { fContextOptions |= ContextOptions::kUseInstanced; } - if (SkColorAndColorSpaceAreGammaCorrect(colorType, colorSpace.get())) { + if (fColorSpace) { fContextOptions |= ContextOptions::kRequireSRGBSupport; } } diff --git a/tools/viewer/sk_app/GLWindowContext.cpp b/tools/viewer/sk_app/GLWindowContext.cpp index fff5e964d4..3b9af390fb 100644 --- a/tools/viewer/sk_app/GLWindowContext.cpp +++ b/tools/viewer/sk_app/GLWindowContext.cpp @@ -42,9 +42,7 @@ void GLWindowContext::initializeContext() { // // ... and, if we're using a 10-bit/channel FB0, it doesn't do sRGB conversion on write, // so pretend that it's non-sRGB 8888: - fPixelConfig = fContext->caps()->srgbSupport() && - SkColorAndColorSpaceAreGammaCorrect(fDisplayParams.fColorType, - fDisplayParams.fColorSpace.get()) && + fPixelConfig = fContext->caps()->srgbSupport() && fDisplayParams.fColorSpace && (fColorBits != 30) ? kSRGBA_8888_GrPixelConfig : kRGBA_8888_GrPixelConfig; } |