OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ui/gl/gl_surface_stub.h" | 21 #include "ui/gl/gl_surface_stub.h" |
22 #include "ui/gl/gl_surface_wgl.h" | 22 #include "ui/gl/gl_surface_wgl.h" |
23 #include "ui/gl/vsync_provider_win.h" | 23 #include "ui/gl/vsync_provider_win.h" |
24 | 24 |
25 // From ANGLE's egl/eglext.h. | 25 // From ANGLE's egl/eglext.h. |
26 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) | 26 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) |
27 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ | 27 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ |
28 reinterpret_cast<EGLNativeDisplayType>(-2) | 28 reinterpret_cast<EGLNativeDisplayType>(-2) |
29 #endif | 29 #endif |
30 | 30 |
31 namespace gfx { | 31 namespace gl { |
32 | 32 |
33 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a | 33 // This OSMesa GL surface can use GDI to swap the contents of the buffer to a |
34 // view. | 34 // view. |
35 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { | 35 class NativeViewGLSurfaceOSMesa : public GLSurfaceOSMesa { |
36 public: | 36 public: |
37 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); | 37 explicit NativeViewGLSurfaceOSMesa(gfx::AcceleratedWidget window); |
38 | 38 |
39 // Implement subset of GLSurface. | 39 // Implement subset of GLSurface. |
40 bool Initialize(GLSurface::Format format) override; | 40 bool Initialize(GLSurface::Format format) override; |
41 void Destroy() override; | 41 void Destroy() override; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 new NativeViewGLSurfaceOSMesa(window)); | 203 new NativeViewGLSurfaceOSMesa(window)); |
204 if (!surface->Initialize()) | 204 if (!surface->Initialize()) |
205 return NULL; | 205 return NULL; |
206 | 206 |
207 return surface; | 207 return surface; |
208 } | 208 } |
209 case kGLImplementationEGLGLES2: { | 209 case kGLImplementationEGLGLES2: { |
210 DCHECK(window != gfx::kNullAcceleratedWidget); | 210 DCHECK(window != gfx::kNullAcceleratedWidget); |
211 scoped_refptr<NativeViewGLSurfaceEGL> surface( | 211 scoped_refptr<NativeViewGLSurfaceEGL> surface( |
212 new NativeViewGLSurfaceEGL(window)); | 212 new NativeViewGLSurfaceEGL(window)); |
213 std::unique_ptr<VSyncProvider> sync_provider; | 213 std::unique_ptr<gfx::VSyncProvider> sync_provider; |
214 sync_provider.reset(new VSyncProviderWin(window)); | 214 sync_provider.reset(new VSyncProviderWin(window)); |
215 if (!surface->Initialize(std::move(sync_provider))) | 215 if (!surface->Initialize(std::move(sync_provider))) |
216 return NULL; | 216 return NULL; |
217 | 217 |
218 return surface; | 218 return surface; |
219 } | 219 } |
220 case kGLImplementationDesktopGL: { | 220 case kGLImplementationDesktopGL: { |
221 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceWGL( | 221 scoped_refptr<GLSurface> surface(new NativeViewGLSurfaceWGL( |
222 window)); | 222 window)); |
223 if (!surface->Initialize()) | 223 if (!surface->Initialize()) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 default: | 264 default: |
265 NOTREACHED(); | 265 NOTREACHED(); |
266 return NULL; | 266 return NULL; |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 270 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
271 return GetDC(NULL); | 271 return GetDC(NULL); |
272 } | 272 } |
273 | 273 |
274 } // namespace gfx | 274 } // namespace gl |
OLD | NEW |