aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/gpu/gl
diff options
context:
space:
mode:
Diffstat (limited to 'include/gpu/gl')
-rw-r--r--include/gpu/gl/GrGLInterface.h9
-rw-r--r--include/gpu/gl/SkANGLEGLContext.h49
2 files changed, 58 insertions, 0 deletions
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index 0ff30344cd..a9e722b8d4 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -96,10 +96,19 @@ const GrGLInterface* GrGLDefaultInterface();
*/
const GrGLInterface* GrGLCreateNativeInterface();
+#if SK_MESA
/**
* Creates a GrGLInterface for an OSMesa context.
*/
const GrGLInterface* GrGLCreateMesaInterface();
+#endif
+
+#if SK_ANGLE
+/**
+ * Creates a GrGLInterface for an ANGLE context.
+ */
+const GrGLInterface* GrGLCreateANGLEInterface();
+#endif
/**
* Creates a null GrGLInterface that doesn't draw anything. Used for measuring
diff --git a/include/gpu/gl/SkANGLEGLContext.h b/include/gpu/gl/SkANGLEGLContext.h
new file mode 100644
index 0000000000..10954c1c1a
--- /dev/null
+++ b/include/gpu/gl/SkANGLEGLContext.h
@@ -0,0 +1,49 @@
+
+/*
+ * 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 "SkGLContext.h"
+
+#include <GLES2/gl2.h>
+#include <EGL/egl.h>
+
+class SkANGLEGLContext : public SkGLContext {
+public:
+ SkANGLEGLContext();
+
+ virtual ~SkANGLEGLContext();
+
+ virtual void makeCurrent() const SK_OVERRIDE;
+
+ class AutoContextRestore {
+ public:
+ AutoContextRestore();
+ ~AutoContextRestore();
+
+ private:
+ angle::EGLContext fOldEGLContext;
+ angle::EGLDisplay fOldDisplay;
+ angle::EGLSurface fOldSurface;
+ };
+
+protected:
+ virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
+ virtual void destroyGLContext() SK_OVERRIDE;
+
+private:
+ angle::EGLContext fContext;
+ angle::EGLDisplay fDisplay;
+ angle::EGLSurface fSurface;
+};
+
+#endif
+
+#endif