| 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 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 5 #ifndef UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 6 #define UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 virtual int GetId() const OVERRIDE; | 27 virtual int GetId() const OVERRIDE; |
| 28 virtual Action GetAction() const OVERRIDE; | 28 virtual Action GetAction() const OVERRIDE; |
| 29 virtual int GetActionIndex() const OVERRIDE; | 29 virtual int GetActionIndex() const OVERRIDE; |
| 30 virtual size_t GetPointerCount() const OVERRIDE; | 30 virtual size_t GetPointerCount() const OVERRIDE; |
| 31 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; | 31 virtual int GetPointerId(size_t pointer_index) const OVERRIDE; |
| 32 virtual float GetX(size_t pointer_index) const OVERRIDE; | 32 virtual float GetX(size_t pointer_index) const OVERRIDE; |
| 33 virtual float GetY(size_t pointer_index) const OVERRIDE; | 33 virtual float GetY(size_t pointer_index) const OVERRIDE; |
| 34 virtual float GetRawX(size_t pointer_index) const OVERRIDE; | 34 virtual float GetRawX(size_t pointer_index) const OVERRIDE; |
| 35 virtual float GetRawY(size_t pointer_index) const OVERRIDE; | 35 virtual float GetRawY(size_t pointer_index) const OVERRIDE; |
| 36 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; | 36 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE; |
| 37 virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE; |
| 38 virtual float GetOrientation(size_t pointer_index) const OVERRIDE; |
| 37 virtual float GetPressure(size_t pointer_index) const OVERRIDE; | 39 virtual float GetPressure(size_t pointer_index) const OVERRIDE; |
| 38 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; | 40 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE; |
| 39 virtual int GetButtonState() const OVERRIDE; | 41 virtual int GetButtonState() const OVERRIDE; |
| 40 virtual base::TimeTicks GetEventTime() const OVERRIDE; | 42 virtual base::TimeTicks GetEventTime() const OVERRIDE; |
| 41 | 43 |
| 42 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; | 44 virtual scoped_ptr<MotionEvent> Clone() const OVERRIDE; |
| 43 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; | 45 virtual scoped_ptr<MotionEvent> Cancel() const OVERRIDE; |
| 44 | 46 |
| 45 int GetSourceDeviceId(size_t pointer_index) const; | 47 int GetSourceDeviceId(size_t pointer_index) const; |
| 46 | 48 |
| 47 // We can't cleanup removed touch points immediately upon receipt of a | 49 // We can't cleanup removed touch points immediately upon receipt of a |
| 48 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report | 50 // TouchCancel or TouchRelease, as the MotionEvent needs to be able to report |
| 49 // information about those touch events. Once the MotionEvent has been | 51 // information about those touch events. Once the MotionEvent has been |
| 50 // processed, we call CleanupRemovedTouchPoints to do the required | 52 // processed, we call CleanupRemovedTouchPoints to do the required |
| 51 // book-keeping. | 53 // book-keeping. |
| 52 void CleanupRemovedTouchPoints(const TouchEvent& event); | 54 void CleanupRemovedTouchPoints(const TouchEvent& event); |
| 53 | 55 |
| 54 private: | 56 private: |
| 55 struct PointData { | 57 struct PointData { |
| 56 PointData(); | 58 PointData(); |
| 57 float x; | 59 float x; |
| 58 float y; | 60 float y; |
| 59 float raw_x; | 61 float raw_x; |
| 60 float raw_y; | 62 float raw_y; |
| 61 int touch_id; | 63 int touch_id; |
| 62 float pressure; | 64 float pressure; |
| 63 int source_device_id; | 65 int source_device_id; |
| 64 float major_radius; | 66 float touch_major; |
| 67 float touch_minor; |
| 68 float orientation; |
| 65 }; | 69 }; |
| 66 | 70 |
| 67 MotionEventAura( | 71 MotionEventAura( |
| 68 size_t pointer_count, | 72 size_t pointer_count, |
| 69 const base::TimeTicks& last_touch_time, | 73 const base::TimeTicks& last_touch_time, |
| 70 Action cached_action, | 74 Action cached_action, |
| 71 int cached_action_index, | 75 int cached_action_index, |
| 72 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]); | 76 const PointData (&active_touches)[MotionEvent::MAX_TOUCH_POINT_COUNT]); |
| 73 | 77 |
| 74 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); | 78 static PointData GetPointDataFromTouchEvent(const TouchEvent& touch); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 86 | 90 |
| 87 // We want constant time indexing by pointer_index, and fast indexing by id. | 91 // We want constant time indexing by pointer_index, and fast indexing by id. |
| 88 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; | 92 PointData active_touches_[MotionEvent::MAX_TOUCH_POINT_COUNT]; |
| 89 | 93 |
| 90 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); | 94 DISALLOW_COPY_AND_ASSIGN(MotionEventAura); |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 } // namespace ui | 97 } // namespace ui |
| 94 | 98 |
| 95 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ | 99 #endif // UI_EVENTS_GESTURE_DETECTION_UI_MOTION_EVENT_H_ |
| OLD | NEW |