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/gesture_event_data_packet.h" | 5 #include "ui/events/gesture_detection/gesture_event_data_packet.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/events/gesture_detection/motion_event.h" | 8 #include "ui/events/gesture_detection/motion_event.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const GestureEventDataPacket& other) { | 60 const GestureEventDataPacket& other) { |
61 timestamp_ = other.timestamp_; | 61 timestamp_ = other.timestamp_; |
62 gesture_count_ = other.gesture_count_; | 62 gesture_count_ = other.gesture_count_; |
63 gesture_source_ = other.gesture_source_; | 63 gesture_source_ = other.gesture_source_; |
64 touch_location_ = other.touch_location_; | 64 touch_location_ = other.touch_location_; |
65 std::copy(other.gestures_, other.gestures_ + other.gesture_count_, gestures_); | 65 std::copy(other.gestures_, other.gestures_ + other.gesture_count_, gestures_); |
66 return *this; | 66 return *this; |
67 } | 67 } |
68 | 68 |
69 void GestureEventDataPacket::Push(const GestureEventData& gesture) { | 69 void GestureEventDataPacket::Push(const GestureEventData& gesture) { |
70 DCHECK_NE(ET_UNKNOWN, gesture.type); | 70 DCHECK_NE(ET_UNKNOWN, gesture.type()); |
71 CHECK_LT(gesture_count_, static_cast<size_t>(kMaxGesturesPerTouch)); | 71 CHECK_LT(gesture_count_, static_cast<size_t>(kMaxGesturesPerTouch)); |
72 gestures_[gesture_count_++] = gesture; | 72 gestures_[gesture_count_++] = gesture; |
73 } | 73 } |
74 | 74 |
75 GestureEventDataPacket GestureEventDataPacket::FromTouch( | 75 GestureEventDataPacket GestureEventDataPacket::FromTouch( |
76 const ui::MotionEvent& touch) { | 76 const ui::MotionEvent& touch) { |
77 return GestureEventDataPacket(touch.GetEventTime(), | 77 return GestureEventDataPacket(touch.GetEventTime(), |
78 ToGestureSource(touch), | 78 ToGestureSource(touch), |
79 gfx::PointF(touch.GetX(), touch.GetY())); | 79 gfx::PointF(touch.GetX(), touch.GetY())); |
80 } | 80 } |
81 | 81 |
82 GestureEventDataPacket GestureEventDataPacket::FromTouchTimeout( | 82 GestureEventDataPacket GestureEventDataPacket::FromTouchTimeout( |
83 const GestureEventData& gesture) { | 83 const GestureEventData& gesture) { |
84 GestureEventDataPacket packet( | 84 GestureEventDataPacket packet( |
85 gesture.time, TOUCH_TIMEOUT, gfx::PointF(gesture.x, gesture.y)); | 85 gesture.time, TOUCH_TIMEOUT, gfx::PointF(gesture.x, gesture.y)); |
86 packet.Push(gesture); | 86 packet.Push(gesture); |
87 return packet; | 87 return packet; |
88 } | 88 } |
89 | 89 |
90 } // namespace ui | 90 } // namespace ui |
OLD | NEW |