| 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_buffer.h" | 5 #include "ui/events/gesture_detection/motion_event_buffer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "ui/events/gesture_detection/motion_event.h" | 8 #include "ui/events/gesture_detection/motion_event.h" |
| 9 #include "ui/events/gesture_detection/motion_event_generic.h" | 9 #include "ui/events/gesture_detection/motion_event_generic.h" |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 size_t pointer_index) { | 90 size_t pointer_index) { |
| 91 PointerProperties result; | 91 PointerProperties result; |
| 92 result.id = event.GetPointerId(pointer_index); | 92 result.id = event.GetPointerId(pointer_index); |
| 93 result.tool_type = event.GetToolType(pointer_index); | 93 result.tool_type = event.GetToolType(pointer_index); |
| 94 result.x = event.GetX(pointer_index); | 94 result.x = event.GetX(pointer_index); |
| 95 result.y = event.GetY(pointer_index); | 95 result.y = event.GetY(pointer_index); |
| 96 result.raw_x = event.GetRawX(pointer_index); | 96 result.raw_x = event.GetRawX(pointer_index); |
| 97 result.raw_y = event.GetRawY(pointer_index); | 97 result.raw_y = event.GetRawY(pointer_index); |
| 98 result.pressure = event.GetPressure(pointer_index); | 98 result.pressure = event.GetPressure(pointer_index); |
| 99 result.touch_major = event.GetTouchMajor(pointer_index); | 99 result.touch_major = event.GetTouchMajor(pointer_index); |
| 100 result.touch_minor = event.GetTouchMinor(pointer_index); |
| 101 result.orientation = event.GetOrientation(pointer_index); |
| 100 return result; | 102 return result; |
| 101 } | 103 } |
| 102 | 104 |
| 103 PointerProperties ResamplePointer(const MotionEvent& event0, | 105 PointerProperties ResamplePointer(const MotionEvent& event0, |
| 104 const MotionEvent& event1, | 106 const MotionEvent& event1, |
| 105 size_t event0_pointer_index, | 107 size_t event0_pointer_index, |
| 106 size_t event1_pointer_index, | 108 size_t event1_pointer_index, |
| 107 float alpha) { | 109 float alpha) { |
| 108 DCHECK_EQ(event0.GetPointerId(event0_pointer_index), | 110 DCHECK_EQ(event0.GetPointerId(event0_pointer_index), |
| 109 event1.GetPointerId(event1_pointer_index)); | 111 event1.GetPointerId(event1_pointer_index)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 194 } |
| 193 virtual float GetRawX(size_t pointer_index) const OVERRIDE { | 195 virtual float GetRawX(size_t pointer_index) const OVERRIDE { |
| 194 return latest().GetRawX(pointer_index); | 196 return latest().GetRawX(pointer_index); |
| 195 } | 197 } |
| 196 virtual float GetRawY(size_t pointer_index) const OVERRIDE { | 198 virtual float GetRawY(size_t pointer_index) const OVERRIDE { |
| 197 return latest().GetRawY(pointer_index); | 199 return latest().GetRawY(pointer_index); |
| 198 } | 200 } |
| 199 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE { | 201 virtual float GetTouchMajor(size_t pointer_index) const OVERRIDE { |
| 200 return latest().GetTouchMajor(pointer_index); | 202 return latest().GetTouchMajor(pointer_index); |
| 201 } | 203 } |
| 204 virtual float GetTouchMinor(size_t pointer_index) const OVERRIDE { |
| 205 return latest().GetTouchMinor(pointer_index); |
| 206 } |
| 207 virtual float GetOrientation(size_t pointer_index) const OVERRIDE { |
| 208 return latest().GetOrientation(pointer_index); |
| 209 } |
| 202 virtual float GetPressure(size_t pointer_index) const OVERRIDE { | 210 virtual float GetPressure(size_t pointer_index) const OVERRIDE { |
| 203 return latest().GetPressure(pointer_index); | 211 return latest().GetPressure(pointer_index); |
| 204 } | 212 } |
| 205 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE { | 213 virtual ToolType GetToolType(size_t pointer_index) const OVERRIDE { |
| 206 return latest().GetToolType(pointer_index); | 214 return latest().GetToolType(pointer_index); |
| 207 } | 215 } |
| 208 virtual int GetButtonState() const OVERRIDE { | 216 virtual int GetButtonState() const OVERRIDE { |
| 209 return latest().GetButtonState(); | 217 return latest().GetButtonState(); |
| 210 } | 218 } |
| 211 virtual base::TimeTicks GetEventTime() const OVERRIDE { | 219 virtual base::TimeTicks GetEventTime() const OVERRIDE { |
| 212 return latest().GetEventTime(); | 220 return latest().GetEventTime(); |
| 213 } | 221 } |
| 214 virtual size_t GetHistorySize() const OVERRIDE { return events_.size() - 1; } | 222 virtual size_t GetHistorySize() const OVERRIDE { return events_.size() - 1; } |
| 215 virtual base::TimeTicks GetHistoricalEventTime( | 223 virtual base::TimeTicks GetHistoricalEventTime( |
| 216 size_t historical_index) const OVERRIDE { | 224 size_t historical_index) const OVERRIDE { |
| 217 DCHECK_LT(historical_index, GetHistorySize()); | 225 DCHECK_LT(historical_index, GetHistorySize()); |
| 218 return events_[historical_index]->GetEventTime(); | 226 return events_[historical_index]->GetEventTime(); |
| 219 } | 227 } |
| 220 virtual float GetHistoricalTouchMajor( | 228 virtual float GetHistoricalTouchMajor( |
| 221 size_t pointer_index, | 229 size_t pointer_index, |
| 222 size_t historical_index) const OVERRIDE { | 230 size_t historical_index) const OVERRIDE { |
| 223 DCHECK_LT(historical_index, GetHistorySize()); | 231 DCHECK_LT(historical_index, GetHistorySize()); |
| 224 return events_[historical_index]->GetTouchMajor(); | 232 return events_[historical_index]->GetTouchMajor(); |
| 225 } | 233 } |
| 234 virtual float GetHistoricalTouchMinor( |
| 235 size_t pointer_index, |
| 236 size_t historical_index) const OVERRIDE { |
| 237 DCHECK_LT(historical_index, GetHistorySize()); |
| 238 return events_[historical_index]->GetTouchMinor(); |
| 239 } |
| 240 virtual float GetHistoricalOrientation( |
| 241 size_t pointer_index, |
| 242 size_t historical_index) const OVERRIDE { |
| 243 DCHECK_LT(historical_index, GetHistorySize()); |
| 244 return events_[historical_index]->GetOrientation(); |
| 245 } |
| 226 virtual float GetHistoricalX(size_t pointer_index, | 246 virtual float GetHistoricalX(size_t pointer_index, |
| 227 size_t historical_index) const OVERRIDE { | 247 size_t historical_index) const OVERRIDE { |
| 228 DCHECK_LT(historical_index, GetHistorySize()); | 248 DCHECK_LT(historical_index, GetHistorySize()); |
| 229 return events_[historical_index]->GetX(pointer_index); | 249 return events_[historical_index]->GetX(pointer_index); |
| 230 } | 250 } |
| 231 virtual float GetHistoricalY(size_t pointer_index, | 251 virtual float GetHistoricalY(size_t pointer_index, |
| 232 size_t historical_index) const OVERRIDE { | 252 size_t historical_index) const OVERRIDE { |
| 233 DCHECK_LT(historical_index, GetHistorySize()); | 253 DCHECK_LT(historical_index, GetHistorySize()); |
| 234 return events_[historical_index]->GetY(pointer_index); | 254 return events_[historical_index]->GetY(pointer_index); |
| 235 } | 255 } |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 events.weak_clear(); | 443 events.weak_clear(); |
| 424 client_->ForwardMotionEvent(*event); | 444 client_->ForwardMotionEvent(*event); |
| 425 return; | 445 return; |
| 426 } | 446 } |
| 427 | 447 |
| 428 CompoundMotionEvent compound_event(events.Pass()); | 448 CompoundMotionEvent compound_event(events.Pass()); |
| 429 client_->ForwardMotionEvent(compound_event); | 449 client_->ForwardMotionEvent(compound_event); |
| 430 } | 450 } |
| 431 | 451 |
| 432 } // namespace ui | 452 } // namespace ui |
| OLD | NEW |