[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ui / gl / gl_surface_wgl.h
blob26268981e67496588b6757a5fc344faa4d7f3987
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_SURFACE_WGL_H_
6 #define UI_GL_GL_SURFACE_WGL_H_
8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/gl/gl_surface.h"
11 namespace gfx {
13 // Base interface for WGL surfaces.
14 class GL_EXPORT GLSurfaceWGL : public GLSurface {
15 public:
16 GLSurfaceWGL();
18 // Implement GLSurface.
19 void* GetDisplay() override;
21 static bool InitializeOneOff();
22 static void InitializeOneOffForTesting();
23 static HDC GetDisplayDC();
25 protected:
26 ~GLSurfaceWGL() override;
28 private:
29 DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGL);
32 // A surface used to render to a view.
33 class NativeViewGLSurfaceWGL : public GLSurfaceWGL {
34 public:
35 explicit NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window);
37 // Implement GLSurface.
38 bool Initialize() override;
39 void Destroy() override;
40 bool IsOffscreen() override;
41 gfx::SwapResult SwapBuffers() override;
42 gfx::Size GetSize() override;
43 void* GetHandle() override;
45 private:
46 ~NativeViewGLSurfaceWGL() override;
48 gfx::AcceleratedWidget window_;
49 gfx::AcceleratedWidget child_window_;
50 HDC device_context_;
52 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceWGL);
56 // A surface used to render to an offscreen pbuffer.
57 class PbufferGLSurfaceWGL : public GLSurfaceWGL {
58 public:
59 explicit PbufferGLSurfaceWGL(const gfx::Size& size);
61 // Implement GLSurface.
62 bool Initialize() override;
63 void Destroy() override;
64 bool IsOffscreen() override;
65 gfx::SwapResult SwapBuffers() override;
66 gfx::Size GetSize() override;
67 void* GetHandle() override;
69 private:
70 ~PbufferGLSurfaceWGL() override;
72 gfx::Size size_;
73 HDC device_context_;
74 void* pbuffer_;
76 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceWGL);
79 } // namespace gfx
81 #endif // UI_GL_GL_SURFACE_WGL_H_