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

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

Issue 6839008: Split EGLContext in GLContextEGL and GLSurfaceEGL. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 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 | « ui/gfx/gl/gl.gyp ('k') | ui/gfx/gl/gl_context_egl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gl/gl_context_egl.h
===================================================================
--- ui/gfx/gl/gl_context_egl.h (revision 81471)
+++ ui/gfx/gl/gl_context_egl.h (working copy)
@@ -6,92 +6,28 @@
#define UI_GFX_GL_GL_CONTEXT_EGL_H_
#pragma once
-#include "base/memory/ref_counted.h"
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
#include "ui/gfx/gl/gl_context.h"
#include "ui/gfx/size.h"
-typedef void* EGLDisplay;
typedef void* EGLContext;
-typedef void* EGLSurface;
namespace gfx {
-// Takes ownership of an EGL surface and reference counts it so it can be shared
-// by multiple EGL contexts and destroyed with the last.
-class SharedEGLSurface : public base::RefCounted<SharedEGLSurface> {
- public:
- explicit SharedEGLSurface(EGLSurface surface);
- ~SharedEGLSurface();
+class GLSurfaceEGL;
- EGLSurface egl_surface() const;
-
- private:
- EGLSurface surface_;
- DISALLOW_COPY_AND_ASSIGN(SharedEGLSurface);
-};
-
-// Interface for EGL contexts. Adds an EGL specific accessor for retreiving
-// the surface.
-class BaseEGLContext : public GLContext {
- public:
- BaseEGLContext() {}
- virtual ~BaseEGLContext() {}
-
- static bool InitializeOneOff();
-
- static EGLDisplay GetDisplay();
-
- // Get the associated EGL surface.
- virtual SharedEGLSurface* GetSurface() = 0;
-
- // Implement GLContext.
- virtual std::string GetExtensions();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(BaseEGLContext);
-};
-
// Encapsulates an EGL OpenGL ES context that renders to a view.
-class NativeViewEGLContext : public BaseEGLContext {
+class GLContextEGL : public GLContext {
public:
- explicit NativeViewEGLContext(void* window);
- virtual ~NativeViewEGLContext();
+ // Takes ownership of surface. TODO(apatrick): separate notion of surface
+ // from context.
+ explicit GLContextEGL(GLSurfaceEGL* surface);
- // Initialize an EGL context.
- bool Initialize();
+ virtual ~GLContextEGL();
- // Implement GLContext.
- virtual void Destroy();
- virtual bool MakeCurrent();
- virtual bool IsCurrent();
- virtual bool IsOffscreen();
- virtual bool SwapBuffers();
- virtual gfx::Size GetSize();
- virtual void* GetHandle();
- virtual void SetSwapInterval(int interval);
-
- // Implement BaseEGLContext.
- virtual SharedEGLSurface* GetSurface();
-
- private:
- void* window_;
- scoped_refptr<SharedEGLSurface> 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 or a pbuffer on supporting platforms
-// and will render to it. The caller must bind an FBO to prevent this.
-// TODO(apatrick): implement pbuffers in ANGLE and change this to
-// PbufferEGLContext and use it on all EGL platforms.
-class SecondaryEGLContext : public BaseEGLContext {
- public:
- SecondaryEGLContext();
- virtual ~SecondaryEGLContext();
-
- // Initialize an EGL context that shares a namespace with another.
+ // Initialize an EGL context.
bool Initialize(GLContext* shared_context);
// Implement GLContext.
@@ -103,15 +39,13 @@
virtual gfx::Size GetSize();
virtual void* GetHandle();
virtual void SetSwapInterval(int interval);
+ virtual std::string GetExtensions();
- // Implement BaseEGLContext.
- virtual SharedEGLSurface* GetSurface();
-
private:
- scoped_refptr<SharedEGLSurface> surface_;
+ scoped_ptr<GLSurfaceEGL> surface_;
EGLContext context_;
- DISALLOW_COPY_AND_ASSIGN(SecondaryEGLContext);
+ DISALLOW_COPY_AND_ASSIGN(GLContextEGL);
};
} // namespace gfx
« no previous file with comments | « ui/gfx/gl/gl.gyp ('k') | ui/gfx/gl/gl_context_egl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698