• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef UI_GL_GL_CONTEXT_OSMESA_H_
6 #define UI_GL_GL_CONTEXT_OSMESA_H_
7 
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/gl/gl_context.h"
11 
12 typedef struct osmesa_context* OSMesaContext;
13 
14 namespace gfx {
15 
16 class GLShareGroup;
17 class GLSurface;
18 
19 // Encapsulates an OSMesa OpenGL context that uses software rendering.
20 class GLContextOSMesa : public GLContextReal {
21  public:
22   explicit GLContextOSMesa(GLShareGroup* share_group);
23 
24   // Implement GLContext.
25   virtual bool Initialize(GLSurface* compatible_surface,
26                           GpuPreference gpu_preference) OVERRIDE;
27   virtual void Destroy() OVERRIDE;
28   virtual bool MakeCurrent(GLSurface* surface) OVERRIDE;
29   virtual void ReleaseCurrent(GLSurface* surface) OVERRIDE;
30   virtual bool IsCurrent(GLSurface* surface) OVERRIDE;
31   virtual void* GetHandle() OVERRIDE;
32   virtual void SetSwapInterval(int interval) OVERRIDE;
33 
34  protected:
35   virtual ~GLContextOSMesa();
36 
37  private:
38   OSMesaContext context_;
39 
40   DISALLOW_COPY_AND_ASSIGN(GLContextOSMesa);
41 };
42 
43 }  // namespace gfx
44 
45 #endif  // UI_GL_GL_CONTEXT_OSMESA_H_
46