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.h" | 5 #include "ui/events/gesture_detection/motion_event.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ui { | 9 namespace ui { |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 for (size_t i = 0; i < lhs.GetPointerCount(); ++i) { | 57 for (size_t i = 0; i < lhs.GetPointerCount(); ++i) { |
58 int rhsi = rhs.FindPointerIndexOfId(lhs.GetPointerId(i)); | 58 int rhsi = rhs.FindPointerIndexOfId(lhs.GetPointerId(i)); |
59 if (rhsi == -1) | 59 if (rhsi == -1) |
60 return false; | 60 return false; |
61 | 61 |
62 if (lhs.GetX(i) != rhs.GetX(rhsi) || lhs.GetY(i) != rhs.GetY(rhsi) || | 62 if (lhs.GetX(i) != rhs.GetX(rhsi) || lhs.GetY(i) != rhs.GetY(rhsi) || |
63 lhs.GetRawX(i) != rhs.GetRawX(rhsi) || | 63 lhs.GetRawX(i) != rhs.GetRawX(rhsi) || |
64 lhs.GetRawY(i) != rhs.GetRawY(rhsi) || | 64 lhs.GetRawY(i) != rhs.GetRawY(rhsi) || |
65 lhs.GetTouchMajor(i) != rhs.GetTouchMajor(rhsi) || | 65 lhs.GetTouchMajor(i) != rhs.GetTouchMajor(rhsi) || |
66 lhs.GetTouchMinor(i) != rhs.GetTouchMinor(rhsi) || | |
67 lhs.GetOrientation(i) != rhs.GetOrientation(rhsi) || | |
68 lhs.GetPressure(i) != rhs.GetPressure(rhsi) || | 66 lhs.GetPressure(i) != rhs.GetPressure(rhsi) || |
69 lhs.GetToolType(i) != rhs.GetToolType(rhsi)) | 67 lhs.GetToolType(i) != rhs.GetToolType(rhsi)) |
70 return false; | 68 return false; |
71 | 69 |
72 for (size_t h = 0; h < lhs.GetHistorySize(); ++h) { | 70 for (size_t h = 0; h < lhs.GetHistorySize(); ++h) { |
73 if (lhs.GetHistoricalX(i, h) != rhs.GetHistoricalX(rhsi, h) || | 71 if (lhs.GetHistoricalX(i, h) != rhs.GetHistoricalX(rhsi, h) || |
74 lhs.GetHistoricalY(i, h) != rhs.GetHistoricalY(rhsi, h) || | 72 lhs.GetHistoricalY(i, h) != rhs.GetHistoricalY(rhsi, h) || |
75 lhs.GetHistoricalTouchMajor(i, h) != | 73 lhs.GetHistoricalTouchMajor(i, h) != |
76 rhs.GetHistoricalTouchMajor(rhsi, h)) | 74 rhs.GetHistoricalTouchMajor(rhsi, h)) |
77 return false; | 75 return false; |
78 } | 76 } |
79 } | 77 } |
80 | 78 |
81 for (size_t h = 0; h < lhs.GetHistorySize(); ++h) { | 79 for (size_t h = 0; h < lhs.GetHistorySize(); ++h) { |
82 if (lhs.GetHistoricalEventTime(h) != rhs.GetHistoricalEventTime(h)) | 80 if (lhs.GetHistoricalEventTime(h) != rhs.GetHistoricalEventTime(h)) |
83 return false; | 81 return false; |
84 } | 82 } |
85 | 83 |
86 return true; | 84 return true; |
87 } | 85 } |
88 | 86 |
89 bool operator!=(const MotionEvent& lhs, const MotionEvent& rhs) { | 87 bool operator!=(const MotionEvent& lhs, const MotionEvent& rhs) { |
90 return !(lhs == rhs); | 88 return !(lhs == rhs); |
91 } | 89 } |
92 | 90 |
93 } // namespace ui | 91 } // namespace ui |
OLD | NEW |