Add kRGBA_8888_SRGB GrColorType and remove GrSRGBEncoded.
Change-Id: Iad1c72eb81ffd9c006e39c96191fada990d9dbd6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226224
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index e032921..c543446 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -54,8 +54,18 @@
if (!backendFormat.isValid()) {
return false;
}
- *config = ctx->priv().caps()->getConfigFromBackendFormat(backendFormat,
- SkColorTypeToGrColorType(ct));
+
+ GrColorType grCT = SkColorTypeToGrColorType(ct);
+ // Until we support SRGB in the SkColorType we have to do this manual check here to make sure
+ // we use the correct GrColorType.
+ if (ctx->priv().caps()->isFormatSRGB(backendFormat)) {
+ if (grCT != GrColorType::kRGBA_8888) {
+ return false;
+ }
+ grCT = GrColorType::kRGBA_8888_SRGB;
+ }
+
+ *config = ctx->priv().caps()->getConfigFromBackendFormat(backendFormat, grCT);
return *config != kUnknown_GrPixelConfig;
}