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

Unified Diff: ui/display/win/dpi.cc

Issue 2098993002: Prepare ScreenWin To Use Per-Monitor DPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clang Build Fix Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/display/win/dpi.h ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/display/win/dpi.cc
diff --git a/ui/display/win/dpi.cc b/ui/display/win/dpi.cc
index 4e8f43c6b3003bc21eac493cd4c5402fe3df9953..778d83b0d468dc2cd082e98831514f6fe6b3ddb1 100644
--- a/ui/display/win/dpi.cc
+++ b/ui/display/win/dpi.cc
@@ -38,7 +38,7 @@ gfx::Size GetDPI() {
float GetUnforcedDeviceScaleFactor() {
return g_device_scale_factor
? g_device_scale_factor
- : static_cast<float>(GetDPI().width()) / kDefaultDPI;
+ : GetScalingFactorFromDPI(GetDPI().width());
}
} // namespace
@@ -59,6 +59,10 @@ int GetDPIFromScalingFactor(float device_scaling_factor) {
return kDefaultDPI * device_scaling_factor;
}
+float GetScalingFactorFromDPI(int dpi) {
+ return static_cast<float>(dpi) / kDefaultDPI;
+}
+
int GetSystemMetricsInDIP(int metric) {
// The system metrics always reflect the system DPI, not whatever scale we've
// forced or decided to use.
« no previous file with comments | « ui/display/win/dpi.h ('k') | ui/display/win/screen_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698