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

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

Issue 1147083005: Separate motion event touch geometry orientation from stylus orientation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Aura Created 5 years, 7 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/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 #include "ui/events/base_event_utils.h" 8 #include "ui/events/base_event_utils.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 PointerProperties::PointerProperties() 12 PointerProperties::PointerProperties()
13 : PointerProperties(0, 0, 0) { 13 : PointerProperties(0, 0, 0) {
14 } 14 }
15 15
16 PointerProperties::PointerProperties(float x, float y, float touch_major) 16 PointerProperties::PointerProperties(float x, float y, float touch_major)
17 : id(0), 17 : id(0),
18 tool_type(MotionEvent::TOOL_TYPE_UNKNOWN), 18 tool_type(MotionEvent::TOOL_TYPE_UNKNOWN),
19 x(x), 19 x(x),
20 y(y), 20 y(y),
21 raw_x(x), 21 raw_x(x),
22 raw_y(y), 22 raw_y(y),
23 pressure(0), 23 pressure(0),
24 touch_major(touch_major), 24 touch_major(touch_major),
25 touch_minor(0), 25 touch_minor(0),
26 orientation(0), 26 touch_orientation(0),
27 source_device_id(0) { 27 source_device_id(0) {
28 } 28 }
29 29
30 PointerProperties::PointerProperties(const MotionEvent& event, 30 PointerProperties::PointerProperties(const MotionEvent& event,
31 size_t pointer_index) 31 size_t pointer_index)
32 : id(event.GetPointerId(pointer_index)), 32 : id(event.GetPointerId(pointer_index)),
33 tool_type(event.GetToolType(pointer_index)), 33 tool_type(event.GetToolType(pointer_index)),
34 x(event.GetX(pointer_index)), 34 x(event.GetX(pointer_index)),
35 y(event.GetY(pointer_index)), 35 y(event.GetY(pointer_index)),
36 raw_x(event.GetRawX(pointer_index)), 36 raw_x(event.GetRawX(pointer_index)),
37 raw_y(event.GetRawY(pointer_index)), 37 raw_y(event.GetRawY(pointer_index)),
38 pressure(event.GetPressure(pointer_index)), 38 pressure(event.GetPressure(pointer_index)),
39 touch_major(event.GetTouchMajor(pointer_index)), 39 touch_major(event.GetTouchMajor(pointer_index)),
40 touch_minor(event.GetTouchMinor(pointer_index)), 40 touch_minor(event.GetTouchMinor(pointer_index)),
41 orientation(event.GetOrientation(pointer_index)), 41 touch_orientation(event.GetTouchOrientation(pointer_index)),
42 source_device_id(0) { 42 source_device_id(0) {
43 } 43 }
44 44
45 MotionEventGeneric::MotionEventGeneric(Action action, 45 MotionEventGeneric::MotionEventGeneric(Action action,
46 base::TimeTicks event_time, 46 base::TimeTicks event_time,
47 const PointerProperties& pointer) 47 const PointerProperties& pointer)
48 : action_(action), 48 : action_(action),
49 event_time_(event_time), 49 event_time_(event_time),
50 unique_event_id_(ui::GetNextTouchEventId()), 50 unique_event_id_(ui::GetNextTouchEventId()),
51 action_index_(0), 51 action_index_(0),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 float MotionEventGeneric::GetTouchMajor(size_t pointer_index) const { 117 float MotionEventGeneric::GetTouchMajor(size_t pointer_index) const {
118 DCHECK_LT(pointer_index, pointers_->size()); 118 DCHECK_LT(pointer_index, pointers_->size());
119 return pointers_[pointer_index].touch_major; 119 return pointers_[pointer_index].touch_major;
120 } 120 }
121 121
122 float MotionEventGeneric::GetTouchMinor(size_t pointer_index) const { 122 float MotionEventGeneric::GetTouchMinor(size_t pointer_index) const {
123 DCHECK_LT(pointer_index, pointers_->size()); 123 DCHECK_LT(pointer_index, pointers_->size());
124 return pointers_[pointer_index].touch_minor; 124 return pointers_[pointer_index].touch_minor;
125 } 125 }
126 126
127 float MotionEventGeneric::GetOrientation(size_t pointer_index) const { 127 float MotionEventGeneric::GetTouchOrientation(size_t pointer_index) const {
128 DCHECK_LT(pointer_index, pointers_->size()); 128 DCHECK_LT(pointer_index, pointers_->size());
129 return pointers_[pointer_index].orientation; 129 return pointers_[pointer_index].touch_orientation;
130 } 130 }
131 131
132 float MotionEventGeneric::GetPressure(size_t pointer_index) const { 132 float MotionEventGeneric::GetPressure(size_t pointer_index) const {
133 DCHECK_LT(pointer_index, pointers_->size()); 133 DCHECK_LT(pointer_index, pointers_->size());
134 return pointers_[pointer_index].pressure; 134 return pointers_[pointer_index].pressure;
135 } 135 }
136 136
137 MotionEvent::ToolType MotionEventGeneric::GetToolType( 137 MotionEvent::ToolType MotionEventGeneric::GetToolType(
138 size_t pointer_index) const { 138 size_t pointer_index) const {
139 DCHECK_LT(pointer_index, pointers_->size()); 139 DCHECK_LT(pointer_index, pointers_->size());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 PushHistoricalEvent(other.historical_events_[h]->Clone()); 274 PushHistoricalEvent(other.historical_events_[h]->Clone());
275 return *this; 275 return *this;
276 } 276 }
277 277
278 void MotionEventGeneric::PopPointer() { 278 void MotionEventGeneric::PopPointer() {
279 DCHECK_GT(pointers_->size(), 0U); 279 DCHECK_GT(pointers_->size(), 0U);
280 pointers_->pop_back(); 280 pointers_->pop_back();
281 } 281 }
282 282
283 } // namespace ui 283 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/motion_event_generic.h ('k') | ui/events/gesture_detection/motion_event_generic_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698