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