Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(502)

Side by Side Diff: ui/events/gesture_detection/mock_motion_event.cc

Issue 349463002: [Android] Map raw touch coordinates to global gesture locations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/mock_motion_event.h" 5 #include "ui/events/gesture_detection/mock_motion_event.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 using base::TimeTicks; 9 using base::TimeTicks;
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 float MockMotionEvent::GetX(size_t pointer_index) const { 95 float MockMotionEvent::GetX(size_t pointer_index) const {
96 return points[pointer_index].x(); 96 return points[pointer_index].x();
97 } 97 }
98 98
99 float MockMotionEvent::GetY(size_t pointer_index) const { 99 float MockMotionEvent::GetY(size_t pointer_index) const {
100 return points[pointer_index].y(); 100 return points[pointer_index].y();
101 } 101 }
102 102
103 float MockMotionEvent::GetRawX(size_t pointer_index) const { 103 float MockMotionEvent::GetRawX(size_t pointer_index) const {
104 return GetX(pointer_index); 104 return GetX(pointer_index) + raw_offset.x();
105 } 105 }
106 106
107 float MockMotionEvent::GetRawY(size_t pointer_index) const { 107 float MockMotionEvent::GetRawY(size_t pointer_index) const {
108 return GetY(pointer_index); 108 return GetY(pointer_index) + raw_offset.y();
109 } 109 }
110 110
111 float MockMotionEvent::GetTouchMajor(size_t pointer_index) const { 111 float MockMotionEvent::GetTouchMajor(size_t pointer_index) const {
112 return touch_major; 112 return touch_major;
113 } 113 }
114 114
115 float MockMotionEvent::GetPressure(size_t pointer_index) const { 115 float MockMotionEvent::GetPressure(size_t pointer_index) const {
116 return 0; 116 return 0;
117 } 117 }
118 118
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 DCHECK_GT(pointer_count, 0U); 189 DCHECK_GT(pointer_count, 0U);
190 if (pointer_count > 1) 190 if (pointer_count > 1)
191 --pointer_count; 191 --pointer_count;
192 action = ACTION_CANCEL; 192 action = ACTION_CANCEL;
193 } 193 }
194 194
195 void MockMotionEvent::SetTouchMajor(float new_touch_major) { 195 void MockMotionEvent::SetTouchMajor(float new_touch_major) {
196 touch_major = new_touch_major; 196 touch_major = new_touch_major;
197 } 197 }
198 198
199 void MockMotionEvent::SetRawOffset(float raw_offset_x, float raw_offset_y) {
200 raw_offset.set_x(raw_offset_x);
201 raw_offset.set_y(raw_offset_y);
202 }
203
199 } // namespace ui 204 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698