summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 00:54:39 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 00:54:39 +0000
commitbb54e63c4ecd10ea4379386cc2bdc540f76a6907 (patch)
tree38a28c8928c92fcd4a76ed2f57d5bf7ce1231136 /ash
parentf80e65501a99eefc4b8b7cfb6ddd28d931da1610 (diff)
downloadchromium_src-bb54e63c4ecd10ea4379386cc2bdc540f76a6907.zip
chromium_src-bb54e63c4ecd10ea4379386cc2bdc540f76a6907.tar.gz
chromium_src-bb54e63c4ecd10ea4379386cc2bdc540f76a6907.tar.bz2
Manually compute inverted matrix for screen rotation
BUG=222483 TEST=no functionality change. covered by existing unit tests. Review URL: https://codereview.chromium.org/12983010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/display/display_controller.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc
index ebc8849..feb3b2a 100644
--- a/ash/display/display_controller.cc
+++ b/ash/display/display_controller.cc
@@ -135,6 +135,12 @@ void RotateRootWindow(aura::RootWindow* root_window,
root_window->SetProperty(kRotationPropertyKey, info.rotation());
#endif
gfx::Transform rotate;
+ // TODO(oshima): Manually complute the inverse of the
+ // rotate+translate matrix to compensate for computation error in
+ // the inverted matrix. Ideally, SkMatrix should have special
+ // case handling for rotate+translate case. crbug.com/222483.
+ gfx::Transform reverse_rotate;
+
// The origin is (0, 0), so the translate width/height must be reduced by 1.
switch (info.rotation()) {
case gfx::Display::ROTATE_0:
@@ -142,18 +148,26 @@ void RotateRootWindow(aura::RootWindow* root_window,
case gfx::Display::ROTATE_90:
rotate.Translate(display.bounds().height() - 1, 0);
rotate.Rotate(90);
+ // Rotate 270 instead of 90 as it will cause calcuration error.
+ reverse_rotate.Rotate(270);
+ reverse_rotate.Translate(-(display.bounds().height() - 1), 0);
break;
case gfx::Display::ROTATE_270:
rotate.Translate(0, display.bounds().width() - 1);
rotate.Rotate(270);
+ reverse_rotate.Rotate(90);
+ reverse_rotate.Translate(0, -(display.bounds().width() - 1));
break;
case gfx::Display::ROTATE_180:
rotate.Translate(display.bounds().width() - 1,
display.bounds().height() - 1);
rotate.Rotate(180);
+ reverse_rotate.Rotate(180);
+ reverse_rotate.Translate(-(display.bounds().width() - 1),
+ -(display.bounds().height() - 1));
break;
}
- root_window->SetTransform(rotate);
+ root_window->SetTransformPair(rotate, reverse_rotate);
}
void SetDisplayPropertiesOnHostWindow(aura::RootWindow* root,