Chromium Code Reviews| Index: ui/gfx/gl/gl_context.h |
| =================================================================== |
| --- ui/gfx/gl/gl_context.h (revision 86168) |
| +++ ui/gfx/gl/gl_context.h (working copy) |
| @@ -8,9 +8,7 @@ |
| #include <string> |
| -#include "build/build_config.h" |
| -#include "ui/gfx/native_widget_types.h" |
| -#include "ui/gfx/size.h" |
| +#include "base/basictypes.h" |
| namespace gfx { |
| @@ -22,43 +20,30 @@ |
| GLContext() {} |
| virtual ~GLContext() {} |
| + // Initializes the GL context to be compatible with the given surface. The GL |
| + // context can be made with other surface's of the same type. |
| + virtual bool Initialize(GLContext* shared_context, |
| + GLSurface* compatible_surface) = 0; |
|
Alexey Marinichev
2011/05/23 18:19:12
compatible_surface is used only by linux and osmes
|
| + |
| // Destroys the GL context. |
| virtual void Destroy() = 0; |
| - // Makes the GL context current on the current thread. |
| - virtual bool MakeCurrent() = 0; |
| + // Makes the GL context and a surface current on the current thread. |
| + virtual bool MakeCurrent(GLSurface* surface) = 0; |
| - // Releases this GL context as current on the current thread. TODO(apatrick): |
| - // implement this in the other GLContexts. |
| - virtual void ReleaseCurrent(); |
| + // Releases this GL context and surface as current on the current thread. |
| + virtual void ReleaseCurrent(GLSurface* surface) = 0; |
| - // Returns true if this context is current. |
| - virtual bool IsCurrent() = 0; |
| + // Returns true if this context and surface is current. Pass a null surface |
| + // if the current surface is not important. |
| + virtual bool IsCurrent(GLSurface* surface) = 0; |
| - // Returns true if this context is offscreen. |
| - virtual bool IsOffscreen() = 0; |
| - |
| - // Swaps front and back buffers. This has no effect for off-screen |
| - // contexts. |
| - virtual bool SwapBuffers() = 0; |
| - |
| - // Get the size of the back buffer. |
| - virtual gfx::Size GetSize() = 0; |
| - |
| - // Get the surface. TODO(apatrick): remove this when contexts are split from |
| - // surfaces. |
| - virtual GLSurface* GetSurface(); |
| - |
| // Get the underlying platform specific GL context "handle". |
| virtual void* GetHandle() = 0; |
| // Set swap interval. This context must be current. |
| virtual void SetSwapInterval(int interval) = 0; |
| - // Returns the internal frame buffer object name if the context is backed by |
| - // FBO. Otherwise returns 0. |
| - virtual unsigned int GetBackingFrameBufferObject(); |
| - |
| // Returns space separated list of extensions. The context must be current. |
| virtual std::string GetExtensions(); |
| @@ -69,17 +54,11 @@ |
| // Create a GL context that is compatible with the given surface. |
| // |share_context|, if non-NULL, is a context which the |
| // internally created OpenGL context shares textures and other resources. |
| - // TODO(apatrick): For the time being, the context will take ownership of the |
| - // surface and the surface will be made the current read and draw surface |
| - // when the context is made current. |
| - static GLContext* CreateGLContext(GLSurface* compatible_surface, |
| - GLContext* shared_context); |
| + static GLContext* CreateGLContext(GLContext* shared_context, |
| + GLSurface* compatible_surface); |
| static bool LosesAllContextsOnContextLost(); |
| - protected: |
| - bool InitializeCommon(); |
| - |
| private: |
| DISALLOW_COPY_AND_ASSIGN(GLContext); |
| }; |