Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: src/gpu/GrDrawingManager.cpp

Issue 2270823002: Some tests around surface creation and snapshotting with color space (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/image/SkSurface_Gpu.h » ('j') | tests/SurfaceTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698