| 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 "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // favor the DWM value because any additional frames produced will be | 111 // favor the DWM value because any additional frames produced will be |
| 112 // discarded by the OS. If the display refresh rate is lower, however, we | 112 // discarded by the OS. If the display refresh rate is lower, however, we |
| 113 // can use that to limit the frames we produce more intelligently. | 113 // can use that to limit the frames we produce more intelligently. |
| 114 // If DWM compositing is not active we will always use the display refresh. | 114 // If DWM compositing is not active we will always use the display refresh. |
| 115 HMONITOR monitor = MonitorFromWindow(window_, MONITOR_DEFAULTTONEAREST); | 115 HMONITOR monitor = MonitorFromWindow(window_, MONITOR_DEFAULTTONEAREST); |
| 116 MONITORINFOEX monitor_info; | 116 MONITORINFOEX monitor_info; |
| 117 monitor_info.cbSize = sizeof(MONITORINFOEX); | 117 monitor_info.cbSize = sizeof(MONITORINFOEX); |
| 118 BOOL result = GetMonitorInfo(monitor, &monitor_info); | 118 BOOL result = GetMonitorInfo(monitor, &monitor_info); |
| 119 if (result) { | 119 if (result) { |
| 120 DEVMODE display_info; | 120 DEVMODE display_info; |
| 121 display_info.dmSize = sizeof(DEVMODE); |
| 122 display_info.dmDriverExtra = 0; |
| 121 result = EnumDisplaySettings(monitor_info.szDevice, ENUM_CURRENT_SETTINGS, | 123 result = EnumDisplaySettings(monitor_info.szDevice, ENUM_CURRENT_SETTINGS, |
| 122 &display_info); | 124 &display_info); |
| 123 if (result && display_info.dmDisplayFrequency > 1) { | 125 if (result && display_info.dmDisplayFrequency > 1) { |
| 124 base::TimeDelta display_interval = base::TimeDelta::FromMicroseconds( | 126 base::TimeDelta display_interval = base::TimeDelta::FromMicroseconds( |
| 125 (1.0 / static_cast<double>(display_info.dmDisplayFrequency)) * | 127 (1.0 / static_cast<double>(display_info.dmDisplayFrequency)) * |
| 126 base::Time::kMicrosecondsPerSecond); | 128 base::Time::kMicrosecondsPerSecond); |
| 127 | 129 |
| 128 if (!dwm_active || display_interval > interval) { | 130 if (!dwm_active || display_interval > interval) { |
| 129 interval = display_interval; | 131 interval = display_interval; |
| 130 } | 132 } |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 349 } |
| 348 | 350 |
| 349 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 351 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 350 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11) || | 352 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableD3D11) || |
| 351 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) | 353 CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseWarp)) |
| 352 return GetDC(NULL); | 354 return GetDC(NULL); |
| 353 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; | 355 return EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE; |
| 354 } | 356 } |
| 355 | 357 |
| 356 } // namespace gfx | 358 } // namespace gfx |
| OLD | NEW |