Index: ash/display/display_info.cc |
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc |
index 1aa0583ec7330ce9b81ce4fc9d31e84b98667a82..2283de14d35fa54463c19b118240f36843e5e77a 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; |
Jun Mukai
2014/04/09 18:16:40
usually global variables are using g_ prefix?
oshima
2014/04/10 14:22:22
variables in anonymous namespace has file scope/in
|
+ |
+} |
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. |
@@ -236,11 +246,25 @@ void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { |
} |
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_; |
} |
+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_; |
+} |
+ |
void DisplayInfo::UpdateDisplaySize() { |
size_in_pixel_ = bounds_in_native_.size(); |
if (!overscan_insets_in_dip_.empty()) { |