OLD | NEW |
(Empty) | |
| 1 |
| 2 /* |
| 3 * Copyright 2016 Google Inc. |
| 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. |
| 7 */ |
| 8 |
| 9 #include "NullGLContext.h" |
| 10 #include "gl/GrGLInterface.h" |
| 11 |
| 12 // TODO: Move the GrGLCreateNullInterface implementation here when Chromium is n
o longer using it |
| 13 // in its implementation. |
| 14 |
| 15 namespace { |
| 16 class NullGLContext : public sk_gpu_test::GLContext { |
| 17 public: |
| 18 NullGLContext() { this->init(GrGLCreateNullInterface()); } |
| 19 ~NullGLContext() override { this->teardown(); } |
| 20 |
| 21 private: |
| 22 void onPlatformMakeCurrent() const override {}; |
| 23 void onPlatformSwapBuffers() const override {} |
| 24 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nu
llptr; } |
| 25 }; |
| 26 } // anonymous namespace |
| 27 |
| 28 namespace sk_gpu_test { |
| 29 GLContext* CreateNullGLContext() { |
| 30 GLContext* ctx = new NullGLContext(); |
| 31 if (ctx->isValid()) { |
| 32 return ctx; |
| 33 } |
| 34 delete ctx; |
| 35 return nullptr; |
| 36 } |
| 37 } // namespace sk_gpu_test |
| 38 |
OLD | NEW |