Chromium Code Reviews| Index: ui/events/gestures/motion_event_aura.cc |
| diff --git a/ui/events/gestures/motion_event_aura.cc b/ui/events/gestures/motion_event_aura.cc |
| index 1f4d2855b2fc0cfc5d3cd32495f5586d6f6cea13..0f2aca912c0fe34e302386583967ae37cf8481ba 100644 |
| --- a/ui/events/gestures/motion_event_aura.cc |
| +++ b/ui/events/gestures/motion_event_aura.cc |
| @@ -28,11 +28,19 @@ PointerProperties GetPointerPropertiesFromTouchEvent(const TouchEvent& touch) { |
| float radius_x = touch.radius_x(); |
| float radius_y = touch.radius_y(); |
| float rotation_angle_rad = touch.rotation_angle() * M_PI / 180.f; |
| + |
| DCHECK_GE(radius_x, 0) << "Unexpected x-radius < 0"; |
| DCHECK_GE(radius_y, 0) << "Unexpected y-radius < 0"; |
| - DCHECK(0 <= rotation_angle_rad && rotation_angle_rad <= M_PI_2) |
| + DCHECK(0 <= rotation_angle_rad && rotation_angle_rad < M_PI) |
| << "Unexpected touch rotation angle"; |
| + // Make the angle acute to ease subsequent logic. The angle range effectively |
| + // changes from [0, pi) to [0, pi/2). |
|
tdresser
2015/01/20 16:40:38
Wouldn't hurt to have a test for this logic.
mustaq
2015/01/21 16:43:10
Done.
|
| + if (rotation_angle_rad >= M_PI_2) { |
| + rotation_angle_rad -= M_PI_2; |
| + std::swap(radius_x, radius_y); |
| + } |
| + |
| if (radius_x > radius_y) { |
| // The case radius_x == radius_y is omitted from here on purpose: for |
| // circles, we want to pass the angle (which could be any value in such |