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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "ui/base/x/x11_util.h" | |
9 #include "ui/gfx/gl/gl_context.h" | 7 #include "ui/gfx/gl/gl_context.h" |
10 #include "ui/gfx/size.h" | |
11 | 8 |
12 namespace gfx { | 9 namespace gfx { |
13 | 10 |
14 class GLSurfaceGLX; | 11 class GLSurface; |
15 | 12 |
16 // Encapsulates a GLX OpenGL context. | 13 // Encapsulates a GLX OpenGL context. |
17 class GLContextGLX : public GLContext { | 14 class GLContextGLX : public GLContext { |
18 public: | 15 public: |
19 // Takes ownership of surface. TODO(apatrick): separate notion of surface | 16 GLContextGLX(); |
20 // from context. | |
21 explicit GLContextGLX(GLSurfaceGLX* surface); | |
22 | |
23 virtual ~GLContextGLX(); | 17 virtual ~GLContextGLX(); |
24 | 18 |
25 // Initializes the GL context. | |
26 bool Initialize(GLContext* shared_context); | |
27 | |
28 // Implement GLContext. | 19 // Implement GLContext. |
| 20 virtual bool Initialize(GLContext* shared_context, |
| 21 GLSurface* compatible_surface); |
29 virtual void Destroy(); | 22 virtual void Destroy(); |
30 virtual bool MakeCurrent(); | 23 virtual bool MakeCurrent(GLSurface* surface); |
31 virtual bool IsCurrent(); | 24 virtual void ReleaseCurrent(GLSurface* surface); |
32 virtual bool IsOffscreen(); | 25 virtual bool IsCurrent(GLSurface* surface); |
33 virtual bool SwapBuffers(); | |
34 virtual gfx::Size GetSize(); | |
35 virtual void* GetHandle(); | 26 virtual void* GetHandle(); |
36 virtual void SetSwapInterval(int interval); | 27 virtual void SetSwapInterval(int interval); |
37 virtual std::string GetExtensions(); | 28 virtual std::string GetExtensions(); |
38 | 29 |
39 private: | 30 private: |
40 scoped_ptr<GLSurfaceGLX> surface_; | |
41 void* context_; | 31 void* context_; |
42 | 32 |
43 DISALLOW_COPY_AND_ASSIGN(GLContextGLX); | 33 DISALLOW_COPY_AND_ASSIGN(GLContextGLX); |
44 }; | 34 }; |
45 | 35 |
46 } // namespace gfx | 36 } // namespace gfx |
OLD | NEW |