[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ui / gl / gl_context_osmesa.h
blob597e0143683a13d688d153a2c0ebfc35aa283e6f
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.
5 #ifndef UI_GL_GL_CONTEXT_OSMESA_H_
6 #define UI_GL_GL_CONTEXT_OSMESA_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "ui/gl/gl_context.h"
12 typedef struct osmesa_context* OSMesaContext;
14 namespace gfx {
16 class GLShareGroup;
17 class GLSurface;
19 // Encapsulates an OSMesa OpenGL context that uses software rendering.
20 class GLContextOSMesa : public GLContextReal {
21 public:
22 explicit GLContextOSMesa(GLShareGroup* share_group);
24 // Implement GLContext.
25 bool Initialize(GLSurface* compatible_surface,
26 GpuPreference gpu_preference) override;
27 bool MakeCurrent(GLSurface* surface) override;
28 void ReleaseCurrent(GLSurface* surface) override;
29 bool IsCurrent(GLSurface* surface) override;
30 void* GetHandle() override;
31 void OnSetSwapInterval(int interval) override;
33 protected:
34 ~GLContextOSMesa() override;
36 private:
37 void Destroy();
39 OSMesaContext context_;
40 bool is_released_;
42 DISALLOW_COPY_AND_ASSIGN(GLContextOSMesa);
45 } // namespace gfx
47 #endif // UI_GL_GL_CONTEXT_OSMESA_H_