diff options
author | oshima <oshima@chromium.org> | 2014-09-18 11:50:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-18 18:50:52 +0000 |
commit | e175910996dbac17ee971580b651c12584e62371 (patch) | |
tree | 675bcb5ccc387e1e3e9dbe8b7958e04f2c84d7b5 /ash/display | |
parent | 9683216a28b76556b2369336e9d77a38c7907edc (diff) | |
download | chromium_src-e175910996dbac17ee971580b651c12584e62371.zip chromium_src-e175910996dbac17ee971580b651c12584e62371.tar.gz chromium_src-e175910996dbac17ee971580b651c12584e62371.tar.bz2 |
Remove "upgrading to 2x DSF for lower UI scale when 2x resoruces are available" option
BUG=None
Review URL: https://codereview.chromium.org/579053002
Cr-Commit-Position: refs/heads/master@{#295509}
Diffstat (limited to 'ash/display')
-rw-r--r-- | ash/display/display_info.cc | 22 | ||||
-rw-r--r-- | ash/display/display_info.h | 13 | ||||
-rw-r--r-- | ash/display/display_manager.cc | 2 | ||||
-rw-r--r-- | ash/display/display_manager_unittest.cc | 39 |
4 files changed, 8 insertions, 68 deletions
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc index 6a117b0..61432f6 100644 --- a/ash/display/display_info.cc +++ b/ash/display/display_info.cc @@ -23,9 +23,6 @@ namespace ash { namespace { -// TODO(oshima): This feature is obsolete. Remove this after m38. -bool allow_upgrade_to_high_dpi = false; - bool use_125_dsf_for_ui_scaling = false; // Check the content of |spec| and fill |bounds| and |device_scale_factor|. @@ -46,7 +43,7 @@ bool GetDisplayBounds( return false; } -} +} // namespace DisplayMode::DisplayMode() : refresh_rate(0.0f), @@ -86,9 +83,6 @@ DisplayInfo DisplayInfo::CreateFromSpec(const std::string& spec) { } // static -void DisplayInfo::SetAllowUpgradeToHighDPI(bool enable) { - allow_upgrade_to_high_dpi = enable; -} // static void DisplayInfo::SetUse125DSFForUIScaling(bool enable) { @@ -292,26 +286,16 @@ void DisplayInfo::SetBounds(const gfx::Rect& new_bounds_in_native) { float DisplayInfo::GetEffectiveDeviceScaleFactor() const { if (use_125_dsf_for_ui_scaling && device_scale_factor_ == 1.25f) return (configured_ui_scale_ == 0.8f) ? 1.25f : 1.0f; - - if (allow_upgrade_to_high_dpi && configured_ui_scale_ < 1.0f && - device_scale_factor_ == 1.0f) { - return 2.0f; - } else if (device_scale_factor_ == configured_ui_scale_) { + if (device_scale_factor_ == configured_ui_scale_) return 1.0f; - } return device_scale_factor_; } float DisplayInfo::GetEffectiveUIScale() const { if (use_125_dsf_for_ui_scaling && device_scale_factor_ == 1.25f) return (configured_ui_scale_ == 0.8f) ? 1.0f : configured_ui_scale_; - - 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_ == configured_ui_scale_) { + if (device_scale_factor_ == configured_ui_scale_) return 1.0f; - } return configured_ui_scale_; } diff --git a/ash/display/display_info.h b/ash/display/display_info.h index a7db7f0..5598273 100644 --- a/ash/display/display_info.h +++ b/ash/display/display_info.h @@ -89,11 +89,6 @@ class ASH_EXPORT DisplayInfo { DisplayInfo(int64 id, const std::string& name, bool has_overscan); ~DisplayInfo(); - // When this is set to true, Chrome switches High DPI when lower UI scale - // (<1.0f) is specified on 1x device to make UI sharp, e.g, upgrade 0.6 - // scale on 1x DSF to 1.2 scale on 2x DSF. - static void SetAllowUpgradeToHighDPI(bool enable); - // When this is set to true on the device whose internal display has // 1.25 dsf, Chrome uses 1.0f as a default scale factor, and uses // dsf 1.25 when UI scaling is set to 0.8f. @@ -148,10 +143,12 @@ class ASH_EXPORT DisplayInfo { // display that chrome sees. This can be different from one obtained // from dispaly or one specified by a user in following situation. // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) - // 2) Lower UI scale (< 1.0) is specified on 1.0f DSF device - // when 2x resources is available. (Returns 2.0f DSF + 1.2f UI scale - // for 1.0DSF + 0.6 UI scale). + // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device + // uses 1.0f DFS unless 0.8x UI scaling is specified. float GetEffectiveDeviceScaleFactor() const; + + // Returns the ui scale used for the device scale factor. This + // return 1.0f if the ui scale and dsf are both set to 2.0. float GetEffectiveUIScale() const; // Copy the display info except for fields that can be modified by a diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 291dddb..4cec2ea 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -25,8 +25,6 @@ #include "base/strings/utf_string_conversions.h" #include "grit/ash_strings.h" #include "ui/base/l10n/l10n_util.h" -#include "ui/base/layout.h" -#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/display.h" #include "ui/gfx/display_observer.h" #include "ui/gfx/font_render_params.h" diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 36c75f9..311c4de 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -1065,45 +1065,6 @@ TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { display_manager()->GetActiveModeForDisplayId(display_id))); } -TEST_F(DisplayManagerTest, UIScaleUpgradeToHighDPI) { - int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); - gfx::Display::SetInternalDisplayId(display_id); - UpdateDisplay("1920x1080"); - - DisplayInfo::SetAllowUpgradeToHighDPI(false); - display_manager()->SetDisplayUIScale(display_id, 1.125f); - EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); - EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - EXPECT_EQ("2160x1215", GetDisplayForId(display_id).size().ToString()); - - display_manager()->SetDisplayUIScale(display_id, 0.5f); - EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); - EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString()); - - DisplayInfo::SetAllowUpgradeToHighDPI(true); - display_manager()->SetDisplayUIScale(display_id, 1.125f); - EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); - EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - EXPECT_EQ("2160x1215", GetDisplayForId(display_id).size().ToString()); - - display_manager()->SetDisplayUIScale(display_id, 0.5f); - EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); - EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - EXPECT_EQ("960x540", GetDisplayForId(display_id).size().ToString()); - - // Upgrade only works on 1.0f DSF. - UpdateDisplay("1920x1080*2"); - display_manager()->SetDisplayUIScale(display_id, 1.125f); - EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); - EXPECT_EQ(1.125f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - EXPECT_EQ("1080x607", GetDisplayForId(display_id).size().ToString()); - - display_manager()->SetDisplayUIScale(display_id, 0.5f); - EXPECT_EQ(2.0f, GetDisplayInfoAt(0).GetEffectiveDeviceScaleFactor()); - EXPECT_EQ(0.5f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - EXPECT_EQ("480x270", GetDisplayForId(display_id).size().ToString()); -} TEST_F(DisplayManagerTest, Use125DSFRorUIScaling) { int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); |