Remove SkImageInfoIsGammaCorrect, etc...
Our internal definition is (and will continue to be) that anything with
a color space is gamma correct. F16 is irrelevant (whether or not we
choose to support untagged F16). This makes these helpers less than
helpful, and lets us remove them from (public) API.
API change is just removal (of unused functions).
TBR=reed@google.com
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4228
Change-Id: Ia84a423548bfee14a3ba4a43d6d5b8c4686fb5ff
Reviewed-on: https://skia-review.googlesource.com/4228
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 71d3150..150b994 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -1143,7 +1143,7 @@
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 8498f58..eac8c0f 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -348,16 +348,4 @@
{}
};
-///////////////////////////////////////////////////////////////////////////////
-
-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 6f0e958..6722429 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -350,7 +350,7 @@
// 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 a3c2dff..86dae5c 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1587,7 +1587,7 @@
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 9ad0482..55ddbb2 100644
--- a/src/core/SkRasterPipelineBlitter.cpp
+++ b/src/core/SkRasterPipelineBlitter.cpp
@@ -107,7 +107,7 @@
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 7ae1263..e54cfb7 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -342,7 +342,7 @@
// 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 @@
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 147f6f0..abd8bdb 100644
--- a/tools/flags/SkCommonFlagsConfig.cpp
+++ b/tools/flags/SkCommonFlagsConfig.cpp
@@ -185,7 +185,7 @@
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 fff5e96..3b9af39 100644
--- a/tools/viewer/sk_app/GLWindowContext.cpp
+++ b/tools/viewer/sk_app/GLWindowContext.cpp
@@ -42,9 +42,7 @@
//
// ... 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;
}