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..505cbbac74f64a131193b5d944d03545e5e9b240 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) { |
+ 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,15 @@ class AshRootWindowTransformer : public RootWindowTransformer { |
display.device_scale_factor(), |
root_window_ui_scale_) * |
CreateRotationTransform(root, display); |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kAshEnableMirroredScreen)) { |
+ // Apply the tranform that flips the screen image horizontally so that |
+ // the screen looks normal when reflected on a mirror. |
+ root_window_bounds_transform_ = |
+ root_window_bounds_transform_ * CreateMirrorTransform(display); |
+ } |
transform_ = root_window_bounds_transform_ * CreateMagnifierTransform(root); |
+ |
CHECK(transform_.GetInverse(&invert_transform_)); |
} |