Index: ash/display/display_info.cc |
diff --git a/ash/display/display_info.cc b/ash/display/display_info.cc |
index e812633bc2a6efeb0ee5f53df8422ff5a83487b8..1391217b5744921601a2270dd8a0759715e12e2b 100644 |
--- a/ash/display/display_info.cc |
+++ b/ash/display/display_info.cc |
@@ -207,7 +207,7 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec, |
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.set_rotation(rotation); |
+ display_info.SetRotation(rotation, gfx::Display::ROTATION_SOURCE_ACTIVE); |
display_info.set_configured_ui_scale(ui_scale); |
display_info.SetBounds(bounds_in_native); |
display_info.SetDisplayModes(display_modes); |
@@ -228,7 +228,6 @@ DisplayInfo DisplayInfo::CreateFromSpecWithID(const std::string& spec, |
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), |
@@ -246,7 +245,6 @@ DisplayInfo::DisplayInfo(int64 id, |
: 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), |
@@ -261,6 +259,19 @@ DisplayInfo::DisplayInfo(int64 id, |
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::Rotation( |
tdanderson
2015/04/13 22:44:46
Maybe name this GetRotation() or GetRotationForSou
jonross
2015/04/15 17:43:12
Done.
|
+ 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) { |
DCHECK(id_ == native_info.id_); |
name_ = native_info.name_; |
@@ -287,7 +298,7 @@ void DisplayInfo::Copy(const DisplayInfo& native_info) { |
else if (!native_info.overscan_insets_in_dip_.empty()) |
overscan_insets_in_dip_ = native_info.overscan_insets_in_dip_; |
- rotation_ = native_info.rotation_; |
+ rotations_ = native_info.rotations_; |
configured_ui_scale_ = native_info.configured_ui_scale_; |
color_profile_ = native_info.color_profile(); |
} |
@@ -325,8 +336,10 @@ void DisplayInfo::UpdateDisplaySize() { |
overscan_insets_in_dip_.Set(0, 0, 0, 0); |
} |
- if (rotation_ == gfx::Display::ROTATE_90 || |
- rotation_ == gfx::Display::ROTATE_270) |
+ if (rotations_[gfx::Display::ROTATION_SOURCE_ACTIVE] == |
+ gfx::Display::ROTATE_90 || |
+ rotations_[gfx::Display::ROTATION_SOURCE_ACTIVE] == |
+ 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()); |
@@ -358,7 +371,8 @@ gfx::Size DisplayInfo::GetNativeModeSize() const { |
} |
std::string DisplayInfo::ToString() const { |
- int rotation_degree = static_cast<int>(rotation_) * 90; |
+ int rotation_degree = |
+ static_cast<int>(Rotation(gfx::Display::ROTATION_SOURCE_ACTIVE)) * 90; |
return base::StringPrintf( |
"DisplayInfo[%lld] native bounds=%s, size=%s, scale=%f, " |
"overscan=%s, rotation=%d, ui-scale=%f, touchscreen=%s, " |