| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // MSVC++ requires this to be set before any other includes to get M_PI. | 5 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 6 #define _USE_MATH_DEFINES | 6 #define _USE_MATH_DEFINES |
| 7 | 7 |
| 8 #include "ui/events/gestures/motion_event_aura.h" | 8 #include "ui/events/gestures/motion_event_aura.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 rotation_angle_rad -= static_cast<float>(M_PI_2); | 40 rotation_angle_rad -= static_cast<float>(M_PI_2); |
| 41 std::swap(radius_x, radius_y); | 41 std::swap(radius_x, radius_y); |
| 42 } | 42 } |
| 43 | 43 |
| 44 if (radius_x > radius_y) { | 44 if (radius_x > radius_y) { |
| 45 // The case radius_x == radius_y is omitted from here on purpose: for | 45 // The case radius_x == radius_y is omitted from here on purpose: for |
| 46 // circles, we want to pass the angle (which could be any value in such | 46 // circles, we want to pass the angle (which could be any value in such |
| 47 // cases but always seem to be set to zero) unchanged. | 47 // cases but always seem to be set to zero) unchanged. |
| 48 pointer_properties.touch_major = 2.f * radius_x; | 48 pointer_properties.touch_major = 2.f * radius_x; |
| 49 pointer_properties.touch_minor = 2.f * radius_y; | 49 pointer_properties.touch_minor = 2.f * radius_y; |
| 50 pointer_properties.orientation = rotation_angle_rad - M_PI_2; | 50 pointer_properties.touch_orientation = rotation_angle_rad - M_PI_2; |
| 51 } else { | 51 } else { |
| 52 pointer_properties.touch_major = 2.f * radius_y; | 52 pointer_properties.touch_major = 2.f * radius_y; |
| 53 pointer_properties.touch_minor = 2.f * radius_x; | 53 pointer_properties.touch_minor = 2.f * radius_x; |
| 54 pointer_properties.orientation = rotation_angle_rad; | 54 pointer_properties.touch_orientation = rotation_angle_rad; |
| 55 } | 55 } |
| 56 | 56 |
| 57 if (!pointer_properties.touch_major) { | 57 if (!pointer_properties.touch_major) { |
| 58 pointer_properties.touch_major = | 58 pointer_properties.touch_major = |
| 59 2.f * GestureConfiguration::GetInstance()->default_radius(); | 59 2.f * GestureConfiguration::GetInstance()->default_radius(); |
| 60 pointer_properties.touch_minor = | 60 pointer_properties.touch_minor = |
| 61 2.f * GestureConfiguration::GetInstance()->default_radius(); | 61 2.f * GestureConfiguration::GetInstance()->default_radius(); |
| 62 pointer_properties.orientation = 0; | 62 pointer_properties.touch_orientation = 0; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // TODO(jdduke): Plumb tool type from the platform, crbug.com/404128. | 65 // TODO(jdduke): Plumb tool type from the platform, crbug.com/404128. |
| 66 pointer_properties.tool_type = MotionEvent::TOOL_TYPE_UNKNOWN; | 66 pointer_properties.tool_type = MotionEvent::TOOL_TYPE_UNKNOWN; |
| 67 | 67 |
| 68 return pointer_properties; | 68 return pointer_properties; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace | 71 } // namespace |
| 72 | 72 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 int MotionEventAura::GetIndexFromId(int id) const { | 195 int MotionEventAura::GetIndexFromId(int id) const { |
| 196 int index = FindPointerIndexOfId(id); | 196 int index = FindPointerIndexOfId(id); |
| 197 DCHECK_GE(index, 0); | 197 DCHECK_GE(index, 0); |
| 198 DCHECK_LT(index, static_cast<int>(GetPointerCount())); | 198 DCHECK_LT(index, static_cast<int>(GetPointerCount())); |
| 199 return index; | 199 return index; |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace ui | 202 } // namespace ui |
| OLD | NEW |