| Index: ui/events/gestures/motion_event_aura.cc
|
| diff --git a/ui/events/gestures/motion_event_aura.cc b/ui/events/gestures/motion_event_aura.cc
|
| index a8b46b3ba456130a82a498b0d203103359529389..bfe3321bed42f0972e1430cc80ca67c64677c202 100644
|
| --- a/ui/events/gestures/motion_event_aura.cc
|
| +++ b/ui/events/gestures/motion_event_aura.cc
|
| @@ -2,12 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -// MSVC++ requires this to be set before any other includes to get M_PI.
|
| -#define _USE_MATH_DEFINES
|
| -
|
| #include "ui/events/gestures/motion_event_aura.h"
|
| -
|
| -#include <cmath>
|
|
|
| #include "base/logging.h"
|
| #include "ui/events/gestures/gesture_configuration.h"
|
| @@ -46,33 +41,11 @@
|
| point_data.pressure = touch.force();
|
| point_data.source_device_id = touch.source_device_id();
|
|
|
| - float radius_x = touch.radius_x();
|
| - float radius_y = touch.radius_y();
|
| - float rotation_angle_rad = touch.rotation_angle() * M_PI / 180.f;
|
| - DCHECK_GE(radius_x, 0) << "Unexpected x-radius < 0";
|
| - DCHECK_GE(radius_y, 0) << "Unexpected y-radius < 0";
|
| - DCHECK(0 <= rotation_angle_rad && rotation_angle_rad <= M_PI_2)
|
| - << "Unexpected touch rotation angle";
|
| -
|
| - if (radius_x > radius_y) {
|
| - // The case radius_x == radius_y is omitted from here on purpose: for
|
| - // circles, we want to pass the angle (which could be any value in such
|
| - // cases but always seem to be set to zero) unchanged.
|
| - point_data.touch_major = 2.f * radius_x;
|
| - point_data.touch_minor = 2.f * radius_y;
|
| - point_data.orientation = rotation_angle_rad - M_PI_2;
|
| - } else {
|
| - point_data.touch_major = 2.f * radius_y;
|
| - point_data.touch_minor = 2.f * radius_x;
|
| - point_data.orientation = rotation_angle_rad;
|
| - }
|
| -
|
| - if (!point_data.touch_major) {
|
| - point_data.touch_major = 2.f * GestureConfiguration::default_radius();
|
| - point_data.touch_minor = 2.f * GestureConfiguration::default_radius();
|
| - point_data.orientation = 0;
|
| - }
|
| -
|
| + // TODO(tdresser): at some point we should start using both radii if they are
|
| + // available, but for now we use the max.
|
| + point_data.major_radius = std::max(touch.radius_x(), touch.radius_y());
|
| + if (!point_data.major_radius)
|
| + point_data.major_radius = GestureConfiguration::default_radius();
|
| return point_data;
|
| }
|
|
|
| @@ -145,17 +118,7 @@
|
|
|
| float MotionEventAura::GetTouchMajor(size_t pointer_index) const {
|
| DCHECK_LT(pointer_index, pointer_count_);
|
| - return active_touches_[pointer_index].touch_major;
|
| -}
|
| -
|
| -float MotionEventAura::GetTouchMinor(size_t pointer_index) const {
|
| - DCHECK_LE(pointer_index, pointer_count_);
|
| - return active_touches_[pointer_index].touch_minor;
|
| -}
|
| -
|
| -float MotionEventAura::GetOrientation(size_t pointer_index) const {
|
| - DCHECK_LE(pointer_index, pointer_count_);
|
| - return active_touches_[pointer_index].orientation;
|
| + return active_touches_[pointer_index].major_radius * 2;
|
| }
|
|
|
| float MotionEventAura::GetPressure(size_t pointer_index) const {
|
| @@ -209,9 +172,7 @@
|
| touch_id(0),
|
| pressure(0),
|
| source_device_id(0),
|
| - touch_major(0),
|
| - touch_minor(0),
|
| - orientation(0) {
|
| + major_radius(0) {
|
| }
|
|
|
| int MotionEventAura::GetSourceDeviceId(size_t pointer_index) const {
|
|
|