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