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

Side by Side Diff: ui/aura/root_window.cc

Issue 11369144: ui: Make gfx::Point::Scale() mutate the class, similar to gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes for aura Created 8 years, 1 month 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
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/aura/root_window.h" 5 #include "ui/aura/root_window.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) { 340 void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) {
341 #if !defined(OS_MACOSX) 341 #if !defined(OS_MACOSX)
342 host_->PostNativeEvent(native_event); 342 host_->PostNativeEvent(native_event);
343 #endif 343 #endif
344 } 344 }
345 345
346 void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const { 346 void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const {
347 // TODO(oshima): Take the root window's transform into account. 347 // TODO(oshima): Take the root window's transform into account.
348 *point = gfx::ToFlooredPoint(point->Scale(ui::GetDeviceScaleFactor(layer()))); 348 *point = gfx::ToFlooredPoint(
349 gfx::ScalePoint(*point, ui::GetDeviceScaleFactor(layer())));
349 gfx::Point location = host_->GetLocationOnNativeScreen(); 350 gfx::Point location = host_->GetLocationOnNativeScreen();
350 point->Offset(location.x(), location.y()); 351 point->Offset(location.x(), location.y());
351 } 352 }
352 353
353 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const { 354 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const {
354 gfx::Point location = host_->GetLocationOnNativeScreen(); 355 gfx::Point location = host_->GetLocationOnNativeScreen();
355 point->Offset(-location.x(), -location.y()); 356 point->Offset(-location.x(), -location.y());
356 *point = gfx::ToFlooredPoint( 357 *point = gfx::ToFlooredPoint(
357 point->Scale(1 / ui::GetDeviceScaleFactor(layer()))); 358 gfx::ScalePoint(*point, 1 / ui::GetDeviceScaleFactor(layer())));
358 } 359 }
359 360
360 void RootWindow::ProcessedTouchEvent(ui::TouchEvent* event, 361 void RootWindow::ProcessedTouchEvent(ui::TouchEvent* event,
361 Window* window, 362 Window* window,
362 ui::EventResult result) { 363 ui::EventResult result) {
363 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; 364 scoped_ptr<ui::GestureRecognizer::Gestures> gestures;
364 gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture( 365 gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture(
365 *event, result, window)); 366 *event, result, window));
366 ProcessGestures(gestures.get()); 367 ProcessGestures(gestures.get());
367 } 368 }
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 ui::MouseEvent event(ui::ET_MOUSE_MOVED, 1040 ui::MouseEvent event(ui::ET_MOUSE_MOVED,
1040 orig_mouse_location, 1041 orig_mouse_location,
1041 orig_mouse_location, 1042 orig_mouse_location,
1042 ui::EF_IS_SYNTHESIZED); 1043 ui::EF_IS_SYNTHESIZED);
1043 event.set_system_location(Env::GetInstance()->last_mouse_location()); 1044 event.set_system_location(Env::GetInstance()->last_mouse_location());
1044 OnHostMouseEvent(&event); 1045 OnHostMouseEvent(&event);
1045 #endif 1046 #endif
1046 } 1047 }
1047 1048
1048 } // namespace aura 1049 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698