| 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/gfx/win/dpi.h" | 5 #include "ui/gfx/win/dpi.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/win/scoped_hdc.h" | 9 #include "base/win/scoped_hdc.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 switches::kHighDPISupport).compare("1") == 0; | 99 switches::kHighDPISupport).compare("1") == 0; |
| 100 } | 100 } |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool IsInHighDPIMode() { | 104 bool IsInHighDPIMode() { |
| 105 return GetDPIScale() > 1.0; | 105 return GetDPIScale() > 1.0; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void EnableHighDPISupport() { | 108 void EnableHighDPISupport() { |
| 109 if (IsHighDPIEnabled()) { | 109 if (IsHighDPIEnabled() && |
| 110 (base::win::GetVersion() < base::win::VERSION_WIN8_1)) { |
| 110 typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); | 111 typedef BOOL(WINAPI *SetProcessDPIAwarePtr)(VOID); |
| 111 SetProcessDPIAwarePtr set_process_dpi_aware_func = | 112 SetProcessDPIAwarePtr set_process_dpi_aware_func = |
| 112 reinterpret_cast<SetProcessDPIAwarePtr>( | 113 reinterpret_cast<SetProcessDPIAwarePtr>( |
| 113 GetProcAddress(GetModuleHandleA("user32.dll"), | 114 GetProcAddress(GetModuleHandleA("user32.dll"), |
| 114 "SetProcessDPIAware")); | 115 "SetProcessDPIAware")); |
| 115 if (set_process_dpi_aware_func) | 116 if (set_process_dpi_aware_func) |
| 116 set_process_dpi_aware_func(); | 117 set_process_dpi_aware_func(); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 | 120 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 186 |
| 186 double GetUndocumentedDPITouchScale() { | 187 double GetUndocumentedDPITouchScale() { |
| 187 static double scale = | 188 static double scale = |
| 188 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? | 189 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? |
| 189 GetUndocumentedDPIScale() : 1.0; | 190 GetUndocumentedDPIScale() : 1.0; |
| 190 return scale; | 191 return scale; |
| 191 } | 192 } |
| 192 | 193 |
| 193 } // namespace win | 194 } // namespace win |
| 194 } // namespace gfx | 195 } // namespace gfx |
| OLD | NEW |