Disallow GrColorType::kUnknown as colorType in v1::SurfaceDrawContext factory
We're being stricter in V2 wrt this. This CL is an experiment to see if this fallback is actually relied on.
Change-Id: Id19a4ef3e98ee41a94ed2817a06966b87e2ef522
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/448267
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/v1/SurfaceDrawContext.cpp b/src/gpu/v1/SurfaceDrawContext.cpp
index 9be7eee..9c56ed8 100644
--- a/src/gpu/v1/SurfaceDrawContext.cpp
+++ b/src/gpu/v1/SurfaceDrawContext.cpp
@@ -130,18 +130,15 @@
GrSurfaceOrigin origin,
const SkSurfaceProps& surfaceProps,
bool flushTimeOpsTask) {
- if (!rContext || !proxy) {
+ if (!rContext || !proxy || colorType == GrColorType::kUnknown) {
return nullptr;
}
const GrBackendFormat& format = proxy->backendFormat();
- GrSwizzle readSwizzle, writeSwizzle;
- if (colorType != GrColorType::kUnknown) {
- readSwizzle = rContext->priv().caps()->getReadSwizzle(format, colorType);
- writeSwizzle = rContext->priv().caps()->getWriteSwizzle(format, colorType);
- }
+ GrSwizzle readSwizzle = rContext->priv().caps()->getReadSwizzle(format, colorType);
+ GrSwizzle writeSwizzle = rContext->priv().caps()->getWriteSwizzle(format, colorType);
- GrSurfaceProxyView readView ( proxy, origin, readSwizzle);
+ GrSurfaceProxyView readView ( proxy, origin, readSwizzle);
GrSurfaceProxyView writeView(std::move(proxy), origin, writeSwizzle);
return std::make_unique<SurfaceDrawContext>(rContext,