| Index: app/gfx/gl/gl_context_egl.h
|
| ===================================================================
|
| --- app/gfx/gl/gl_context_egl.h (revision 71275)
|
| +++ app/gfx/gl/gl_context_egl.h (working copy)
|
| @@ -6,8 +6,9 @@
|
| #define APP_GFX_GL_GL_CONTEXT_EGL_H_
|
| #pragma once
|
|
|
| +#include "app/gfx/gl/gl_context.h"
|
| +#include "base/ref_counted.h"
|
| #include "gfx/size.h"
|
| -#include "app/gfx/gl/gl_context.h"
|
|
|
| typedef void* EGLDisplay;
|
| typedef void* EGLContext;
|
| @@ -15,6 +16,20 @@
|
|
|
| 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();
|
| +
|
| + 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 {
|
| @@ -27,7 +42,7 @@
|
| static EGLDisplay GetDisplay();
|
|
|
| // Get the associated EGL surface.
|
| - virtual EGLSurface GetSurface() = 0;
|
| + virtual SharedEGLSurface* GetSurface() = 0;
|
|
|
| // Implement GLContext.
|
| virtual std::string GetExtensions();
|
| @@ -56,20 +71,21 @@
|
| virtual void SetSwapInterval(int interval);
|
|
|
| // Implement BaseEGLContext.
|
| - virtual EGLSurface GetSurface();
|
| + virtual SharedEGLSurface* GetSurface();
|
|
|
| private:
|
| void* window_;
|
| - EGLSurface surface_;
|
| + 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 and will render to it. The caller
|
| -// must bind an FBO to prevent this. Not using pbuffers because ANGLE does not
|
| -// support them.
|
| +// 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();
|
| @@ -89,12 +105,10 @@
|
| virtual void SetSwapInterval(int interval);
|
|
|
| // Implement BaseEGLContext.
|
| - virtual EGLSurface GetSurface();
|
| + virtual SharedEGLSurface* GetSurface();
|
|
|
| private:
|
| - // All offscreen
|
| - EGLSurface surface_;
|
| - bool own_surface_;
|
| + scoped_refptr<SharedEGLSurface> surface_;
|
| EGLContext context_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SecondaryEGLContext);
|
|
|