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/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 20 matching lines...) Expand all Loading... |
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/base/view_prop.h" | 34 #include "ui/base/view_prop.h" |
35 #include "ui/compositor/compositor.h" | 35 #include "ui/compositor/compositor.h" |
36 #include "ui/compositor/dip_util.h" | 36 #include "ui/compositor/dip_util.h" |
37 #include "ui/compositor/layer.h" | 37 #include "ui/compositor/layer.h" |
38 #include "ui/compositor/layer_animator.h" | 38 #include "ui/compositor/layer_animator.h" |
39 #include "ui/gfx/display.h" | 39 #include "ui/gfx/display.h" |
40 #include "ui/gfx/point3.h" | 40 #include "ui/gfx/point3.h" |
| 41 #include "ui/gfx/point_conversions.h" |
41 #include "ui/gfx/screen.h" | 42 #include "ui/gfx/screen.h" |
42 | 43 |
43 using std::vector; | 44 using std::vector; |
44 | 45 |
45 namespace aura { | 46 namespace aura { |
46 | 47 |
47 namespace { | 48 namespace { |
48 | 49 |
49 const char kRootWindowForAcceleratedWidget[] = | 50 const char kRootWindowForAcceleratedWidget[] = |
50 "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__"; | 51 "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__"; |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 381 } |
381 | 382 |
382 void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) { | 383 void RootWindow::PostNativeEvent(const base::NativeEvent& native_event) { |
383 #if !defined(OS_MACOSX) | 384 #if !defined(OS_MACOSX) |
384 host_->PostNativeEvent(native_event); | 385 host_->PostNativeEvent(native_event); |
385 #endif | 386 #endif |
386 } | 387 } |
387 | 388 |
388 void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const { | 389 void RootWindow::ConvertPointToNativeScreen(gfx::Point* point) const { |
389 // TODO(oshima): Take the root window's transform into account. | 390 // TODO(oshima): Take the root window's transform into account. |
390 *point = point->Scale(ui::GetDeviceScaleFactor(layer())); | 391 *point = gfx::ToFlooredPoint(point->Scale(ui::GetDeviceScaleFactor(layer()))); |
391 gfx::Point location = host_->GetLocationOnNativeScreen(); | 392 gfx::Point location = host_->GetLocationOnNativeScreen(); |
392 point->Offset(location.x(), location.y()); | 393 point->Offset(location.x(), location.y()); |
393 } | 394 } |
394 | 395 |
395 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const { | 396 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const { |
396 gfx::Point location = host_->GetLocationOnNativeScreen(); | 397 gfx::Point location = host_->GetLocationOnNativeScreen(); |
397 point->Offset(-location.x(), -location.y()); | 398 point->Offset(-location.x(), -location.y()); |
398 *point = point->Scale(1 / ui::GetDeviceScaleFactor(layer())); | 399 *point = gfx::ToFlooredPoint( |
| 400 point->Scale(1 / ui::GetDeviceScaleFactor(layer()))); |
399 } | 401 } |
400 | 402 |
401 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) { | 403 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) { |
402 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; | 404 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
403 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed)); | 405 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed)); |
404 ProcessGestures(gestures.get()); | 406 ProcessGestures(gestures.get()); |
405 } | 407 } |
406 | 408 |
407 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { | 409 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { |
408 gesture_recognizer_.reset(gr); | 410 gesture_recognizer_.reset(gr); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1068 void RootWindow::UnlockCompositor() { | 1070 void RootWindow::UnlockCompositor() { |
1069 DCHECK(compositor_lock_); | 1071 DCHECK(compositor_lock_); |
1070 compositor_lock_ = NULL; | 1072 compositor_lock_ = NULL; |
1071 if (draw_on_compositor_unlock_) { | 1073 if (draw_on_compositor_unlock_) { |
1072 draw_on_compositor_unlock_ = false; | 1074 draw_on_compositor_unlock_ = false; |
1073 ScheduleDraw(); | 1075 ScheduleDraw(); |
1074 } | 1076 } |
1075 } | 1077 } |
1076 | 1078 |
1077 } // namespace aura | 1079 } // namespace aura |
OLD | NEW |