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

Unified Diff: ash/display/display_info.cc

Issue 417113012: Introduce user customization of external HighDPI mode for 4K monitor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698