Index: tools/gpu/gl/null/NullGLContext.cpp |
diff --git a/tools/gpu/gl/null/NullGLContext.cpp b/tools/gpu/gl/null/NullGLContext.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..331ed1090dceea656a3a79e4f3c7b13babcdeb1c |
--- /dev/null |
+++ b/tools/gpu/gl/null/NullGLContext.cpp |
@@ -0,0 +1,38 @@ |
+ |
+/* |
+ * Copyright 2016 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "NullGLContext.h" |
+#include "gl/GrGLInterface.h" |
+ |
+// TODO: Move the GrGLCreateNullInterface implementation here when Chromium is no longer using it |
+// in its implementation. |
+ |
+namespace { |
+class NullGLContext : public sk_gpu_test::GLContext { |
+public: |
+ NullGLContext() { this->init(GrGLCreateNullInterface()); } |
+ ~NullGLContext() override { this->teardown(); } |
+ |
+private: |
+ void onPlatformMakeCurrent() const override {}; |
+ void onPlatformSwapBuffers() const override {} |
+ GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; } |
+}; |
+} // anonymous namespace |
+ |
+namespace sk_gpu_test { |
+GLContext* CreateNullGLContext() { |
+ GLContext* ctx = new NullGLContext(); |
+ if (ctx->isValid()) { |
+ return ctx; |
+ } |
+ delete ctx; |
+ return nullptr; |
+} |
+} // namespace sk_gpu_test |
+ |