• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright 2011 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 "NullGLTestContext.h"
10 #include "gl/GrGLTestInterface.h"
11 #include "gl/GrGLDefines.h"
12 #include "gl/GrGLInterface.h"
13 #include "gl/GrGLTypes.h"
14 #include "SkMutex.h"
15 #include "SkTDArray.h"
16 
17 namespace {
18 class NullGLContext : public sk_gpu_test::GLTestContext {
19 public:
NullGLContext(bool enableNVPR)20     NullGLContext(bool enableNVPR) { this->init(GrGLCreateNullInterface(enableNVPR)); }
~NullGLContext()21    ~NullGLContext() override { this->teardown(); }
22 
23 private:
onPlatformMakeCurrent() const24     void onPlatformMakeCurrent() const override {}
onPlatformSwapBuffers() const25     void onPlatformSwapBuffers() const override {}
onPlatformGetProcAddress(const char *) const26     GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; }
27 };
28 
29 }  // anonymous namespace
30 
31 namespace sk_gpu_test {
CreateNullGLTestContext(bool enableNVPR,GLTestContext * shareContext)32 GLTestContext* CreateNullGLTestContext(bool enableNVPR, GLTestContext* shareContext) {
33     if (shareContext) {
34         return nullptr;
35     }
36     GLTestContext* ctx = new NullGLContext(enableNVPR);
37     if (ctx->isValid()) {
38         return ctx;
39     }
40     delete ctx;
41     return nullptr;
42 }
43 }  // namespace sk_gpu_test
44 
45