Chromium Code Reviews| Index: remoting/host/chromeos/pixel_rotator.h |
| diff --git a/remoting/host/chromeos/pixel_rotator.h b/remoting/host/chromeos/pixel_rotator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..cd1c07717cb32452e060873920195778d0fdd63b |
| --- /dev/null |
| +++ b/remoting/host/chromeos/pixel_rotator.h |
| @@ -0,0 +1,57 @@ |
| +// 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_PIXEL_ROTATOR_H_ |
| +#define REMOTING_HOST_CHROMEOS_PIXEL_ROTATOR_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 coordinates system transformation between the root |
|
Wez
2014/12/06 01:55:17
coordinate transformations
kelvinp
2014/12/08 18:41:44
Done.
|
| +// window coordinates and the native screen coordinates, according to the |
| +// current display rotation settings. |
| +// |
| +// 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.
|
| +// left corner of the root window whereas the native screen coordinate is the |
| +// 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.
|
| +// coordinates systems are always in device pixels. |
| + |
| +// The root window coordinate of a pixel is different from its native screen |
| +// coordinate when the display is rotated. For example, when the display is |
| +// rotated by 90 deg, the pixel located (x, y) in the window is rendered at |
| +// (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
|
| +class PixelRotator : public aura::WindowObserver { |
|
Wez
2014/12/06 01:55:17
This doesn't touch pixels, and it may translate as
|
| + public: |
| + 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
|
| + ~PixelRotator(); |
|
Wez
2014/12/06 01:55:17
override
kelvinp
2014/12/08 18:41:44
Done.
|
| + |
| + // aura::WindowObserver interface. |
| + 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.
|
| + |
| + // Converts from the root window coordinate system to the native screen |
| + // coordinate system. |
| + gfx::PointF ToScreenPixel(const gfx::PointF& window_location); |
| + |
| + // Converts from the native screen coordinate system to the root window |
| + // coordinate system. |
| + gfx::PointF FromScreenPixel(const gfx::PointF& screen_location); |
| + |
| + private: |
| + aura::Window* root_window_; |
| + 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.
|
| + gfx::Transform inverse_; |
|
Wez
2014/12/06 01:55:17
similarly here
kelvinp
2014/12/08 18:41:44
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(PixelRotator); |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_HOST_CHROMEOS_PIXEL_ROTATOR_H_ |