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/android/motion_event_android.h" | 5 #include "ui/events/android/motion_event_android.h" |
6 | 6 |
7 #include <android/input.h> | 7 #include <android/input.h> |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 AttachCurrentThread(), event_, pointer_index)); | 297 AttachCurrentThread(), event_, pointer_index)); |
298 } | 298 } |
299 | 299 |
300 float MotionEventAndroid::GetPressure(size_t pointer_index) const { | 300 float MotionEventAndroid::GetPressure(size_t pointer_index) const { |
301 DCHECK_LT(pointer_index, cached_pointer_count_); | 301 DCHECK_LT(pointer_index, cached_pointer_count_); |
302 // Note that this early return is a special case exercised only in testing, as | 302 // Note that this early return is a special case exercised only in testing, as |
303 // caching the pressure values is not a worthwhile optimization (they're | 303 // caching the pressure values is not a worthwhile optimization (they're |
304 // accessed at most once per event instance). | 304 // accessed at most once per event instance). |
305 if (!event_.obj()) | 305 if (!event_.obj()) |
306 return 0.f; | 306 return 0.f; |
307 if (cached_action_ == ACTION_UP) | |
mustaq
2017/02/17 16:07:18
I guess this came from a previous mistake in Line
mustaq
2017/02/17 16:18:51
I have got the answer why we didn't hit Line 232 b
lanwei
2017/02/21 17:47:06
Acknowledged.
| |
308 return 0.f; | |
307 return Java_MotionEvent_getPressureF_I(AttachCurrentThread(), event_, | 309 return Java_MotionEvent_getPressureF_I(AttachCurrentThread(), event_, |
308 pointer_index); | 310 pointer_index); |
309 } | 311 } |
310 | 312 |
311 float MotionEventAndroid::GetTilt(size_t pointer_index) const { | 313 float MotionEventAndroid::GetTilt(size_t pointer_index) const { |
312 DCHECK_LT(pointer_index, cached_pointer_count_); | 314 DCHECK_LT(pointer_index, cached_pointer_count_); |
313 if (pointer_index < MAX_POINTERS_TO_CACHE) | 315 if (pointer_index < MAX_POINTERS_TO_CACHE) |
314 return cached_pointers_[pointer_index].tilt; | 316 return cached_pointers_[pointer_index].tilt; |
315 if (!event_.obj()) | 317 if (!event_.obj()) |
316 return 0.f; | 318 return 0.f; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 gfx::PointF(ToDips(pointer.pos_x_pixels), ToDips(pointer.pos_y_pixels)); | 382 gfx::PointF(ToDips(pointer.pos_x_pixels), ToDips(pointer.pos_y_pixels)); |
381 result.touch_major = ToDips(pointer.touch_major_pixels); | 383 result.touch_major = ToDips(pointer.touch_major_pixels); |
382 result.touch_minor = ToDips(pointer.touch_minor_pixels); | 384 result.touch_minor = ToDips(pointer.touch_minor_pixels); |
383 result.orientation = ToValidFloat(pointer.orientation_rad); | 385 result.orientation = ToValidFloat(pointer.orientation_rad); |
384 result.tilt = ToValidFloat(pointer.tilt_rad); | 386 result.tilt = ToValidFloat(pointer.tilt_rad); |
385 result.tool_type = FromAndroidToolType(pointer.tool_type); | 387 result.tool_type = FromAndroidToolType(pointer.tool_type); |
386 return result; | 388 return result; |
387 } | 389 } |
388 | 390 |
389 } // namespace content | 391 } // namespace content |
OLD | NEW |