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 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 |