Index: tools/gpu/gl/null/NullGLContext.cpp |
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/tools/gpu/gl/null/NullGLContext.cpp |
similarity index 96% |
copy from src/gpu/gl/GrGLCreateNullInterface.cpp |
copy to tools/gpu/gl/null/NullGLContext.cpp |
index b9a29fb7421d3a117f3768d0a84b6ea613ae454a..4781c90e4f1b201f5326db19ec693d989c554067 100644 |
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp |
+++ b/tools/gpu/gl/null/NullGLContext.cpp |
@@ -1,3 +1,4 @@ |
+ |
/* |
* Copyright 2011 Google Inc. |
* |
@@ -5,14 +6,14 @@ |
* found in the LICENSE file. |
*/ |
- |
+#include "NullGLContext.h" |
+#include "gl/GrGLTestInterface.h" |
+#include "gl/GrGLDefines.h" |
#include "gl/GrGLInterface.h" |
-#include "GrGLTestInterface.h" |
+#include "gl/GrGLTypes.h" |
#include "SkMutex.h" |
#include "SkTDArray.h" |
-// added to suppress 'no previous prototype' warning and because this code is duplicated in |
-// SkNullGLContext.cpp |
namespace { |
class BufferObj { |
@@ -114,7 +115,6 @@ public: |
, fCurrElementArrayBuffer(0) |
, fCurrPixelPackBuffer(0) |
, fCurrPixelUnpackBuffer(0) |
- , fCurrProgramID(0) |
, fCurrShaderID(0) |
, fCurrGenericID(0) |
, fCurrUniformLocation(0) { |
@@ -185,7 +185,7 @@ public: |
} |
} |
- // deleting a bound buffer has the side effect of binding 0 |
+ // deleting a bound buffer has the side effect of binding 0 |
GrGLvoid deleteBuffers(GrGLsizei n, const GrGLuint* ids) override { |
for (int i = 0; i < n; ++i) { |
if (ids[i] == fCurrArrayBuffer) { |
@@ -605,6 +605,26 @@ const char* NullInterface::kExtensions[] = { |
nullptr, // signifies the end of the array. |
}; |
+class NullGLContext : public sk_gpu_test::GLContext { |
+public: |
+ NullGLContext() { this->init(new NullInterface); } |
+ ~NullGLContext() override { this->teardown(); } |
+ |
+private: |
+ void onPlatformMakeCurrent() const override {}; |
+ void onPlatformSwapBuffers() const override {} |
+ GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; } |
+}; |
} // anonymous namespace |
-const GrGLInterface* GrGLCreateNullInterface() { return new NullInterface; } |
+namespace sk_gpu_test { |
+GLContext* CreateNullGLContext() { |
+ GLContext* ctx = new NullGLContext(); |
+ if (ctx->isValid()) { |
+ return ctx; |
+ } |
+ delete ctx; |
+ return nullptr; |
+} |
+} // namespace sk_gpu_test |
+ |