Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_HOST_CHROMEOS_POINT_TRANSFORMER_H_ | |
| 6 #define REMOTING_HOST_CHROMEOS_POINT_TRANSFORMER_H_ | |
| 7 | |
| 8 #include "ui/aura/window_observer.h" | |
| 9 #include "ui/gfx/geometry/point_f.h" | |
| 10 #include "ui/gfx/transform.h" | |
| 11 | |
| 12 namespace aura { | |
| 13 class Window; | |
| 14 } // namespace aura | |
| 15 | |
| 16 namespace remoting { | |
| 17 | |
| 18 // A class that performs coordinates transformations between the root window | |
|
Wez
2014/12/09 01:36:44
coordinate
kelvinp
2014/12/09 20:24:18
Done.
| |
| 19 // coordinates and the native screen coordinates, according to the current | |
| 20 // display rotation settings. | |
| 21 // | |
| 22 // Root window coordinates are expressed relative to the top left corner of the | |
| 23 // root window whereas native screen coordinates are expressed relative to the | |
| 24 // top left corner of the frame buffer, which may not match the root window | |
| 25 // either in origin nor orientation. Both coordinates systems are always in | |
|
Wez
2014/12/09 01:36:44
coordinate
kelvinp
2014/12/09 20:24:18
Done.
| |
| 26 // device pixels. | |
| 27 // | |
| 28 // For example, when the display is rotated by 90 deg, the pixel at root window | |
| 29 // coordinates (x, y) will have native screen coordinates (height - y, x). | |
| 30 class PointTransformer : public aura::WindowObserver { | |
| 31 public: | |
| 32 PointTransformer(); | |
| 33 ~PointTransformer() override; | |
| 34 | |
| 35 // Converts from root window coordinates to native screen coordinates. | |
| 36 gfx::PointF ToScreenCoordinates(const gfx::PointF& window_location); | |
| 37 | |
| 38 // Converts from native screen coordinates to root window coordinates. | |
| 39 gfx::PointF FromScreenCoordinates(const gfx::PointF& screen_location); | |
| 40 | |
| 41 private: | |
| 42 // aura::WindowObserver interface. | |
| 43 void OnWindowTransformed(aura::Window* window) override; | |
| 44 | |
| 45 aura::Window* root_window_; | |
| 46 gfx::Transform root_to_screen_; | |
| 47 gfx::Transform screen_to_root_; | |
| 48 | |
| 49 DISALLOW_COPY_AND_ASSIGN(PointTransformer); | |
| 50 }; | |
| 51 | |
| 52 } // namespace remoting | |
| 53 | |
| 54 #endif // REMOTING_HOST_CHROMEOS_POINT_TRANSFORMER_H_ | |
| OLD | NEW |