| Index: ash/display/display_info.cc
|
| diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc
|
| index 087f0a36a878b49b61310939c28083129c2f8e32..bffaf3e3516f46353667354c16ef4fca4274b5f8 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,23 @@ 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);
|
| +}
|
| +
|
| +bool DisplayMode::IsEquivalent(const DisplayMode& other) const {
|
| + const float kEpsilon = 0.0001f;
|
| + return size == other.size &&
|
| + std::abs(ui_scale - other.ui_scale) < kEpsilon &&
|
| + std::abs(device_scale_factor - other.device_scale_factor) < kEpsilon;
|
| +}
|
|
|
| // satic
|
| DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) {
|
|
|