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. | 25 // Initialize an EGL context. |
31 bool Initialize(GLContext* shared_context); | 26 bool Initialize(GLContext* shared_context); |
32 | 27 |
33 // Implement GLContext. | 28 // Implement GLContext. |
34 virtual void Destroy(); | 29 virtual void Destroy(); |
35 virtual bool MakeCurrent(); | 30 virtual bool MakeCurrent(GLSurface* surface); |
36 virtual void ReleaseCurrent(); | 31 virtual void ReleaseCurrent(GLSurface* surface); |
37 virtual bool IsCurrent(); | 32 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(); | 33 virtual void* GetHandle(); |
43 virtual void SetSwapInterval(int interval); | 34 virtual void SetSwapInterval(int interval); |
44 virtual std::string GetExtensions(); | 35 virtual std::string GetExtensions(); |
45 | 36 |
46 private: | 37 private: |
47 scoped_ptr<GLSurfaceEGL> surface_; | |
48 EGLContext context_; | 38 EGLContext context_; |
49 | 39 |
50 DISALLOW_COPY_AND_ASSIGN(GLContextEGL); | 40 DISALLOW_COPY_AND_ASSIGN(GLContextEGL); |
51 }; | 41 }; |
52 | 42 |
53 } // namespace gfx | 43 } // namespace gfx |
54 | 44 |
55 #endif // UI_GFX_GL_GL_CONTEXT_EGL_H_ | 45 #endif // UI_GFX_GL_GL_CONTEXT_EGL_H_ |
OLD | NEW |