| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_GFX_GL_GL_CONTEXT_EGL_H_ | 5 #ifndef UI_GFX_GL_GL_CONTEXT_EGL_H_ |
| 6 #define UI_GFX_GL_GL_CONTEXT_EGL_H_ | 6 #define UI_GFX_GL_GL_CONTEXT_EGL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "ui/gfx/gl/gl_context.h" | 11 #include "ui/gfx/gl/gl_context.h" |
| 13 #include "ui/gfx/size.h" | |
| 14 | 12 |
| 15 typedef void* EGLContext; | 13 typedef void* EGLContext; |
| 16 | 14 |
| 17 namespace gfx { | 15 namespace gfx { |
| 18 | 16 |
| 19 class GLSurfaceEGL; | 17 class GLSurface; |
| 20 | 18 |
| 21 // Encapsulates an EGL OpenGL ES context. | 19 // Encapsulates an EGL OpenGL ES context. |
| 22 class GLContextEGL : public GLContext { | 20 class GLContextEGL : public GLContext { |
| 23 public: | 21 public: |
| 24 // Takes ownership of surface. TODO(apatrick): separate notion of surface | 22 GLContextEGL(); |
| 25 // from context. | |
| 26 explicit GLContextEGL(GLSurfaceEGL* surface); | |
| 27 | |
| 28 virtual ~GLContextEGL(); | 23 virtual ~GLContextEGL(); |
| 29 | 24 |
| 30 // Initialize an EGL context. | |
| 31 bool Initialize(GLContext* shared_context); | |
| 32 | |
| 33 // Implement GLContext. | 25 // Implement GLContext. |
| 26 virtual bool Initialize(GLContext* shared_context, |
| 27 GLSurface* compatible_surface); |
| 34 virtual void Destroy(); | 28 virtual void Destroy(); |
| 35 virtual bool MakeCurrent(); | 29 virtual bool MakeCurrent(GLSurface* surface); |
| 36 virtual void ReleaseCurrent(); | 30 virtual void ReleaseCurrent(GLSurface* surface); |
| 37 virtual bool IsCurrent(); | 31 virtual bool IsCurrent(GLSurface* surface); |
| 38 virtual bool IsOffscreen(); | |
| 39 virtual bool SwapBuffers(); | |
| 40 virtual gfx::Size GetSize(); | |
| 41 virtual GLSurface* GetSurface(); | |
| 42 virtual void* GetHandle(); | 32 virtual void* GetHandle(); |
| 43 virtual void SetSwapInterval(int interval); | 33 virtual void SetSwapInterval(int interval); |
| 44 virtual std::string GetExtensions(); | 34 virtual std::string GetExtensions(); |
| 45 | 35 |
| 46 private: | 36 private: |
| 47 scoped_ptr<GLSurfaceEGL> surface_; | |
| 48 EGLContext context_; | 37 EGLContext context_; |
| 49 | 38 |
| 50 DISALLOW_COPY_AND_ASSIGN(GLContextEGL); | 39 DISALLOW_COPY_AND_ASSIGN(GLContextEGL); |
| 51 }; | 40 }; |
| 52 | 41 |
| 53 } // namespace gfx | 42 } // namespace gfx |
| 54 | 43 |
| 55 #endif // UI_GFX_GL_GL_CONTEXT_EGL_H_ | 44 #endif // UI_GFX_GL_GL_CONTEXT_EGL_H_ |
| OLD | NEW |