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

Unified Diff: ash/display/display_info.cc

Issue 1108343002: Revert of Merge Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2357
Patch Set: Created 5 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_info_unittest.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 e58b51a0e6ac4ca9663c91b404fa48253984fb88..e812633bc2a6efeb0ee5f53df8422ff5a83487b8 100644
--- a/ash/display/display_info.cc
+++ b/ash/display/display_info.cc
@@ -207,7 +207,7 @@
DisplayInfo display_info(
id, base::StringPrintf("Display-%d", static_cast<int>(id)), has_overscan);
display_info.set_device_scale_factor(device_scale_factor);
- display_info.SetRotation(rotation, gfx::Display::ROTATION_SOURCE_ACTIVE);
+ display_info.set_rotation(rotation);
display_info.set_configured_ui_scale(ui_scale);
display_info.SetBounds(bounds_in_native);
display_info.SetDisplayModes(display_modes);
@@ -228,6 +228,7 @@
DisplayInfo::DisplayInfo()
: id_(gfx::Display::kInvalidDisplayID),
has_overscan_(false),
+ rotation_(gfx::Display::ROTATE_0),
touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN),
touch_device_id_(0),
device_scale_factor_(1.0f),
@@ -245,6 +246,7 @@
: id_(id),
name_(name),
has_overscan_(has_overscan),
+ rotation_(gfx::Display::ROTATE_0),
touch_support_(gfx::Display::TOUCH_SUPPORT_UNKNOWN),
touch_device_id_(0),
device_scale_factor_(1.0f),
@@ -257,23 +259,6 @@
}
DisplayInfo::~DisplayInfo() {
-}
-
-void DisplayInfo::SetRotation(gfx::Display::Rotation rotation,
- gfx::Display::RotationSource source) {
- rotations_[source] = rotation;
- rotations_[gfx::Display::ROTATION_SOURCE_ACTIVE] = rotation;
-}
-
-gfx::Display::Rotation DisplayInfo::GetActiveRotation() const {
- return GetRotation(gfx::Display::ROTATION_SOURCE_ACTIVE);
-}
-
-gfx::Display::Rotation DisplayInfo::GetRotation(
- gfx::Display::RotationSource source) const {
- if (rotations_.find(source) == rotations_.end())
- return gfx::Display::ROTATE_0;
- return rotations_.at(source);
}
void DisplayInfo::Copy(const DisplayInfo& native_info) {
@@ -302,7 +287,7 @@
else if (!native_info.overscan_insets_in_dip_.empty())
overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_;
- rotations_ = native_info.rotations_;
+ rotation_ = native_info.rotation_;
configured_ui_scale_ = native_info.configured_ui_scale_;
color_profile_ = native_info.color_profile();
}
@@ -340,10 +325,9 @@
overscan_insets_in_dip_.Set(0, 0, 0, 0);
}
- if (GetActiveRotation() == gfx::Display::ROTATE_90 ||
- GetActiveRotation() == gfx::Display::ROTATE_270) {
+ if (rotation_ == gfx::Display::ROTATE_90 ||
+ rotation_ == gfx::Display::ROTATE_270)
size_in_pixel_.SetSize(size_in_pixel_.height(), size_in_pixel_.width());
- }
gfx::SizeF size_f(size_in_pixel_);
size_f.Scale(GetEffectiveUIScale());
size_in_pixel_ = gfx::ToFlooredSize(size_f);
@@ -374,7 +358,7 @@
}
std::string DisplayInfo::ToString() const {
- int rotation_degree = static_cast<int>(GetActiveRotation()) * 90;
+ int rotation_degree = static_cast<int>(rotation_) * 90;
return base::StringPrintf(
"DisplayInfo[%lld] native bounds=%s, size=%s, scale=%f, "
"overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s, "
« no previous file with comments | « ash/display/display_info.h ('k') | ash/display/display_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698