diff options
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/SkNullGLContext.h | 35 | ||||
-rw-r--r-- | src/gpu/gl/angle/SkANGLEGLContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/angle/SkANGLEGLContext.h | 47 | ||||
-rw-r--r-- | src/gpu/gl/debug/SkDebugGLContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/debug/SkDebugGLContext.h | 29 | ||||
-rw-r--r-- | src/gpu/gl/mesa/SkMesaGLContext.cpp | 2 | ||||
-rw-r--r-- | src/gpu/gl/mesa/SkMesaGLContext.h | 46 |
7 files changed, 160 insertions, 3 deletions
diff --git a/src/gpu/gl/SkNullGLContext.h b/src/gpu/gl/SkNullGLContext.h new file mode 100644 index 0000000000..92ac11aeec --- /dev/null +++ b/src/gpu/gl/SkNullGLContext.h @@ -0,0 +1,35 @@ + +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkNullGLContext_DEFINED +#define SkNullGLContext_DEFINED + +#include "gl/SkGLContext.h" + +class SK_API SkNullGLContext : public SkGLContext { +public: + virtual ~SkNullGLContext() SK_OVERRIDE; + virtual void makeCurrent() const SK_OVERRIDE {}; + virtual void swapBuffers() const SK_OVERRIDE {}; + + static SkNullGLContext* Create(GrGLStandard forcedGpuAPI) { + if (kGLES_GrGLStandard == forcedGpuAPI) { + return NULL; + } + SkNullGLContext* ctx = SkNEW(SkNullGLContext); + if (!ctx->isValid()) { + SkDELETE(ctx); + return NULL; + } + return ctx; + } + +private: + SkNullGLContext(); +}; + +#endif diff --git a/src/gpu/gl/angle/SkANGLEGLContext.cpp b/src/gpu/gl/angle/SkANGLEGLContext.cpp index 232c866423..2cff750fa0 100644 --- a/src/gpu/gl/angle/SkANGLEGLContext.cpp +++ b/src/gpu/gl/angle/SkANGLEGLContext.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "gl/SkANGLEGLContext.h" +#include "gl/angle/SkANGLEGLContext.h" SkANGLEGLContext::SkANGLEGLContext() : fContext(EGL_NO_CONTEXT) diff --git a/src/gpu/gl/angle/SkANGLEGLContext.h b/src/gpu/gl/angle/SkANGLEGLContext.h new file mode 100644 index 0000000000..dec3f9f2a7 --- /dev/null +++ b/src/gpu/gl/angle/SkANGLEGLContext.h @@ -0,0 +1,47 @@ + +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkANGLEGLContext_DEFINED +#define SkANGLEGLContext_DEFINED + +#if SK_ANGLE + +#include "gl/SkGLContext.h" + +#include <GLES2/gl2.h> +#include <EGL/egl.h> + +class SkANGLEGLContext : public SkGLContext { +public: + virtual ~SkANGLEGLContext() SK_OVERRIDE; + virtual void makeCurrent() const SK_OVERRIDE; + virtual void swapBuffers() const SK_OVERRIDE; + + static SkANGLEGLContext* Create(GrGLStandard forcedGpuAPI) { + if (kGL_GrGLStandard == forcedGpuAPI) { + return NULL; + } + SkANGLEGLContext* ctx = SkNEW(SkANGLEGLContext); + if (!ctx->isValid()) { + SkDELETE(ctx); + return NULL; + } + return ctx; + } + +private: + SkANGLEGLContext(); + void destroyGLContext(); + + EGLContext fContext; + EGLDisplay fDisplay; + EGLSurface fSurface; +}; + +#endif + +#endif diff --git a/src/gpu/gl/debug/SkDebugGLContext.cpp b/src/gpu/gl/debug/SkDebugGLContext.cpp index c021c7a7a8..ae55104d46 100644 --- a/src/gpu/gl/debug/SkDebugGLContext.cpp +++ b/src/gpu/gl/debug/SkDebugGLContext.cpp @@ -6,7 +6,7 @@ * found in the LICENSE file. */ -#include "gl/SkDebugGLContext.h" +#include "gl/debug/SkDebugGLContext.h" SkDebugGLContext::SkDebugGLContext() { fGL.reset(GrGLCreateDebugInterface()); diff --git a/src/gpu/gl/debug/SkDebugGLContext.h b/src/gpu/gl/debug/SkDebugGLContext.h new file mode 100644 index 0000000000..7dca67f320 --- /dev/null +++ b/src/gpu/gl/debug/SkDebugGLContext.h @@ -0,0 +1,29 @@ + +/* + * Copyright 2012 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkDebugGLContext_DEFINED +#define SkDebugGLContext_DEFINED + +#include "gl/SkGLContext.h" + +class SkDebugGLContext : public SkGLContext { +public: + virtual ~SkDebugGLContext() SK_OVERRIDE; + virtual void makeCurrent() const SK_OVERRIDE {} + virtual void swapBuffers() const SK_OVERRIDE {} + + static SkDebugGLContext* Create(GrGLStandard forcedGpuAPI) { + if (kGLES_GrGLStandard == forcedGpuAPI) { + return NULL; + } + return SkNEW(SkDebugGLContext); + } +private: + SkDebugGLContext(); +}; + +#endif diff --git a/src/gpu/gl/mesa/SkMesaGLContext.cpp b/src/gpu/gl/mesa/SkMesaGLContext.cpp index 3c5cc971a2..1fac5fadd6 100644 --- a/src/gpu/gl/mesa/SkMesaGLContext.cpp +++ b/src/gpu/gl/mesa/SkMesaGLContext.cpp @@ -8,7 +8,7 @@ #include <GL/osmesa.h> -#include "gl/SkMesaGLContext.h" +#include "gl/mesa/SkMesaGLContext.h" #include "gl/GrGLDefines.h" static const GrGLint gBOGUS_SIZE = 16; diff --git a/src/gpu/gl/mesa/SkMesaGLContext.h b/src/gpu/gl/mesa/SkMesaGLContext.h new file mode 100644 index 0000000000..0fc5162319 --- /dev/null +++ b/src/gpu/gl/mesa/SkMesaGLContext.h @@ -0,0 +1,46 @@ + +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef SkMesaGLContext_DEFINED +#define SkMesaGLContext_DEFINED + +#include "gl/SkGLContext.h" + +#if SK_MESA + +class SkMesaGLContext : public SkGLContext { +private: + typedef intptr_t Context; + +public: + virtual ~SkMesaGLContext() SK_OVERRIDE; + virtual void makeCurrent() const SK_OVERRIDE; + virtual void swapBuffers() const SK_OVERRIDE; + + static SkMesaGLContext* Create(GrGLStandard forcedGpuAPI) { + if (kGLES_GrGLStandard == forcedGpuAPI) { + return NULL; + } + SkMesaGLContext* ctx = SkNEW(SkMesaGLContext); + if (!ctx->isValid()) { + SkDELETE(ctx); + return NULL; + } + return ctx; + } + +private: + SkMesaGLContext(); + void destroyGLContext(); + + Context fContext; + GrGLubyte *fImage; +}; + +#endif + +#endif |