blob: e0296541ac1a200cca35499585711d332fdda901 [file] [log] [blame]
bsalomon3724e572016-03-30 18:56:19 -07001
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
bsalomon273c0f52016-03-31 10:59:06 -07009#include "NullGLTestContext.h"
bsalomon3724e572016-03-30 18:56:19 -070010#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
17namespace {
bsalomon273c0f52016-03-31 10:59:06 -070018class NullGLContext : public sk_gpu_test::GLTestContext {
bsalomon3724e572016-03-30 18:56:19 -070019public:
bsalomon2f538e92016-04-01 09:04:35 -070020 NullGLContext() { this->init(GrGLCreateNullInterface()); }
bsalomon3724e572016-03-30 18:56:19 -070021 ~NullGLContext() override { this->teardown(); }
22
23private:
24 void onPlatformMakeCurrent() const override {};
25 void onPlatformSwapBuffers() const override {}
26 GrGLFuncPtr onPlatformGetProcAddress(const char*) const override { return nullptr; }
27};
bsalomon2f538e92016-04-01 09:04:35 -070028
bsalomon3724e572016-03-30 18:56:19 -070029} // anonymous namespace
30
31namespace sk_gpu_test {
bsalomon273c0f52016-03-31 10:59:06 -070032GLTestContext* CreateNullGLTestContext() {
33 GLTestContext* ctx = new NullGLContext();
bsalomon3724e572016-03-30 18:56:19 -070034 if (ctx->isValid()) {
35 return ctx;
36 }
37 delete ctx;
38 return nullptr;
39}
40} // namespace sk_gpu_test
41