Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2359)

Unified Diff: app/gfx/gl/gl_context_egl.h

Issue 2134006: Added EGL based GLContext.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/gfx/gl/gl_context.cc ('k') | app/gfx/gl/gl_context_egl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/gfx/gl/gl_context_egl.h
===================================================================
--- app/gfx/gl/gl_context_egl.h (revision 0)
+++ app/gfx/gl/gl_context_egl.h (revision 0)
@@ -0,0 +1,93 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef APP_GFX_GL_GL_CONTEXT_EGL_H_
+#define APP_GFX_GL_GL_CONTEXT_EGL_H_
+
+#include "gfx/size.h"
+#include "app/gfx/gl/gl_context.h"
+
+typedef void *EGLContext;
+typedef void* EGLSurface;
+
+namespace gfx {
+
+// Interface for EGL contexts. Adds an EGL specific accessor for retreiving
+// the surface.
+class BaseEGLContext : public GLContext {
+ public:
+ BaseEGLContext() {}
+ virtual ~BaseEGLContext() {}
+
+ // Implement GLContext.
+ virtual EGLSurface GetSurface() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BaseEGLContext);
+};
+
+// Encapsulates an EGL OpenGL ES context that renders to a view.
+class NativeViewEGLContext : public BaseEGLContext {
+ public:
+ explicit NativeViewEGLContext(void* window);
+ virtual ~NativeViewEGLContext();
+
+ // Initialize an EGL context.
+ bool Initialize();
+
+ // Implement GLContext.
+ virtual void Destroy();
+ virtual bool MakeCurrent();
+ virtual bool IsCurrent();
+ virtual bool IsOffscreen();
+ virtual void SwapBuffers();
+ virtual gfx::Size GetSize();
+ virtual void* GetHandle();
+
+ // Implement BaseEGLContext.
+ virtual EGLSurface GetSurface();
+
+ private:
+ void* window_;
+ EGLSurface surface_;
+ EGLContext context_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewEGLContext);
+};
+
+// Encapsulates an EGL OpenGL ES context intended for offscreen use. It is
+// actually associated with a native window and will render to it. The caller
+// must bind an FBO to prevent this. Not using pbuffers because ANGLE does not
+// support them.
+class SecondaryEGLContext : public BaseEGLContext {
+ public:
+ SecondaryEGLContext();
+ virtual ~SecondaryEGLContext();
+
+ // Initialize an EGL context that shares a namespace with another.
+ bool Initialize(GLContext* shared_context);
+
+ // Implement GLContext.
+ virtual void Destroy();
+ virtual bool MakeCurrent();
+ virtual bool IsCurrent();
+ virtual bool IsOffscreen();
+ virtual void SwapBuffers();
+ virtual gfx::Size GetSize();
+ virtual void* GetHandle();
+
+ // Implement BaseEGLContext.
+ virtual EGLSurface GetSurface();
+
+ private:
+ // All offscreen
+ EGLSurface surface_;
+ EGLContext context_;
+
+ DISALLOW_COPY_AND_ASSIGN(SecondaryEGLContext);
+};
+
+} // namespace gfx
+
+#endif // APP_GFX_GL_GL_CONTEXT_EGL_H_
Property changes on: app\gfx\gl\gl_context_egl.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « app/gfx/gl/gl_context.cc ('k') | app/gfx/gl/gl_context_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698