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_OSMESA_H_ | 5 #ifndef UI_GFX_GL_GL_CONTEXT_OSMESA_H_ |
6 #define UI_GFX_GL_GL_CONTEXT_OSMESA_H_ | 6 #define UI_GFX_GL_GL_CONTEXT_OSMESA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "ui/gfx/gl/gl_context.h" | 9 #include "ui/gfx/gl/gl_context.h" |
11 #include "ui/gfx/gl/gl_surface_osmesa.h" | |
12 #include "ui/gfx/size.h" | |
13 | 10 |
14 typedef struct osmesa_context *OSMesaContext; | 11 typedef struct osmesa_context *OSMesaContext; |
15 | 12 |
16 namespace gfx { | 13 namespace gfx { |
17 | 14 |
| 15 class GLSurface; |
| 16 |
18 // Encapsulates an OSMesa OpenGL context that uses software rendering. | 17 // Encapsulates an OSMesa OpenGL context that uses software rendering. |
19 class GLContextOSMesa : public GLContext { | 18 class GLContextOSMesa : public GLContext { |
20 public: | 19 public: |
21 explicit GLContextOSMesa(GLSurfaceOSMesa* surface); | 20 GLContextOSMesa(); |
22 virtual ~GLContextOSMesa(); | 21 virtual ~GLContextOSMesa(); |
23 | 22 |
24 // Initialize an OSMesa GL context. | |
25 bool Initialize(GLuint format, GLContext* shared_context); | |
26 | |
27 // Implement GLContext. | 23 // Implement GLContext. |
| 24 virtual bool Initialize(GLContext* shared_context, |
| 25 GLSurface* compatible_surface); |
28 virtual void Destroy(); | 26 virtual void Destroy(); |
29 virtual bool MakeCurrent(); | 27 virtual bool MakeCurrent(GLSurface* surface); |
30 virtual bool IsCurrent(); | 28 virtual void ReleaseCurrent(GLSurface* surface); |
31 virtual bool IsOffscreen(); | 29 virtual bool IsCurrent(GLSurface* surface); |
32 virtual bool SwapBuffers(); | |
33 virtual gfx::Size GetSize(); | |
34 virtual void* GetHandle(); | 30 virtual void* GetHandle(); |
35 virtual void SetSwapInterval(int interval); | 31 virtual void SetSwapInterval(int interval); |
36 | 32 |
37 private: | 33 private: |
38 scoped_ptr<GLSurfaceOSMesa> surface_; | |
39 OSMesaContext context_; | 34 OSMesaContext context_; |
40 | 35 |
41 DISALLOW_COPY_AND_ASSIGN(GLContextOSMesa); | 36 DISALLOW_COPY_AND_ASSIGN(GLContextOSMesa); |
42 }; | 37 }; |
43 | 38 |
44 } // namespace gfx | 39 } // namespace gfx |
45 | 40 |
46 #endif // UI_GFX_GL_GL_CONTEXT_OSMESA_H_ | 41 #endif // UI_GFX_GL_GL_CONTEXT_OSMESA_H_ |
OLD | NEW |