Chromium Code Reviews| Index: ui/base/events/event.cc |
| diff --git a/ui/base/events/event.cc b/ui/base/events/event.cc |
| index fdc40b42df159137ddc75e34bc5a985e19302fad..298ae6a73a54936bb010f30082f09e57877b3a65 100644 |
| --- a/ui/base/events/event.cc |
| +++ b/ui/base/events/event.cc |
| @@ -291,6 +291,16 @@ TouchEvent::TouchEvent(EventType type, |
| TouchEvent::~TouchEvent() { |
| } |
| +void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) { |
| + int calibrated_x = x() * to.width() / from.width(); |
|
Daniel Erat
2012/09/10 17:27:31
nit: cast to floating-point and round?
sadrul
2012/09/10 18:19:32
Done.
|
| + int calibrated_y = y() * to.height() / from.height(); |
| + location_ = gfx::Point(calibrated_x, calibrated_y); |
| + |
| + calibrated_x = root_location().x() * to.width() / from.width(); |
| + calibrated_y = root_location().y() * to.height() / from.height(); |
| + root_location_ = gfx::Point(calibrated_x, calibrated_y); |
| +} |
| + |
| void TouchEvent::UpdateForRootTransform(const Transform& root_transform) { |
| LocatedEvent::UpdateForRootTransform(root_transform); |
| gfx::Point3f scale; |