blob: 35e94d2ab93d9e1338a8a8036dba2f15fd1d3b09 [file] [log] [blame]
bsalomon@google.com74913722011-10-27 20:44:19 +00001
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#ifndef SkNullGLContext_DEFINED
9#define SkNullGLContext_DEFINED
10
kkinnunen9e61bb72014-10-09 05:24:15 -070011#include "SkGLContext.h"
bsalomon@google.com74913722011-10-27 20:44:19 +000012
kkinnunen9e61bb72014-10-09 05:24:15 -070013class SK_API SkNullGLContext : public SkGLContext {
bsalomon@google.com74913722011-10-27 20:44:19 +000014public:
kkinnunen30bc88c2014-10-15 23:03:54 -070015 virtual ~SkNullGLContext() SK_OVERRIDE;
bsalomon@google.com74913722011-10-27 20:44:19 +000016 virtual void makeCurrent() const SK_OVERRIDE {};
djsollen@google.comc9542ca2013-10-09 18:25:38 +000017 virtual void swapBuffers() const SK_OVERRIDE {};
18
kkinnunen30bc88c2014-10-15 23:03:54 -070019 static SkNullGLContext* Create(GrGLStandard forcedGpuAPI) {
20 if (kGLES_GrGLStandard == forcedGpuAPI) {
21 return NULL;
22 }
23 SkNullGLContext* ctx = SkNEW(SkNullGLContext);
24 if (!ctx->isValid()) {
25 SkDELETE(ctx);
26 return NULL;
27 }
28 return ctx;
29 }
bsalomon@google.com74913722011-10-27 20:44:19 +000030
kkinnunen30bc88c2014-10-15 23:03:54 -070031private:
32 SkNullGLContext();
bsalomon@google.com74913722011-10-27 20:44:19 +000033};
34
35#endif