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(SURFACE_OSMESA_RGBA), gfx::Size(1, 1)), |
30 window_(window), | 30 window_(window), |
31 device_context_(NULL) { | 31 device_context_(NULL) { |
32 DCHECK(window); | 32 DCHECK(window); |
33 } | 33 } |
34 | 34 |
35 GLSurfaceOSMesaWin::~GLSurfaceOSMesaWin() { | 35 GLSurfaceOSMesaWin::~GLSurfaceOSMesaWin() { |
36 Destroy(); | 36 Destroy(); |
37 } | 37 } |
38 | 38 |
39 bool GLSurfaceOSMesaWin::Initialize(GLSurface::Format format) { | 39 bool GLSurfaceOSMesaWin::Initialize(GLSurfaceFormat format) { |
40 if (!GLSurfaceOSMesa::Initialize(format)) | 40 if (!GLSurfaceOSMesa::Initialize(format)) |
41 return false; | 41 return false; |
42 | 42 |
43 device_context_ = GetDC(window_); | 43 device_context_ = GetDC(window_); |
44 return true; | 44 return true; |
45 } | 45 } |
46 | 46 |
47 void GLSurfaceOSMesaWin::Destroy() { | 47 void GLSurfaceOSMesaWin::Destroy() { |
48 if (window_ && device_context_) | 48 if (window_ && device_context_) |
49 ReleaseDC(window_, device_context_); | 49 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 | 122 // browser test to become flaky if there is a race condition between GL |
123 // context destruction and window destruction. | 123 // context destruction and window destruction. |
124 StretchDIBits(device_context_, x, size.height() - y - height, width, height, | 124 StretchDIBits(device_context_, x, size.height() - y - height, width, height, |
125 x, y, width, height, GetHandle(), | 125 x, y, width, height, GetHandle(), |
126 reinterpret_cast<BITMAPINFO*>(&info), DIB_RGB_COLORS, SRCCOPY); | 126 reinterpret_cast<BITMAPINFO*>(&info), DIB_RGB_COLORS, SRCCOPY); |
127 | 127 |
128 return gfx::SwapResult::SWAP_ACK; | 128 return gfx::SwapResult::SWAP_ACK; |
129 } | 129 } |
130 | 130 |
131 } // namespace gl | 131 } // namespace gl |
OLD | NEW |