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

Unified Diff: dm/DMGpuSupport.h

Issue 213093004: Let DM work without a GPU. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « dm/DMGpuGMTask.cpp ('k') | dm/DMTask.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMGpuSupport.h
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
new file mode 100644
index 0000000000000000000000000000000000000000..46896b43217f91b623a494b55f437dfa510d03bf
--- /dev/null
+++ b/dm/DMGpuSupport.h
@@ -0,0 +1,60 @@
+#ifndef DMGpuSupport_DEFINED
+#define DMGpuSupport_DEFINED
+
+// Provides Ganesh to DM,
+// or if it's not available, fakes it enough so most code doesn't have to know that.
+
+#include "SkSurface.h"
+
+#if SK_SUPPORT_GPU
+
+// Ganesh is available. Yippee!
+
+# include "GrContext.h"
+# include "GrContextFactory.h"
+
+namespace DM {
+
+static const bool kGPUDisabled = false;
+
+static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory,
+ GrContextFactory::GLContextType type,
+ SkImageInfo info,
+ int samples) {
+ return SkSurface::NewRenderTarget(grFactory->get(type), info, samples);
+}
+
+} // namespace DM
+
+#else// !SK_SUPPORT_GPU
+
+// Ganesh is not available. Fake it.
+
+class GrContextFactory {
+public:
+ typedef int GLContextType;
+
+ static const GLContextType kANGLE_GLContextType = 0,
+ kDebug_GLContextType = 0,
+ kMESA_GLContextType = 0,
+ kNVPR_GLContextType = 0,
+ kNative_GLContextType = 0,
+ kNull_GLContextType = 0;
+};
+
+namespace DM {
+
+static const bool kGPUDisabled = true;
+
+static inline SkSurface* NewGpuSurface(GrContextFactory*,
+ GrContextFactory::GLContextType,
+ SkImageInfo,
+ int) {
+ return NULL;
+}
+
+} // namespace DM
+
+#endif//SK_SUPPORT_GPU
+
+#endif//DMGpuSupport_DEFINED
« no previous file with comments | « dm/DMGpuGMTask.cpp ('k') | dm/DMTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698