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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 void EnableHighDPISupport() { | 165 void EnableHighDPISupport() { |
166 if (IsHighDPIEnabled() && | 166 if (IsHighDPIEnabled() && |
167 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { | 167 !SetProcessDpiAwarenessWrapper(PROCESS_SYSTEM_DPI_AWARE)) { |
168 SetProcessDPIAwareWrapper(); | 168 SetProcessDPIAwareWrapper(); |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 namespace win { | 172 namespace win { |
173 | 173 |
174 float GetDeviceScaleFactor() { | 174 float GetDeviceScaleFactor() { |
175 DCHECK_NE(0.0f, g_device_scale_factor); | |
ananta
2014/06/03 01:04:02
Removed this DCHECK as we need to call this to see
| |
176 return g_device_scale_factor; | 175 return g_device_scale_factor; |
177 } | 176 } |
178 | 177 |
179 Point ScreenToDIPPoint(const Point& pixel_point) { | 178 Point ScreenToDIPPoint(const Point& pixel_point) { |
180 return ToFlooredPoint(ScalePoint(pixel_point, | 179 return ToFlooredPoint(ScalePoint(pixel_point, |
181 1.0f / GetDeviceScaleFactor())); | 180 1.0f / GetDeviceScaleFactor())); |
182 } | 181 } |
183 | 182 |
184 Point DIPToScreenPoint(const Point& dip_point) { | 183 Point DIPToScreenPoint(const Point& dip_point) { |
185 return ToFlooredPoint(ScalePoint(dip_point, GetDeviceScaleFactor())); | 184 return ToFlooredPoint(ScalePoint(dip_point, GetDeviceScaleFactor())); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 | 240 |
242 double GetUndocumentedDPITouchScale() { | 241 double GetUndocumentedDPITouchScale() { |
243 static double scale = | 242 static double scale = |
244 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? | 243 (base::win::GetVersion() < base::win::VERSION_WIN8_1) ? |
245 GetUndocumentedDPIScale() : 1.0; | 244 GetUndocumentedDPIScale() : 1.0; |
246 return scale; | 245 return scale; |
247 } | 246 } |
248 | 247 |
249 } // namespace win | 248 } // namespace win |
250 } // namespace gfx | 249 } // namespace gfx |
OLD | NEW |