| 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. | 19 // Initializes the GL context. |
| 26 bool Initialize(GLContext* shared_context); | 20 bool Initialize(GLContext* shared_context); |
| 27 | 21 |
| 28 // Implement GLContext. | 22 // Implement GLContext. |
| 29 virtual void Destroy(); | 23 virtual void Destroy(); |
| 30 virtual bool MakeCurrent(); | 24 virtual bool MakeCurrent(GLSurface* surface); |
| 31 virtual bool IsCurrent(); | 25 virtual void ReleaseCurrent(GLSurface* surface); |
| 32 virtual bool IsOffscreen(); | 26 virtual bool IsCurrent(GLSurface* surface); |
| 33 virtual bool SwapBuffers(); | |
| 34 virtual gfx::Size GetSize(); | |
| 35 virtual void* GetHandle(); | 27 virtual void* GetHandle(); |
| 36 virtual void SetSwapInterval(int interval); | 28 virtual void SetSwapInterval(int interval); |
| 37 virtual std::string GetExtensions(); | 29 virtual std::string GetExtensions(); |
| 38 | 30 |
| 39 private: | 31 private: |
| 40 scoped_ptr<GLSurfaceGLX> surface_; | |
| 41 void* context_; | 32 void* context_; |
| 42 | 33 |
| 43 DISALLOW_COPY_AND_ASSIGN(GLContextGLX); | 34 DISALLOW_COPY_AND_ASSIGN(GLContextGLX); |
| 44 }; | 35 }; |
| 45 | 36 |
| 46 } // namespace gfx | 37 } // namespace gfx |
| OLD | NEW |