Index: ash/display/display_info.cc |
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc |
index 087f0a36a878b49b61310939c28083129c2f8e32..73395dd10ccc345e185bacc84162866b559b5f36 100644 |
--- a/ash/display/display_info.cc |
+++ b/ash/display/display_info.cc |
@@ -29,7 +29,11 @@ bool allow_upgrade_to_high_dpi = false; |
} |
DisplayMode::DisplayMode() |
- : refresh_rate(0.0f), interlaced(false), native(false) {} |
+ : refresh_rate(0.0f), |
+ interlaced(false), |
+ native(false), |
+ ui_scale(1.0f), |
+ device_scale_factor(1.0f) {} |
DisplayMode::DisplayMode(const gfx::Size& size, |
float refresh_rate, |
@@ -38,7 +42,16 @@ DisplayMode::DisplayMode(const gfx::Size& size, |
: size(size), |
refresh_rate(refresh_rate), |
interlaced(interlaced), |
- native(native) {} |
+ native(native), |
+ ui_scale(1.0f), |
+ device_scale_factor(1.0f) {} |
+ |
+gfx::Size DisplayMode::GetSizeInDIP() const { |
+ gfx::SizeF size_dip(size); |
+ size_dip.Scale(ui_scale); |
+ size_dip.Scale(1.0f / device_scale_factor); |
+ return gfx::ToFlooredSize(size_dip); |
+} |
// satic |
DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) { |