summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorkelvinp <kelvinp@chromium.org>2016-02-25 16:25:17 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-26 00:27:34 +0000
commit5e2d348e7769f8b1d4ac9248ba4542472feb2354 (patch)
tree28047b892f9833eb689321933a42a37272a0a086 /remoting/host
parentd888e48bbc95627822d5fc10913e245a33e2db77 (diff)
downloadchromium_src-5e2d348e7769f8b1d4ac9248ba4542472feb2354.zip
chromium_src-5e2d348e7769f8b1d4ac9248ba4542472feb2354.tar.gz
chromium_src-5e2d348e7769f8b1d4ac9248ba4542472feb2354.tar.bz2
Respect display rotation on Chrome OS.
We need to use layer->GetTargetTransform() instead of layer->transform() as the display may be animating while we are setting the root window transform. BUG=515561 Review URL: https://codereview.chromium.org/1712343004 Cr-Commit-Position: refs/heads/master@{#377725}
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/chromeos/point_transformer.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/remoting/host/chromeos/point_transformer.cc b/remoting/host/chromeos/point_transformer.cc
index 2c8b893..43a3941 100644
--- a/remoting/host/chromeos/point_transformer.cc
+++ b/remoting/host/chromeos/point_transformer.cc
@@ -13,6 +13,8 @@ namespace remoting {
PointTransformer::PointTransformer() {
root_window_ = ash::Shell::GetPrimaryRootWindow();
root_window_->AddObserver(this);
+ // Set the initial display rotation.
+ OnWindowTransformed(root_window_);
}
PointTransformer::~PointTransformer() {
@@ -25,15 +27,16 @@ void PointTransformer::OnWindowTransformed(aura::Window* window) {
ui::Layer* layer = root_window_->layer();
float scale = ui::GetDeviceScaleFactor(layer);
- // |layer->transform()| returns a transform comprising a rotation and a
- // translation, but in DIPs, so we need to switch device pixels to
- // DIPs, apply it, then switch from DIPs back to device pixels.
- gfx::Transform rotation = layer->transform();
+ // Use GetTargetTransform() instead of transform() as the layer may be
+ // animating. GetTargetTransform() returns a transform comprising a rotation
+ // and a translation, but in DIPs, so we need to switch device pixels to DIPs,
+ // apply it, then switch from DIPs back to device pixels.
+ gfx::Transform rotation = layer->GetTargetTransform();
gfx::Transform inverse_rotation;
gfx::Transform to_device_pixels;
gfx::Transform to_dip;
- CHECK(!rotation.GetInverse(&inverse_rotation))
+ CHECK(rotation.GetInverse(&inverse_rotation))
<< "Cannot inverse the root transform." << rotation.ToString();
to_device_pixels.Scale(scale, scale);