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

Unified Diff: ash/content/display/screen_orientation_controller_chromeos.cc

Issue 1306453003: Update AccelerometerReader to support separate iio devices (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missed tests Created 5 years, 4 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 | « no previous file | ash/content/display/screen_orientation_controller_chromeos_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/content/display/screen_orientation_controller_chromeos.cc
diff --git a/ash/content/display/screen_orientation_controller_chromeos.cc b/ash/content/display/screen_orientation_controller_chromeos.cc
index 8901032eef771c473b0e59248f283d1253d4051f..974dd651eb636925b336af7604ef8d98ceb9ecf2 100644
--- a/ash/content/display/screen_orientation_controller_chromeos.cc
+++ b/ash/content/display/screen_orientation_controller_chromeos.cc
@@ -344,7 +344,7 @@ void ScreenOrientationController::HandleScreenRotation(
// The reference vector is the angle of gravity when the device is rotated
// clockwise by 45 degrees. Computing the angle between this vector and
// gravity we can easily determine the expected display rotation.
- static const gfx::Vector3dF rotation_reference(-1.0f, -1.0f, 0.0f);
+ static const gfx::Vector3dF rotation_reference(-1.0f, 1.0f, 0.0f);
// Set the down vector to match the expected direction of gravity given the
// last configured rotation. This is used to enforce a stickiness that the
@@ -352,13 +352,13 @@ void ScreenOrientationController::HandleScreenRotation(
// when holding the device near 45 degrees.
gfx::Vector3dF down(0.0f, 0.0f, 0.0f);
if (current_rotation_ == gfx::Display::ROTATE_0)
- down.set_y(-1.0f);
+ down.set_y(1.0f);
else if (current_rotation_ == gfx::Display::ROTATE_90)
- down.set_x(-1.0f);
+ down.set_x(1.0f);
else if (current_rotation_ == gfx::Display::ROTATE_180)
- down.set_y(1.0f);
+ down.set_y(-1.0f);
else
- down.set_x(1.0f);
+ down.set_x(-1.0f);
// Don't rotate if the screen has not passed the threshold.
if (gfx::AngleBetweenVectorsInDegrees(down, lid_flattened) <
@@ -367,20 +367,21 @@ void ScreenOrientationController::HandleScreenRotation(
}
float angle = gfx::ClockwiseAngleBetweenVectorsInDegrees(
- rotation_reference, lid_flattened, gfx::Vector3dF(0.0f, 0.0f, -1.0f));
+ rotation_reference, lid_flattened, gfx::Vector3dF(0.0f, 0.0f, 1.0f));
- gfx::Display::Rotation new_rotation = gfx::Display::ROTATE_90;
+ gfx::Display::Rotation new_rotation = gfx::Display::ROTATE_270;
if (angle < 90.0f)
new_rotation = gfx::Display::ROTATE_0;
else if (angle < 180.0f)
- new_rotation = gfx::Display::ROTATE_270;
+ new_rotation = gfx::Display::ROTATE_90;
else if (angle < 270.0f)
new_rotation = gfx::Display::ROTATE_180;
if (new_rotation != current_rotation_ &&
- IsRotationAllowedInLockedState(new_rotation))
+ IsRotationAllowedInLockedState(new_rotation)) {
SetDisplayRotation(new_rotation,
gfx::Display::ROTATION_SOURCE_ACCELEROMETER);
+ }
}
void ScreenOrientationController::LoadDisplayRotationProperties() {
« no previous file with comments | « no previous file | ash/content/display/screen_orientation_controller_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698