Chromium Code Reviews| Index: ash/display/root_window_transformers.cc |
| diff --git a/ash/display/root_window_transformers.cc b/ash/display/root_window_transformers.cc |
| index acaccaae88494c6a3e826272b4857f4cf6829c6d..c1e01d22d6a3db78223869c116daa49e782b26cf 100644 |
| --- a/ash/display/root_window_transformers.cc |
| +++ b/ash/display/root_window_transformers.cc |
| @@ -6,12 +6,14 @@ |
| #include <cmath> |
| +#include "ash/ash_switches.h" |
| #include "ash/display/display_info.h" |
| #include "ash/display/display_manager.h" |
| #include "ash/host/root_window_transformer.h" |
| #include "ash/magnifier/magnification_controller.h" |
| #include "ash/shell.h" |
| #include "base/basictypes.h" |
| +#include "base/command_line.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "third_party/skia/include/utils/SkMatrix44.h" |
| #include "ui/aura/window_event_dispatcher.h" |
| @@ -122,6 +124,15 @@ gfx::Transform CreateInsetsAndScaleTransform(const gfx::Insets& insets, |
| return transform; |
| } |
| +gfx::Transform CreateMirrorTransform(const gfx::Display& display) { |
|
Jun Mukai
2014/11/13 17:36:59
one more nit: could you write a comment for this f
oshima
2014/11/13 20:30:34
Added comment where the transform is applied.
|
| + gfx::Transform transform; |
| + transform.matrix().set3x3(-1, 0, 0, |
| + 0, 1, 0, |
| + 0, 0, 1); |
| + transform.Translate(-display.size().width(), 0); |
| + return transform; |
| +} |
| + |
| // RootWindowTransformer for ash environment. |
| class AshRootWindowTransformer : public RootWindowTransformer { |
| public: |
| @@ -137,7 +148,13 @@ class AshRootWindowTransformer : public RootWindowTransformer { |
| display.device_scale_factor(), |
| root_window_ui_scale_) * |
| CreateRotationTransform(root, display); |
| + if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kAshEnableMirroredScreen)) { |
| + root_window_bounds_transform_ = |
| + root_window_bounds_transform_ * CreateMirrorTransform(display); |
| + } |
| transform_ = root_window_bounds_transform_ * CreateMagnifierTransform(root); |
| + |
| CHECK(transform_.GetInverse(&invert_transform_)); |
| } |