| 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 "content/browser/renderer_host/input/motion_event_web.h" | 8 #include "content/browser/renderer_host/input/motion_event_web.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return 2.f * std::max(event_.touches[pointer_index].radiusX, | 119 return 2.f * std::max(event_.touches[pointer_index].radiusX, |
| 120 event_.touches[pointer_index].radiusY); | 120 event_.touches[pointer_index].radiusY); |
| 121 } | 121 } |
| 122 | 122 |
| 123 float MotionEventWeb::GetTouchMinor(size_t pointer_index) const { | 123 float MotionEventWeb::GetTouchMinor(size_t pointer_index) const { |
| 124 DCHECK_LT(pointer_index, GetPointerCount()); | 124 DCHECK_LT(pointer_index, GetPointerCount()); |
| 125 return 2.f * std::min(event_.touches[pointer_index].radiusX, | 125 return 2.f * std::min(event_.touches[pointer_index].radiusX, |
| 126 event_.touches[pointer_index].radiusY); | 126 event_.touches[pointer_index].radiusY); |
| 127 } | 127 } |
| 128 | 128 |
| 129 float MotionEventWeb::GetOrientation(size_t pointer_index) const { | 129 float MotionEventWeb::GetTouchOrientation(size_t pointer_index) const { |
| 130 DCHECK_LT(pointer_index, GetPointerCount()); | 130 DCHECK_LT(pointer_index, GetPointerCount()); |
| 131 | 131 |
| 132 float rotation_angle_rad = event_.touches[pointer_index].rotationAngle | 132 float rotation_angle_rad = event_.touches[pointer_index].rotationAngle |
| 133 * M_PI / 180.f; | 133 * M_PI / 180.f; |
| 134 DCHECK(0 <= rotation_angle_rad && rotation_angle_rad <= M_PI_2) | 134 DCHECK(0 <= rotation_angle_rad && rotation_angle_rad <= M_PI_2) |
| 135 << "Unexpected touch rotation angle"; | 135 << "Unexpected touch rotation angle"; |
| 136 | 136 |
| 137 if (event_.touches[pointer_index].radiusX | 137 if (event_.touches[pointer_index].radiusX |
| 138 > event_.touches[pointer_index].radiusY) { | 138 > event_.touches[pointer_index].radiusY) { |
| 139 // The case radiusX == radiusY is omitted from here on purpose: for circles, | 139 // The case radiusX == radiusY is omitted from here on purpose: for circles, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 164 | 164 |
| 165 int MotionEventWeb::GetButtonState() const { | 165 int MotionEventWeb::GetButtonState() const { |
| 166 return 0; | 166 return 0; |
| 167 } | 167 } |
| 168 | 168 |
| 169 int MotionEventWeb::GetFlags() const { | 169 int MotionEventWeb::GetFlags() const { |
| 170 return WebEventModifiersToEventFlags(event_.modifiers); | 170 return WebEventModifiersToEventFlags(event_.modifiers); |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace content | 173 } // namespace content |
| OLD | NEW |