Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: ui/base/events/event.cc

Issue 11145005: Migrate ui::Transform to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Hopefully should work this time Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/events/event.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const gfx::Point& location, 136 const gfx::Point& location,
137 const gfx::Point& root_location, 137 const gfx::Point& root_location,
138 int flags) 138 int flags)
139 : Event(type, flags), 139 : Event(type, flags),
140 location_(location), 140 location_(location),
141 root_location_(root_location), 141 root_location_(root_location),
142 valid_system_location_(false), 142 valid_system_location_(false),
143 system_location_(0, 0) { 143 system_location_(0, 0) {
144 } 144 }
145 145
146 void LocatedEvent::UpdateForRootTransform(const Transform& root_transform) { 146 void LocatedEvent::UpdateForRootTransform(
147 const gfx::Transform& root_transform) {
147 // Transform has to be done at root level. 148 // Transform has to be done at root level.
148 DCHECK_EQ(root_location_.x(), location_.x()); 149 DCHECK_EQ(root_location_.x(), location_.x());
149 DCHECK_EQ(root_location_.y(), location_.y()); 150 DCHECK_EQ(root_location_.y(), location_.y());
150 gfx::Point3f p(location_); 151 gfx::Point3f p(location_);
151 root_transform.TransformPointReverse(p); 152 root_transform.TransformPointReverse(p);
152 root_location_ = location_ = p.AsPoint(); 153 root_location_ = location_ = p.AsPoint();
153 } 154 }
154 155
155 //////////////////////////////////////////////////////////////////////////////// 156 ////////////////////////////////////////////////////////////////////////////////
156 // MouseEvent 157 // MouseEvent
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 308 }
308 309
309 TouchEvent::~TouchEvent() { 310 TouchEvent::~TouchEvent() {
310 } 311 }
311 312
312 void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) { 313 void TouchEvent::CalibrateLocation(const gfx::Size& from, const gfx::Size& to) {
313 location_ = CalibratePoint(location_, from, to); 314 location_ = CalibratePoint(location_, from, to);
314 root_location_ = CalibratePoint(root_location_, from, to); 315 root_location_ = CalibratePoint(root_location_, from, to);
315 } 316 }
316 317
317 void TouchEvent::UpdateForRootTransform(const Transform& root_transform) { 318 void TouchEvent::UpdateForRootTransform(const gfx::Transform& root_transform) {
318 LocatedEvent::UpdateForRootTransform(root_transform); 319 LocatedEvent::UpdateForRootTransform(root_transform);
319 gfx::Point3f scale; 320 gfx::Point3f scale;
320 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale); 321 InterpolatedTransform::FactorTRS(root_transform, NULL, NULL, &scale);
321 if (scale.x()) 322 if (scale.x())
322 radius_x_ /= scale.x(); 323 radius_x_ /= scale.x();
323 if (scale.y()) 324 if (scale.y())
324 radius_y_ /= scale.y(); 325 radius_y_ /= scale.y();
325 } 326 }
326 327
327 //////////////////////////////////////////////////////////////////////////////// 328 ////////////////////////////////////////////////////////////////////////////////
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 int GestureEvent::GetLowestTouchId() const { 516 int GestureEvent::GetLowestTouchId() const {
516 if (touch_ids_bitfield_ == 0) 517 if (touch_ids_bitfield_ == 0)
517 return -1; 518 return -1;
518 int i = -1; 519 int i = -1;
519 // Find the index of the least significant 1 bit 520 // Find the index of the least significant 1 bit
520 while (!(1 << ++i & touch_ids_bitfield_)); 521 while (!(1 << ++i & touch_ids_bitfield_));
521 return i; 522 return i;
522 } 523 }
523 524
524 } // namespace ui 525 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/events/event.h ('k') | ui/compositor/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698