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

Unified Diff: ash/display/display_info.cc

Issue 230683003: Allow upgrading to 2x DSF for lower UI scale when 2x resoruces are available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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.cc » ('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 1aa0583ec7330ce9b81ce4fc9d31e84b98667a82..315985379b16c12282da056ea476496d2f454f10 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -21,6 +21,11 @@
#endif
namespace ash {
+namespace {
+
+bool allow_upgrade_to_high_dpi = false;
+
+}
DisplayMode::DisplayMode()
: refresh_rate(0.0f), interlaced(false), native(false) {}
@@ -40,6 +45,11 @@ DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) {
}
// static
+void DisplayInfo::SetAllowUpgradeToHighDPI(bool enable) {
+ allow_upgrade_to_high_dpi = enable;
+}
+
+// static
DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec,
int64 id) {
// Default bounds for a display.
@@ -235,9 +245,23 @@ void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) {
UpdateDisplaySize();
}
+float DisplayInfo::GetEffectiveDeviceScaleFactor() const {
+ if (allow_upgrade_to_high_dpi && configured_ui_scale_ < 1.0f &&
+ device_scale_factor_ == 1.0f) {
+ return 2.0f;
+ } else if (device_scale_factor_ == 2.0f && configured_ui_scale_ == 2.0f) {
+ return 1.0f;
+ }
+ return device_scale_factor_;
+}
+
float DisplayInfo::GetEffectiveUIScale() const {
- if (device_scale_factor_ == 2.0f && configured_ui_scale_ == 2.0f)
+ if (allow_upgrade_to_high_dpi && configured_ui_scale_ < 1.0f &&
+ device_scale_factor_ == 1.0f) {
+ return configured_ui_scale_ * 2.0f;
+ } else if (device_scale_factor_ == 2.0f && configured_ui_scale_ == 2.0f) {
return 1.0f;
+ }
return configured_ui_scale_;
}
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698