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 #include "ui/events/gesture_detection/motion_event_generic.h" | 5 #include "ui/events/gesture_detection/motion_event_generic.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
11 PointerProperties::PointerProperties() | 11 PointerProperties::PointerProperties() |
12 : id(0), | 12 : id(0), |
13 tool_type(MotionEvent::TOOL_TYPE_UNKNOWN), | 13 tool_type(MotionEvent::TOOL_TYPE_UNKNOWN), |
14 x(0), | 14 x(0), |
15 y(0), | 15 y(0), |
16 raw_x(0), | 16 raw_x(0), |
17 raw_y(0), | 17 raw_y(0), |
18 pressure(0), | 18 pressure(0), |
19 touch_major(0), | 19 touch_major(0) { |
20 touch_minor(0), | |
21 orientation(0) { | |
22 } | 20 } |
23 | 21 |
24 PointerProperties::PointerProperties(float x, float y) | 22 PointerProperties::PointerProperties(float x, float y) |
25 : id(0), | 23 : id(0), |
26 tool_type(MotionEvent::TOOL_TYPE_UNKNOWN), | 24 tool_type(MotionEvent::TOOL_TYPE_UNKNOWN), |
27 x(x), | 25 x(x), |
28 y(y), | 26 y(y), |
29 raw_x(x), | 27 raw_x(x), |
30 raw_y(y), | 28 raw_y(y), |
31 pressure(0), | 29 pressure(0), |
32 touch_major(0), | 30 touch_major(0) { |
33 touch_minor(0), | |
34 orientation(0) { | |
35 } | 31 } |
36 | 32 |
37 MotionEventGeneric::MotionEventGeneric() | 33 MotionEventGeneric::MotionEventGeneric() |
38 : action_(ACTION_CANCEL), id_(0), action_index_(0), button_state_(0) { | 34 : action_(ACTION_CANCEL), id_(0), action_index_(0), button_state_(0) { |
39 } | 35 } |
40 | 36 |
41 MotionEventGeneric::MotionEventGeneric(Action action, | 37 MotionEventGeneric::MotionEventGeneric(Action action, |
42 base::TimeTicks event_time, | 38 base::TimeTicks event_time, |
43 const PointerProperties& pointer) | 39 const PointerProperties& pointer) |
44 : action_(action), | 40 : action_(action), |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 float MotionEventGeneric::GetRawY(size_t pointer_index) const { | 96 float MotionEventGeneric::GetRawY(size_t pointer_index) const { |
101 DCHECK_LT(pointer_index, pointers_->size()); | 97 DCHECK_LT(pointer_index, pointers_->size()); |
102 return pointers_[pointer_index].raw_y; | 98 return pointers_[pointer_index].raw_y; |
103 } | 99 } |
104 | 100 |
105 float MotionEventGeneric::GetTouchMajor(size_t pointer_index) const { | 101 float MotionEventGeneric::GetTouchMajor(size_t pointer_index) const { |
106 DCHECK_LT(pointer_index, pointers_->size()); | 102 DCHECK_LT(pointer_index, pointers_->size()); |
107 return pointers_[pointer_index].touch_major; | 103 return pointers_[pointer_index].touch_major; |
108 } | 104 } |
109 | 105 |
110 float MotionEventGeneric::GetTouchMinor(size_t pointer_index) const { | |
111 DCHECK_LT(pointer_index, pointers_->size()); | |
112 return pointers_[pointer_index].touch_minor; | |
113 } | |
114 | |
115 float MotionEventGeneric::GetOrientation(size_t pointer_index) const { | |
116 DCHECK_LT(pointer_index, pointers_->size()); | |
117 return pointers_[pointer_index].orientation; | |
118 } | |
119 | |
120 float MotionEventGeneric::GetPressure(size_t pointer_index) const { | 106 float MotionEventGeneric::GetPressure(size_t pointer_index) const { |
121 DCHECK_LT(pointer_index, pointers_->size()); | 107 DCHECK_LT(pointer_index, pointers_->size()); |
122 return pointers_[pointer_index].pressure; | 108 return pointers_[pointer_index].pressure; |
123 } | 109 } |
124 | 110 |
125 MotionEvent::ToolType MotionEventGeneric::GetToolType( | 111 MotionEvent::ToolType MotionEventGeneric::GetToolType( |
126 size_t pointer_index) const { | 112 size_t pointer_index) const { |
127 DCHECK_LT(pointer_index, pointers_->size()); | 113 DCHECK_LT(pointer_index, pointers_->size()); |
128 return pointers_[pointer_index].tool_type; | 114 return pointers_[pointer_index].tool_type; |
129 } | 115 } |
(...skipping 19 matching lines...) Expand all Loading... |
149 void MotionEventGeneric::PushPointer(const PointerProperties& pointer) { | 135 void MotionEventGeneric::PushPointer(const PointerProperties& pointer) { |
150 pointers_->push_back(pointer); | 136 pointers_->push_back(pointer); |
151 } | 137 } |
152 | 138 |
153 void MotionEventGeneric::PopPointer() { | 139 void MotionEventGeneric::PopPointer() { |
154 DCHECK_GT(pointers_->size(), 0U); | 140 DCHECK_GT(pointers_->size(), 0U); |
155 pointers_->pop_back(); | 141 pointers_->pop_back(); |
156 } | 142 } |
157 | 143 |
158 } // namespace ui | 144 } // namespace ui |
OLD | NEW |