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

Side by Side Diff: ui/wm/core/default_screen_position_client.cc

Issue 2648583003: Handle floating point coordinates from ozone to exosphere (Closed)
Patch Set: added F variant to screen position client. fixed exo tests. Created 3 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/wm/core/default_screen_position_client.h" 5 #include "ui/wm/core/default_screen_position_client.h"
6 6
7 #include "ui/aura/window_tree_host.h" 7 #include "ui/aura/window_tree_host.h"
8 #include "ui/display/screen.h" 8 #include "ui/display/screen.h"
9 #include "ui/gfx/geometry/point_conversions.h" 9 #include "ui/gfx/geometry/point_conversions.h"
10 #include "ui/gfx/geometry/rect.h" 10 #include "ui/gfx/geometry/rect.h"
(...skipping 11 matching lines...) Expand all
22 aura::Window* window = const_cast<aura::Window*>(root_window); 22 aura::Window* window = const_cast<aura::Window*>(root_window);
23 display::Screen* screen = display::Screen::GetScreen(); 23 display::Screen* screen = display::Screen::GetScreen();
24 gfx::Rect screen_bounds = root_window->GetHost()->GetBoundsInPixels(); 24 gfx::Rect screen_bounds = root_window->GetHost()->GetBoundsInPixels();
25 gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds); 25 gfx::Rect dip_bounds = screen->ScreenToDIPRectInWindow(window, screen_bounds);
26 return dip_bounds.origin(); 26 return dip_bounds.origin();
27 } 27 }
28 28
29 void DefaultScreenPositionClient::ConvertPointToScreen( 29 void DefaultScreenPositionClient::ConvertPointToScreen(
30 const aura::Window* window, 30 const aura::Window* window,
31 gfx::Point* point) { 31 gfx::Point* point) {
32 gfx::PointF point_f(*point);
33 ConvertPointToScreenF(window, &point_f);
34 *point = gfx::ToFlooredPoint(point_f);
35 }
36
37 void DefaultScreenPositionClient::ConvertPointToScreenF(
38 const aura::Window* window,
39 gfx::PointF* point) {
32 const aura::Window* root_window = window->GetRootWindow(); 40 const aura::Window* root_window = window->GetRootWindow();
33 aura::Window::ConvertPointToTarget(window, root_window, point); 41 aura::Window::ConvertPointToTargetF(window, root_window, point);
34 gfx::Point origin = GetOriginInScreen(root_window); 42 gfx::Point origin = GetOriginInScreen(root_window);
35 point->Offset(origin.x(), origin.y()); 43 point->Offset(origin.x(), origin.y());
36 } 44 }
37 45
38 void DefaultScreenPositionClient::ConvertPointFromScreen( 46 void DefaultScreenPositionClient::ConvertPointFromScreen(
39 const aura::Window* window, 47 const aura::Window* window,
40 gfx::Point* point) { 48 gfx::Point* point) {
49 gfx::PointF point_f(*point);
50 ConvertPointFromScreenF(window, &point_f);
51 *point = gfx::ToFlooredPoint(point_f);
52 }
53
54 void DefaultScreenPositionClient::ConvertPointFromScreenF(
55 const aura::Window* window,
56 gfx::PointF* point) {
41 const aura::Window* root_window = window->GetRootWindow(); 57 const aura::Window* root_window = window->GetRootWindow();
42 gfx::Point origin = GetOriginInScreen(root_window); 58 gfx::Point origin = GetOriginInScreen(root_window);
43 point->Offset(-origin.x(), -origin.y()); 59 point->Offset(-origin.x(), -origin.y());
44 aura::Window::ConvertPointToTarget(root_window, window, point); 60 aura::Window::ConvertPointToTargetF(root_window, window, point);
45 } 61 }
46 62
47 void DefaultScreenPositionClient::ConvertHostPointToScreen(aura::Window* window, 63 void DefaultScreenPositionClient::ConvertHostPointToScreen(aura::Window* window,
48 gfx::Point* point) { 64 gfx::Point* point) {
49 aura::Window* root_window = window->GetRootWindow(); 65 aura::Window* root_window = window->GetRootWindow();
50 ConvertPointToScreen(root_window, point); 66 ConvertPointToScreen(root_window, point);
51 } 67 }
52 68
53 void DefaultScreenPositionClient::SetBounds(aura::Window* window, 69 void DefaultScreenPositionClient::SetBounds(aura::Window* window,
54 const gfx::Rect& bounds, 70 const gfx::Rect& bounds,
55 const display::Display& display) { 71 const display::Display& display) {
56 window->SetBounds(bounds); 72 window->SetBounds(bounds);
57 } 73 }
58 74
59 } // namespace wm 75 } // namespace wm
OLDNEW
« ui/compositor/layer.cc ('K') | « ui/wm/core/default_screen_position_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698