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

Unified Diff: ash/display/root_window_transformers.cc

Issue 1107733006: Unified Desktop: hook up ash to allow unified desktop mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
Index: ash/display/root_window_transformers.cc
diff --git a/ash/display/root_window_transformers.cc b/ash/display/root_window_transformers.cc
index 8a028b37a1061f9ac21f2dbc7396288cce216d88..6a9eea345348b34e6885ffda339be72320cba41d 100644
--- a/ash/display/root_window_transformers.cc
+++ b/ash/display/root_window_transformers.cc
@@ -275,6 +275,37 @@ class MirrorRootWindowTransformer : public RootWindowTransformer {
DISALLOW_COPY_AND_ASSIGN(MirrorRootWindowTransformer);
};
+class PartialBoundsRootWindowTransformer : public RootWindowTransformer {
+ public:
+ PartialBoundsRootWindowTransformer(const gfx::Rect& screen_bounds,
+ const gfx::Display& display) {
+ gfx::SizeF root_size(display.bounds().size());
+ root_size.Scale(display.device_scale_factor());
+ root_bounds_ = gfx::Rect(gfx::ToFlooredSize(root_size));
+
+ transform_.Translate(-SkIntToMScalar(display.bounds().x()),
+ -SkIntToMScalar(display.bounds().y()));
Jun Mukai 2015/04/27 18:23:40 Looks like it doesn't scale if the display height/
oshima 2015/04/27 20:30:55 Width can be different, but different height does
+ }
+
+ // RootWindowTransformer:
+ gfx::Transform GetTransform() const override { return transform_; }
+ gfx::Transform GetInverseTransform() const override {
+ gfx::Transform invert;
+ CHECK(transform_.GetInverse(&invert));
+ return invert;
+ }
+ gfx::Rect GetRootWindowBounds(const gfx::Size& host_size) const override {
+ return root_bounds_;
+ }
+ gfx::Insets GetHostInsets() const override { return gfx::Insets(); }
+
+ private:
+ gfx::Transform transform_;
+ gfx::Rect root_bounds_;
+
+ DISALLOW_COPY_AND_ASSIGN(PartialBoundsRootWindowTransformer);
+};
+
} // namespace
RootWindowTransformer* CreateRootWindowTransformerForDisplay(
@@ -290,4 +321,10 @@ RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay(
mirror_display_info);
}
+RootWindowTransformer* CreateRootWindowTransformerForUnifiedDesktop(
+ const gfx::Rect& screen_bounds,
+ const gfx::Display& display) {
+ return new PartialBoundsRootWindowTransformer(screen_bounds, display);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698