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 GLSurfaceWGL
: public GLSurface
{
17 ~GLSurfaceWGL() override
;
19 // Implement GLSurface.
20 void* GetDisplay() override
;
22 static bool InitializeOneOff();
23 static HDC
GetDisplayDC();
26 DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGL
);
29 // A surface used to render to a view.
30 class NativeViewGLSurfaceWGL
: public GLSurfaceWGL
{
32 explicit NativeViewGLSurfaceWGL(gfx::AcceleratedWidget window
);
33 ~NativeViewGLSurfaceWGL() override
;
35 // Implement GLSurface.
36 bool Initialize() override
;
37 void Destroy() override
;
38 bool IsOffscreen() override
;
39 bool SwapBuffers() override
;
40 gfx::Size
GetSize() override
;
41 void* GetHandle() override
;
44 gfx::AcceleratedWidget window_
;
45 gfx::AcceleratedWidget child_window_
;
48 DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceWGL
);
52 // A surface used to render to an offscreen pbuffer.
53 class PbufferGLSurfaceWGL
: public GLSurfaceWGL
{
55 explicit PbufferGLSurfaceWGL(const gfx::Size
& size
);
56 ~PbufferGLSurfaceWGL() override
;
58 // Implement GLSurface.
59 bool Initialize() override
;
60 void Destroy() override
;
61 bool IsOffscreen() override
;
62 bool SwapBuffers() override
;
63 gfx::Size
GetSize() override
;
64 void* GetHandle() override
;
71 DISALLOW_COPY_AND_ASSIGN(PbufferGLSurfaceWGL
);
76 #endif // UI_GL_GL_SURFACE_WGL_H_