| 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_;
|
| }
|
|
|
|
|