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" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/gfx/gl/gl_context.h" | 12 #include "ui/gfx/gl/gl_context.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 | 14 |
15 typedef void* EGLContext; | 15 typedef void* EGLContext; |
16 | 16 |
17 namespace gfx { | 17 namespace gfx { |
18 | 18 |
19 class GLSurfaceEGL; | 19 class GLSurfaceEGL; |
20 | 20 |
21 // Encapsulates an EGL OpenGL ES context that renders to a view. | 21 // Encapsulates an EGL OpenGL ES context. |
22 class GLContextEGL : public GLContext { | 22 class GLContextEGL : public GLContext { |
23 public: | 23 public: |
24 // Takes ownership of surface. TODO(apatrick): separate notion of surface | 24 // Takes ownership of surface. TODO(apatrick): separate notion of surface |
25 // from context. | 25 // from context. |
26 explicit GLContextEGL(GLSurfaceEGL* surface); | 26 explicit GLContextEGL(GLSurfaceEGL* surface); |
27 | 27 |
28 virtual ~GLContextEGL(); | 28 virtual ~GLContextEGL(); |
29 | 29 |
30 // Initialize an EGL context. | 30 // Initialize an EGL context. |
31 bool Initialize(GLContext* shared_context); | 31 bool Initialize(GLContext* shared_context); |
32 | 32 |
33 // Implement GLContext. | 33 // Implement GLContext. |
34 virtual void Destroy(); | 34 virtual void Destroy(); |
35 virtual bool MakeCurrent(); | 35 virtual bool MakeCurrent(); |
| 36 virtual void ReleaseCurrent(); |
36 virtual bool IsCurrent(); | 37 virtual bool IsCurrent(); |
37 virtual bool IsOffscreen(); | 38 virtual bool IsOffscreen(); |
38 virtual bool SwapBuffers(); | 39 virtual bool SwapBuffers(); |
39 virtual gfx::Size GetSize(); | 40 virtual gfx::Size GetSize(); |
| 41 virtual GLSurface* GetSurface(); |
40 virtual void* GetHandle(); | 42 virtual void* GetHandle(); |
41 virtual void SetSwapInterval(int interval); | 43 virtual void SetSwapInterval(int interval); |
42 virtual std::string GetExtensions(); | 44 virtual std::string GetExtensions(); |
43 | 45 |
44 private: | 46 private: |
45 scoped_ptr<GLSurfaceEGL> surface_; | 47 scoped_ptr<GLSurfaceEGL> surface_; |
46 EGLContext context_; | 48 EGLContext context_; |
47 | 49 |
48 DISALLOW_COPY_AND_ASSIGN(GLContextEGL); | 50 DISALLOW_COPY_AND_ASSIGN(GLContextEGL); |
49 }; | 51 }; |
50 | 52 |
51 } // namespace gfx | 53 } // namespace gfx |
52 | 54 |
53 #endif // UI_GFX_GL_GL_CONTEXT_EGL_H_ | 55 #endif // UI_GFX_GL_GL_CONTEXT_EGL_H_ |
OLD | NEW |