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

Unified Diff: remoting/host/chromeos/point_transformer.h

Issue 756643006: Remote assistance on Chrome OS Part IX - Input injection on Ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Ozone_input_injection
Patch Set: Address feedback (wez) Created 6 years 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
« no previous file with comments | « remoting/host/BUILD.gn ('k') | remoting/host/chromeos/point_transformer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromeos/point_transformer.h
diff --git a/remoting/host/chromeos/point_transformer.h b/remoting/host/chromeos/point_transformer.h
new file mode 100644
index 0000000000000000000000000000000000000000..c683b0134933397fadd21815171654fcb85ecd1a
--- /dev/null
+++ b/remoting/host/chromeos/point_transformer.h
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_CHROMEOS_POINT_TRANSFORMER_H_
+#define REMOTING_HOST_CHROMEOS_POINT_TRANSFORMER_H_
+
+#include "ui/aura/window_observer.h"
+#include "ui/gfx/geometry/point_f.h"
+#include "ui/gfx/transform.h"
+
+namespace aura {
+class Window;
+} // namespace aura
+
+namespace remoting {
+
+// A class that performs coordinate transformations between the root window
+// coordinates and the native screen coordinates, according to the current
+// display rotation settings.
+//
+// Root window coordinates are expressed relative to the top left corner of the
+// root window whereas native screen coordinates are expressed relative to the
+// top left corner of the frame buffer, which may not match the root window
+// either in origin nor orientation. Both coordinate systems are always in
+// device pixels.
+//
+// For example, when the display is rotated by 90 deg, the pixel at root window
+// coordinates (x, y) will have native screen coordinates (height - y, x).
+class PointTransformer : public aura::WindowObserver {
+ public:
+ PointTransformer();
+ ~PointTransformer() override;
+
+ // Converts from root window coordinates to native screen coordinates.
+ gfx::PointF ToScreenCoordinates(const gfx::PointF& window_location);
+
+ // Converts from native screen coordinates to root window coordinates.
+ gfx::PointF FromScreenCoordinates(const gfx::PointF& screen_location);
+
+ private:
+ // aura::WindowObserver interface.
+ void OnWindowTransformed(aura::Window* window) override;
+
+ aura::Window* root_window_;
+ gfx::Transform root_to_screen_;
+ gfx::Transform screen_to_root_;
+
+ DISALLOW_COPY_AND_ASSIGN(PointTransformer);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_CHROMEOS_POINT_TRANSFORMER_H_
« no previous file with comments | « remoting/host/BUILD.gn ('k') | remoting/host/chromeos/point_transformer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698