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_PIXEL_ROTATOR_H_ | |
| 6 #define REMOTING_HOST_CHROMEOS_PIXEL_ROTATOR_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 system transformation between the root | |
|
Wez
2014/12/06 01:55:17
coordinate transformations
kelvinp
2014/12/08 18:41:44
Done.
| |
| 19 // window coordinates and the native screen coordinates, according to the | |
| 20 // current display rotation settings. | |
| 21 // | |
| 22 // The root window coordinate of a pixel is its relative location to the top | |
|
Wez
2014/12/06 01:55:17
Root window coordinates are expressed relative to
kelvinp
2014/12/08 18:41:44
Done.
| |
| 23 // left corner of the root window whereas the native screen coordinate is the | |
| 24 // physical location of the pixel that is rendered on the display. Both | |
|
Wez
2014/12/06 01:55:17
What does "physical location" mean? Presumably you
kelvinp
2014/12/08 18:41:44
Done.
| |
| 25 // coordinates systems are always in device pixels. | |
| 26 | |
| 27 // The root window coordinate of a pixel is different from its native screen | |
| 28 // coordinate when the display is rotated. For example, when the display is | |
| 29 // rotated by 90 deg, the pixel located (x, y) in the window is rendered at | |
| 30 // (height - y, x) on the display. | |
|
Wez
2014/12/06 01:55:17
This comment just seems a more specific example of
kelvinp
2014/12/08 18:41:44
Yes, it is always better to illustrate with an exa
| |
| 31 class PixelRotator : public aura::WindowObserver { | |
|
Wez
2014/12/06 01:55:17
This doesn't touch pixels, and it may translate as
| |
| 32 public: | |
| 33 PixelRotator(); | |
|
Wez
2014/12/06 01:55:17
Presumably the root window is bound when the ctor
kelvinp
2014/12/08 18:41:44
Yes
| |
| 34 ~PixelRotator(); | |
|
Wez
2014/12/06 01:55:17
override
kelvinp
2014/12/08 18:41:44
Done.
| |
| 35 | |
| 36 // aura::WindowObserver interface. | |
| 37 void OnWindowTransformed(aura::Window* window) override; | |
|
Wez
2014/12/06 01:55:17
Is this part of the PixelRotator interface? If not
kelvinp
2014/12/08 18:41:44
Done.
| |
| 38 | |
| 39 // Converts from the root window coordinate system to the native screen | |
| 40 // coordinate system. | |
| 41 gfx::PointF ToScreenPixel(const gfx::PointF& window_location); | |
| 42 | |
| 43 // Converts from the native screen coordinate system to the root window | |
| 44 // coordinate system. | |
| 45 gfx::PointF FromScreenPixel(const gfx::PointF& screen_location); | |
| 46 | |
| 47 private: | |
| 48 aura::Window* root_window_; | |
| 49 gfx::Transform transform_; | |
|
Wez
2014/12/06 01:55:17
suggest root_to_screen or root_to_native
kelvinp
2014/12/08 18:41:44
Done.
| |
| 50 gfx::Transform inverse_; | |
|
Wez
2014/12/06 01:55:17
similarly here
kelvinp
2014/12/08 18:41:44
Done.
| |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(PixelRotator); | |
| 53 }; | |
| 54 | |
| 55 } // namespace remoting | |
| 56 | |
| 57 #endif // REMOTING_HOST_CHROMEOS_PIXEL_ROTATOR_H_ | |
| OLD | NEW |