Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/events/event.h" | 5 #include "ui/base/events/event.h" |
| 6 | 6 |
| 7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 radius_x_(0.0f), | 284 radius_x_(0.0f), |
| 285 radius_y_(0.0f), | 285 radius_y_(0.0f), |
| 286 rotation_angle_(0.0f), | 286 rotation_angle_(0.0f), |
| 287 force_(0.0f) { | 287 force_(0.0f) { |
| 288 set_time_stamp(time_stamp); | 288 set_time_stamp(time_stamp); |
| 289 } | 289 } |
| 290 | 290 |
| 291 TouchEvent::~TouchEvent() { | 291 TouchEvent::~TouchEvent() { |
| 292 } | 292 } |
| 293 | 293 |
| 294 void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) { | |
| 295 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.
| |
| 296 int calibrated_y = y() * to.height() / from.height(); | |
| 297 location_ = gfx::Point(calibrated_x, calibrated_y); | |
| 298 | |
| 299 calibrated_x = root_location().x() * to.width() / from.width(); | |
| 300 calibrated_y = root_location().y() * to.height() / from.height(); | |
| 301 root_location_ = gfx::Point(calibrated_x, calibrated_y); | |
| 302 } | |
| 303 | |
| 294 void TouchEvent::UpdateForRootTransform(const Transform& root_transform) { | 304 void TouchEvent::UpdateForRootTransform(const Transform& root_transform) { |
| 295 LocatedEvent::UpdateForRootTransform(root_transform); | 305 LocatedEvent::UpdateForRootTransform(root_transform); |
| 296 gfx::Point3f scale; | 306 gfx::Point3f scale; |
| 297 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); | 307 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); |
| 298 if (scale.x()) | 308 if (scale.x()) |
| 299 radius_x_ /= scale.x(); | 309 radius_x_ /= scale.x(); |
| 300 if (scale.y()) | 310 if (scale.y()) |
| 301 radius_y_ /= scale.y(); | 311 radius_y_ /= scale.y(); |
| 302 } | 312 } |
| 303 | 313 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 int GestureEvent::GetLowestTouchId() const { | 502 int GestureEvent::GetLowestTouchId() const { |
| 493 if (touch_ids_bitfield_ == 0) | 503 if (touch_ids_bitfield_ == 0) |
| 494 return -1; | 504 return -1; |
| 495 int i = -1; | 505 int i = -1; |
| 496 // Find the index of the least significant 1 bit | 506 // Find the index of the least significant 1 bit |
| 497 while (!(1 << ++i & touch_ids_bitfield_)); | 507 while (!(1 << ++i & touch_ids_bitfield_)); |
| 498 return i; | 508 return i; |
| 499 } | 509 } |
| 500 | 510 |
| 501 } // namespace ui | 511 } // namespace ui |
| OLD | NEW |