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

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

Issue 12983010: Manually compute inverted matrix for screen rotation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« ash/display/display_controller.cc ('K') | « ui/base/events/event.h ('k') | no next file » | 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 base::TimeDelta time_stamp, 261 base::TimeDelta time_stamp,
262 int flags) 262 int flags)
263 : Event(type, time_stamp, flags), 263 : Event(type, time_stamp, flags),
264 location_(location), 264 location_(location),
265 root_location_(root_location), 265 root_location_(root_location),
266 valid_system_location_(false), 266 valid_system_location_(false),
267 system_location_(0, 0) { 267 system_location_(0, 0) {
268 } 268 }
269 269
270 void LocatedEvent::UpdateForRootTransform( 270 void LocatedEvent::UpdateForRootTransform(
271 const gfx::Transform& root_transform) { 271 const gfx::Transform& reversed_root_transform) {
272 // Transform has to be done at root level. 272 // Transform has to be done at root level.
273 gfx::Point3F p(location_); 273 gfx::Point3F p(location_);
274 root_transform.TransformPointReverse(p); 274 reversed_root_transform.TransformPoint(p);
275 // TODO(oshima): Translating a point using reversed matrix can
276 // results in small error like 0 -> -0.01, whose floored value
277 // is -1 instead of 0. crbug.com/222483.
278 root_location_ = location_ = gfx::ToFlooredPoint(p.AsPointF()); 275 root_location_ = location_ = gfx::ToFlooredPoint(p.AsPointF());
279 } 276 }
280 277
281 //////////////////////////////////////////////////////////////////////////////// 278 ////////////////////////////////////////////////////////////////////////////////
282 // MouseEvent 279 // MouseEvent
283 280
284 MouseEvent::MouseEvent(const base::NativeEvent& native_event) 281 MouseEvent::MouseEvent(const base::NativeEvent& native_event)
285 : LocatedEvent(native_event), 282 : LocatedEvent(native_event),
286 changed_button_flags_( 283 changed_button_flags_(
287 GetChangedMouseButtonFlagsFromNative(native_event)) { 284 GetChangedMouseButtonFlagsFromNative(native_event)) {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 int GestureEvent::GetLowestTouchId() const { 726 int GestureEvent::GetLowestTouchId() const {
730 if (touch_ids_bitfield_ == 0) 727 if (touch_ids_bitfield_ == 0)
731 return -1; 728 return -1;
732 int i = -1; 729 int i = -1;
733 // Find the index of the least significant 1 bit 730 // Find the index of the least significant 1 bit
734 while (!(1 << ++i & touch_ids_bitfield_)); 731 while (!(1 << ++i & touch_ids_bitfield_));
735 return i; 732 return i;
736 } 733 }
737 734
738 } // namespace ui 735 } // namespace ui
OLDNEW
« ash/display/display_controller.cc ('K') | « ui/base/events/event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698