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

Unified Diff: ash/display/screen_position_controller.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 side-by-side diff with in-line comments
Download patch
Index: ash/display/screen_position_controller.cc
diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc
index 6481c0f78055e0200b622385f730735f39019e71..45f8a3f6e269347368b3a2ae2f3cb3ab6b2a7d88 100644
--- a/ash/display/screen_position_controller.cc
+++ b/ash/display/screen_position_controller.cc
@@ -75,8 +75,15 @@ void ScreenPositionController::ConvertHostPointToRelativeToRootWindow(
void ScreenPositionController::ConvertPointToScreen(const aura::Window* window,
gfx::Point* point) {
+ gfx::PointF point_f(*point);
+ ConvertPointToScreenF(window, &point_f);
+ *point = gfx::ToFlooredPoint(point_f);
+}
+
+void ScreenPositionController::ConvertPointToScreenF(const aura::Window* window,
+ gfx::PointF* point) {
const aura::Window* root = window->GetRootWindow();
- aura::Window::ConvertPointToTarget(window, root, point);
+ aura::Window::ConvertPointToTargetF(window, root, point);
const gfx::Point display_origin =
display::Screen::GetScreen()
->GetDisplayNearestWindow(const_cast<aura::Window*>(root))
@@ -88,6 +95,14 @@ void ScreenPositionController::ConvertPointToScreen(const aura::Window* window,
void ScreenPositionController::ConvertPointFromScreen(
const aura::Window* window,
gfx::Point* point) {
+ gfx::PointF point_f(*point);
+ ConvertPointFromScreenF(window, &point_f);
+ *point = gfx::ToFlooredPoint(point_f);
+}
+
+void ScreenPositionController::ConvertPointFromScreenF(
+ const aura::Window* window,
+ gfx::PointF* point) {
const aura::Window* root = window->GetRootWindow();
const gfx::Point display_origin =
display::Screen::GetScreen()
@@ -95,7 +110,7 @@ void ScreenPositionController::ConvertPointFromScreen(
.bounds()
.origin();
point->Offset(-display_origin.x(), -display_origin.y());
- aura::Window::ConvertPointToTarget(root, window, point);
+ aura::Window::ConvertPointToTargetF(root, window, point);
}
void ScreenPositionController::ConvertHostPointToScreen(

Powered by Google App Engine
This is Rietveld 408576698