Index: src/gpu/GrDrawingManager.cpp |
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp |
index f4d00dcd3eb27d2ef13c38bd18962df9e3e34569..df6bffdaa005926b70770ab0e3ef8a7a6f62d0ed 100644 |
--- a/src/gpu/GrDrawingManager.cpp |
+++ b/src/gpu/GrDrawingManager.cpp |
@@ -11,6 +11,7 @@ |
#include "GrPathRenderingDrawContext.h" |
#include "GrResourceProvider.h" |
#include "GrSoftwarePathRenderer.h" |
+#include "SkSurface_Gpu.h" |
#include "SkTTopoSort.h" |
#include "instanced/InstancedRendering.h" |
@@ -191,6 +192,12 @@ sk_sp<GrDrawContext> GrDrawingManager::makeDrawContext(sk_sp<GrRenderTarget> rt, |
return nullptr; |
} |
+ // SkSurface catches bad color space usage at creation. This check handles anything that slips |
+ // by, including internal usage. We allow a null color space here, for read/write pixels and |
+ // other special code paths. If a color space is provided, though, enforce all other rules. |
+ if (colorSpace && !SkSurface_Gpu::Valid(fContext, rt->config(), colorSpace.get())) { |
+ return nullptr; |
+ } |
bool useDIF = false; |
if (surfaceProps) { |