| Index: ui/base/events/event.cc
|
| diff --git a/ui/base/events/event.cc b/ui/base/events/event.cc
|
| index fdc40b42df159137ddc75e34bc5a985e19302fad..f2881072be311dda12aad0d1fc49217967ca8486 100644
|
| --- a/ui/base/events/event.cc
|
| +++ b/ui/base/events/event.cc
|
| @@ -8,6 +8,7 @@
|
| #include <X11/Xlib.h>
|
| #endif
|
|
|
| +#include <cmath>
|
| #include <cstring>
|
|
|
| #include "ui/base/keycodes/keyboard_code_conversion.h"
|
| @@ -37,6 +38,17 @@ base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) {
|
| #endif
|
| }
|
|
|
| +gfx::Point CalibratePoint(const gfx::Point& point,
|
| + const gfx::Size& from,
|
| + const gfx::Size& to) {
|
| + float calibrated_x =
|
| + static_cast<float>(point.x()) * to.width() / from.width();
|
| + float calibrated_y =
|
| + static_cast<float>(point.y()) * to.height() / from.height();
|
| + return gfx::Point(static_cast<int>(floorf(calibrated_x + 0.5f)),
|
| + static_cast<int>(floorf(calibrated_y + 0.5f)));
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace ui {
|
| @@ -291,6 +303,11 @@ TouchEvent::TouchEvent(EventType type,
|
| TouchEvent::~TouchEvent() {
|
| }
|
|
|
| +void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) {
|
| + location_ = CalibratePoint(location_, from, to);
|
| + root_location_ = CalibratePoint(root_location_, from, to);
|
| +}
|
| +
|
| void TouchEvent::UpdateForRootTransform(const Transform& root_transform) {
|
| LocatedEvent::UpdateForRootTransform(root_transform);
|
| gfx::Point3f scale;
|
|
|