Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef UI_DISPLAY_WIN_DPI_H_ | 5 #ifndef UI_DISPLAY_WIN_DPI_H_ |
| 6 #define UI_DISPLAY_WIN_DPI_H_ | 6 #define UI_DISPLAY_WIN_DPI_H_ |
| 7 | 7 |
| 8 #include "ui/display/display_export.h" | 8 #include "ui/display/display_export.h" |
| 9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
| 10 | 10 |
| 11 namespace display { | 11 namespace display { |
| 12 namespace win { | 12 namespace win { |
| 13 | 13 |
| 14 // Sets the device scale factor that will be used unless overridden on the | 14 // Sets the device scale factor that will be used unless overridden on the |
| 15 // command line by --force-device-scale-factor. If this is not called, and that | 15 // command line by --force-device-scale-factor. If this is not called, and that |
| 16 // flag is not used, the scale factor used by the DIP conversion functions below | 16 // flag is not used, the scale factor used by the DIP conversion functions below |
| 17 // will be that returned by GetDPIScale(). | 17 // will be that returned by GetDPIScale(). |
| 18 DISPLAY_EXPORT void SetDefaultDeviceScaleFactor(float scale); | 18 DISPLAY_EXPORT void SetDefaultDeviceScaleFactor(float scale); |
| 19 | 19 |
| 20 // Gets the scale factor of the display. For example, if the display DPI is | 20 // Gets the scale factor of the display. For example, if the display DPI is |
| 21 // 96 then the scale factor is 1.0. | 21 // 96 then the scale factor is 1.0. |
| 22 DISPLAY_EXPORT float GetDPIScale(); | 22 DISPLAY_EXPORT float GetDPIScale(); |
| 23 | 23 |
| 24 // Returns the equivalent DPI for |device_scaling_factor|. | 24 // Returns the equivalent DPI for |device_scaling_factor|. |
| 25 DISPLAY_EXPORT int GetDPIFromScalingFactor(float device_scaling_factor); | 25 DISPLAY_EXPORT int GetDPIFromScalingFactor(float device_scaling_factor); |
| 26 | 26 |
| 27 // Returns the equivalent scaling factor for |dpi|. | 27 // Returns the equivalent scaling factor for |dpi|. |
| 28 DISPLAY_EXPORT float GetScalingFactorFromDPI(int dpi); | 28 DISPLAY_EXPORT float GetScalingFactorFromDPI(int dpi); |
| 29 | 29 |
| 30 // Deprecated. Use display::win::ScreenWin::GetSystemMetricsForHwnd instead. | |
|
sky
2016/07/27 18:28:49
Should all of the functions in this file be deprec
robliao
2016/07/27 18:42:56
Deprecated SetDefaultDeviceScaleFactor and GetDPIS
| |
| 31 // | |
| 30 // Win32's GetSystemMetrics uses pixel measures. This function calls | 32 // Win32's GetSystemMetrics uses pixel measures. This function calls |
| 31 // GetSystemMetrics for the given |metric|, then converts the result to DIP. | 33 // GetSystemMetrics for the given |metric|, then converts the result using the |
| 34 // system's DPI to DIP. This does not handle per-monitor DPI. | |
| 32 DISPLAY_EXPORT int GetSystemMetricsInDIP(int metric); | 35 DISPLAY_EXPORT int GetSystemMetricsInDIP(int metric); |
| 33 | 36 |
| 34 } // namespace win | 37 } // namespace win |
| 35 } // namespace display | 38 } // namespace display |
| 36 | 39 |
| 37 #endif // UI_DISPLAY_WIN_DPI_H_ | 40 #endif // UI_DISPLAY_WIN_DPI_H_ |
| OLD | NEW |