OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_osmesa_win.h" | 5 #include "ui/gl/gl_surface_osmesa_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "base/win/windows_version.h" | 13 #include "base/win/windows_version.h" |
14 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
15 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
16 #include "ui/gl/gl_surface_egl.h" | 16 #include "ui/gl/gl_surface_egl.h" |
17 #include "ui/gl/gl_surface_wgl.h" | 17 #include "ui/gl/gl_surface_wgl.h" |
18 #include "ui/gl/vsync_provider_win.h" | 18 #include "ui/gl/vsync_provider_win.h" |
19 | 19 |
20 // From ANGLE's egl/eglext.h. | 20 // From ANGLE's egl/eglext.h. |
21 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) | 21 #if !defined(EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE) |
22 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ | 22 #define EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE \ |
23 reinterpret_cast<EGLNativeDisplayType>(-2) | 23 reinterpret_cast<EGLNativeDisplayType>(-2) |
24 #endif | 24 #endif |
25 | 25 |
26 namespace gl { | 26 namespace gl { |
27 | 27 |
28 GLSurfaceOSMesaWin::GLSurfaceOSMesaWin(gfx::AcceleratedWidget window) | 28 GLSurfaceOSMesaWin::GLSurfaceOSMesaWin(gfx::AcceleratedWidget window) |
29 : GLSurfaceOSMesa(SURFACE_OSMESA_RGBA, gfx::Size(1, 1)), | 29 : GLSurfaceOSMesa(GLSurfaceFormat(GLSurfaceFormat::PIXEL_LAYOUT_RGBA), |
| 30 gfx::Size(1, 1)), |
30 window_(window), | 31 window_(window), |
31 device_context_(NULL) { | 32 device_context_(NULL) { |
32 DCHECK(window); | 33 DCHECK(window); |
33 } | 34 } |
34 | 35 |
35 GLSurfaceOSMesaWin::~GLSurfaceOSMesaWin() { | 36 GLSurfaceOSMesaWin::~GLSurfaceOSMesaWin() { |
36 Destroy(); | 37 Destroy(); |
37 } | 38 } |
38 | 39 |
39 bool GLSurfaceOSMesaWin::Initialize(GLSurface::Format format) { | 40 bool GLSurfaceOSMesaWin::Initialize(GLSurfaceFormat format) { |
40 if (!GLSurfaceOSMesa::Initialize(format)) | 41 if (!GLSurfaceOSMesa::Initialize(format)) |
41 return false; | 42 return false; |
42 | 43 |
43 device_context_ = GetDC(window_); | 44 device_context_ = GetDC(window_); |
44 return true; | 45 return true; |
45 } | 46 } |
46 | 47 |
47 void GLSurfaceOSMesaWin::Destroy() { | 48 void GLSurfaceOSMesaWin::Destroy() { |
48 if (window_ && device_context_) | 49 if (window_ && device_context_) |
49 ReleaseDC(window_, device_context_); | 50 ReleaseDC(window_, device_context_); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // browser test to become flaky if there is a race condition between GL | 123 // browser test to become flaky if there is a race condition between GL |
123 // context destruction and window destruction. | 124 // context destruction and window destruction. |
124 StretchDIBits(device_context_, x, size.height() - y - height, width, height, | 125 StretchDIBits(device_context_, x, size.height() - y - height, width, height, |
125 x, y, width, height, GetHandle(), | 126 x, y, width, height, GetHandle(), |
126 reinterpret_cast<BITMAPINFO*>(&info), DIB_RGB_COLORS, SRCCOPY); | 127 reinterpret_cast<BITMAPINFO*>(&info), DIB_RGB_COLORS, SRCCOPY); |
127 | 128 |
128 return gfx::SwapResult::SWAP_ACK; | 129 return gfx::SwapResult::SWAP_ACK; |
129 } | 130 } |
130 | 131 |
131 } // namespace gl | 132 } // namespace gl |
OLD | NEW |