Commit b27b4b1b authored by Daniele Castagna's avatar Daniele Castagna Committed by Commit Bot

ui: Add panel orientation to ManagedDisplayInfo

We added a panel orientation property to DisplaySnapshot
that can be used to determine the natural orientation of the
device.

This CL adds the property to ManagedDisplayInfo and propagates
it from DisplaySnapshot.

Bug: 1001369, b/139500237, b/133207693
Change-Id: I7c5d37b6c88e72cdf19a96e03d1c88027fa72805
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1758430
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695864}
parent 79b07f09
...@@ -296,6 +296,7 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo( ...@@ -296,6 +296,7 @@ ManagedDisplayInfo DisplayChangeObserver::CreateManagedDisplayInfo(
} }
new_info.set_year_of_manufacture(snapshot->year_of_manufacture()); new_info.set_year_of_manufacture(snapshot->year_of_manufacture());
new_info.set_panel_orientation(snapshot->panel_orientation());
new_info.set_sys_path(snapshot->sys_path()); new_info.set_sys_path(snapshot->sys_path());
new_info.set_native(true); new_info.set_native(true);
......
...@@ -282,6 +282,7 @@ ManagedDisplayInfo::ManagedDisplayInfo() ...@@ -282,6 +282,7 @@ ManagedDisplayInfo::ManagedDisplayInfo()
touch_support_(Display::TouchSupport::UNKNOWN), touch_support_(Display::TouchSupport::UNKNOWN),
device_scale_factor_(1.0f), device_scale_factor_(1.0f),
device_dpi_(kDpi96), device_dpi_(kDpi96),
panel_orientation_(display::PanelOrientation::kNormal),
overscan_insets_in_dip_(0, 0, 0, 0), overscan_insets_in_dip_(0, 0, 0, 0),
zoom_factor_(1.f), zoom_factor_(1.f),
refresh_rate_(60.f), refresh_rate_(60.f),
...@@ -303,6 +304,7 @@ ManagedDisplayInfo::ManagedDisplayInfo(int64_t id, ...@@ -303,6 +304,7 @@ ManagedDisplayInfo::ManagedDisplayInfo(int64_t id,
touch_support_(Display::TouchSupport::UNKNOWN), touch_support_(Display::TouchSupport::UNKNOWN),
device_scale_factor_(1.0f), device_scale_factor_(1.0f),
device_dpi_(kDpi96), device_dpi_(kDpi96),
panel_orientation_(display::PanelOrientation::kNormal),
overscan_insets_in_dip_(0, 0, 0, 0), overscan_insets_in_dip_(0, 0, 0, 0),
zoom_factor_(1.f), zoom_factor_(1.f),
refresh_rate_(60.f), refresh_rate_(60.f),
...@@ -350,6 +352,7 @@ void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) { ...@@ -350,6 +352,7 @@ void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) {
DCHECK(!native_info.bounds_in_native_.IsEmpty()); DCHECK(!native_info.bounds_in_native_.IsEmpty());
bounds_in_native_ = native_info.bounds_in_native_; bounds_in_native_ = native_info.bounds_in_native_;
device_dpi_ = native_info.device_dpi_; device_dpi_ = native_info.device_dpi_;
panel_orientation_ = native_info.panel_orientation_,
size_in_pixel_ = native_info.size_in_pixel_; size_in_pixel_ = native_info.size_in_pixel_;
is_aspect_preserving_scaling_ = native_info.is_aspect_preserving_scaling_; is_aspect_preserving_scaling_ = native_info.is_aspect_preserving_scaling_;
display_modes_ = native_info.display_modes_; display_modes_ = native_info.display_modes_;
......
...@@ -174,6 +174,13 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo { ...@@ -174,6 +174,13 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo {
float device_dpi() const { return device_dpi_; } float device_dpi() const { return device_dpi_; }
void set_device_dpi(float dpi) { device_dpi_ = dpi; } void set_device_dpi(float dpi) { device_dpi_ = dpi; }
display::PanelOrientation panel_orientation() const {
return panel_orientation_;
}
void set_panel_orientation(display::PanelOrientation panel_orientation) {
panel_orientation_ = panel_orientation;
}
// The native bounds for the display. The size of this can be // The native bounds for the display. The size of this can be
// different from the |size_in_pixel| when overscan insets are set. // different from the |size_in_pixel| when overscan insets are set.
const gfx::Rect& bounds_in_native() const { return bounds_in_native_; } const gfx::Rect& bounds_in_native() const { return bounds_in_native_; }
...@@ -309,6 +316,9 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo { ...@@ -309,6 +316,9 @@ class DISPLAY_MANAGER_EXPORT ManagedDisplayInfo {
// This specifies the device's DPI. // This specifies the device's DPI.
float device_dpi_; float device_dpi_;
// Orientation of the panel relative to natural device orientation.
display::PanelOrientation panel_orientation_;
// The size of the display in use. The size can be different from the size // The size of the display in use. The size can be different from the size
// of |bounds_in_native_| if the display has overscan insets and/or rotation. // of |bounds_in_native_| if the display has overscan insets and/or rotation.
gfx::Size size_in_pixel_; gfx::Size size_in_pixel_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment