Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2151)

Unified Diff: ash/display/root_window_transformers.cc

Issue 715543004: Add mirrored screen option (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/ash_switches.cc ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_));
}
« no previous file with comments | « ash/ash_switches.cc ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698