Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ui/display/win/dpi.h

Issue 2151413002: Add a UMA histogram for a user's device scale at startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 // Get the raw device scale value of the display, without clamping or forcing.
21 DISPLAY_EXPORT float GetUnforcedDeviceScaleFactor();
22
20 // Gets the scale factor of the display. For example, if the display DPI is 23 // Gets the scale factor of the display. For example, if the display DPI is
21 // 96 then the scale factor is 1.0. This clamps scale factors <= 1.25 to 1.0 to 24 // 96 then the scale factor is 1.0. This clamps scale factors <= 1.25 to 1.0 to
22 // maintain previous (non-DPI-aware) behavior where only the font size was 25 // maintain previous (non-DPI-aware) behavior where only the font size was
23 // boosted. 26 // boosted.
24 DISPLAY_EXPORT float GetDPIScale(); 27 DISPLAY_EXPORT float GetDPIScale();
25 28
26 // Returns the equivalent DPI for |device_scaling_factor|. 29 // Returns the equivalent DPI for |device_scaling_factor|.
27 DISPLAY_EXPORT int GetDPIFromScalingFactor(float device_scaling_factor); 30 DISPLAY_EXPORT int GetDPIFromScalingFactor(float device_scaling_factor);
28 31
29 // Returns the equivalent scaling factor for |dpi|. 32 // Returns the equivalent scaling factor for |dpi|.
30 DISPLAY_EXPORT float GetScalingFactorFromDPI(int dpi); 33 DISPLAY_EXPORT float GetScalingFactorFromDPI(int dpi);
31 34
32 // Win32's GetSystemMetrics uses pixel measures. This function calls 35 // Win32's GetSystemMetrics uses pixel measures. This function calls
33 // GetSystemMetrics for the given |metric|, then converts the result to DIP. 36 // GetSystemMetrics for the given |metric|, then converts the result to DIP.
34 DISPLAY_EXPORT int GetSystemMetricsInDIP(int metric); 37 DISPLAY_EXPORT int GetSystemMetricsInDIP(int metric);
35 38
36 } // namespace win 39 } // namespace win
37 } // namespace display 40 } // namespace display
38 41
39 #endif // UI_DISPLAY_WIN_DPI_H_ 42 #endif // UI_DISPLAY_WIN_DPI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698