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"
13 // Base interface for WGL surfaces.
14 class GL_EXPORT GLSurfaceWGL
: public GLSurface
{
18 // Implement GLSurface.
19 void* GetDisplay() override
;
21 static bool InitializeOneOff();
22 static void InitializeOneOffForTesting();
23 static HDC
GetDisplayDC();
26 ~GLSurfaceWGL() override
;
29 DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGL
);
32 // A surface used to render to a view.
33 class NativeViewGLSurfaceWGL
: public GLSurfaceWGL
{
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
;
46 ~NativeViewGLSurfaceWGL() override
;
48 gfx::AcceleratedWidget window_
;
49 gfx::AcceleratedWidget child_window_
;
52 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceWGL
);
56 // A surface used to render to an offscreen pbuffer.
57 class PbufferGLSurfaceWGL
: public GLSurfaceWGL
{
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
;
70 ~PbufferGLSurfaceWGL() override
;
76 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceWGL
);
81 #endif // UI_GL_GL_SURFACE_WGL_H_