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

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

Issue 11081007: Remove implicit flooring Scale() method from Point and Size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try -b win_rel,mac_rel,linux_rel,linux_aura 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 | 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 19 matching lines...) Expand all
30 #include "ui/base/events/event.h" 30 #include "ui/base/events/event.h"
31 #include "ui/base/gestures/gesture_recognizer.h" 31 #include "ui/base/gestures/gesture_recognizer.h"
32 #include "ui/base/gestures/gesture_types.h" 32 #include "ui/base/gestures/gesture_types.h"
33 #include "ui/base/hit_test.h" 33 #include "ui/base/hit_test.h"
34 #include "ui/compositor/compositor.h" 34 #include "ui/compositor/compositor.h"
35 #include "ui/compositor/dip_util.h" 35 #include "ui/compositor/dip_util.h"
36 #include "ui/compositor/layer.h" 36 #include "ui/compositor/layer.h"
37 #include "ui/compositor/layer_animator.h" 37 #include "ui/compositor/layer_animator.h"
38 #include "ui/gfx/display.h" 38 #include "ui/gfx/display.h"
39 #include "ui/gfx/point3.h" 39 #include "ui/gfx/point3.h"
40 #include "ui/gfx/point_conversions.h"
40 #include "ui/gfx/screen.h" 41 #include "ui/gfx/screen.h"
41 42
42 using std::vector; 43 using std::vector;
43 44
44 namespace aura { 45 namespace aura {
45 46
46 namespace { 47 namespace {
47 48
48 const int kCompositorLockTimeoutMs = 67; 49 const int kCompositorLockTimeoutMs = 67;
49 50
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 } 373 }
373 374
374 void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) { 375 void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) {
375 #if !defined(OS_MACOSX) 376 #if !defined(OS_MACOSX)
376 host_->PostNativeEvent(native_event); 377 host_->PostNativeEvent(native_event);
377 #endif 378 #endif
378 } 379 }
379 380
380 void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const { 381 void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const {
381 // TODO(oshima): Take the root window's transform into account. 382 // TODO(oshima): Take the root window's transform into account.
382 *point = point->Scale(ui::GetDeviceScaleFactor(layer())); 383 *point = gfx::ToFlooredPoint(point->Scale(ui::GetDeviceScaleFactor(layer())));
383 gfx::Point location = host_->GetLocationOnNativeScreen(); 384 gfx::Point location = host_->GetLocationOnNativeScreen();
384 point->Offset(location.x(), location.y()); 385 point->Offset(location.x(), location.y());
385 } 386 }
386 387
387 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const { 388 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const {
388 gfx::Point location = host_->GetLocationOnNativeScreen(); 389 gfx::Point location = host_->GetLocationOnNativeScreen();
389 point->Offset(-location.x(), -location.y()); 390 point->Offset(-location.x(), -location.y());
390 *point = point->Scale(1 / ui::GetDeviceScaleFactor(layer())); 391 *point = gfx::ToFlooredPoint(
392 point->Scale(1 / ui::GetDeviceScaleFactor(layer())));
391 } 393 }
392 394
393 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) { 395 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) {
394 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; 396 scoped_ptr<ui::GestureRecognizer::Gestures> gestures;
395 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed)); 397 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed));
396 ProcessGestures(gestures.get()); 398 ProcessGestures(gestures.get());
397 } 399 }
398 400
399 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { 401 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) {
400 gesture_recognizer_.reset(gr); 402 gesture_recognizer_.reset(gr);
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 void RootWindow::UnlockCompositor() { 1062 void RootWindow::UnlockCompositor() {
1061 DCHECK(compositor_lock_); 1063 DCHECK(compositor_lock_);
1062 compositor_lock_ = NULL; 1064 compositor_lock_ = NULL;
1063 if (draw_on_compositor_unlock_) { 1065 if (draw_on_compositor_unlock_) {
1064 draw_on_compositor_unlock_ = false; 1066 draw_on_compositor_unlock_ = false;
1065 ScheduleDraw(); 1067 ScheduleDraw();
1066 } 1068 }
1067 } 1069 }
1068 1070
1069 } // namespace aura 1071 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698