OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/display/root_window_transformers.h" | 5 #include "ash/display/root_window_transformers.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_info.h" | 10 #include "ash/display/display_info.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 private: | 268 private: |
269 ~MirrorRootWindowTransformer() override {} | 269 ~MirrorRootWindowTransformer() override {} |
270 | 270 |
271 gfx::Transform transform_; | 271 gfx::Transform transform_; |
272 gfx::Rect root_bounds_; | 272 gfx::Rect root_bounds_; |
273 gfx::Insets insets_; | 273 gfx::Insets insets_; |
274 | 274 |
275 DISALLOW_COPY_AND_ASSIGN(MirrorRootWindowTransformer); | 275 DISALLOW_COPY_AND_ASSIGN(MirrorRootWindowTransformer); |
276 }; | 276 }; |
277 | 277 |
278 class PartialBoundsRootWindowTransformer : public RootWindowTransformer { | |
279 public: | |
280 PartialBoundsRootWindowTransformer(const gfx::Rect& screen_bounds, | |
281 const gfx::Display& display) { | |
282 gfx::SizeF root_size(display.bounds().size()); | |
283 root_size.Scale(display.device_scale_factor()); | |
284 root_bounds_ = gfx::Rect(gfx::ToFlooredSize(root_size)); | |
285 | |
286 transform_.Translate(-SkIntToMScalar(display.bounds().x()), | |
287 -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
| |
288 } | |
289 | |
290 // RootWindowTransformer: | |
291 gfx::Transform GetTransform() const override { return transform_; } | |
292 gfx::Transform GetInverseTransform() const override { | |
293 gfx::Transform invert; | |
294 CHECK(transform_.GetInverse(&invert)); | |
295 return invert; | |
296 } | |
297 gfx::Rect GetRootWindowBounds(const gfx::Size& host_size) const override { | |
298 return root_bounds_; | |
299 } | |
300 gfx::Insets GetHostInsets() const override { return gfx::Insets(); } | |
301 | |
302 private: | |
303 gfx::Transform transform_; | |
304 gfx::Rect root_bounds_; | |
305 | |
306 DISALLOW_COPY_AND_ASSIGN(PartialBoundsRootWindowTransformer); | |
307 }; | |
308 | |
278 } // namespace | 309 } // namespace |
279 | 310 |
280 RootWindowTransformer* CreateRootWindowTransformerForDisplay( | 311 RootWindowTransformer* CreateRootWindowTransformerForDisplay( |
281 aura::Window* root, | 312 aura::Window* root, |
282 const gfx::Display& display) { | 313 const gfx::Display& display) { |
283 return new AshRootWindowTransformer(root, display); | 314 return new AshRootWindowTransformer(root, display); |
284 } | 315 } |
285 | 316 |
286 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( | 317 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( |
287 const DisplayInfo& source_display_info, | 318 const DisplayInfo& source_display_info, |
288 const DisplayInfo& mirror_display_info) { | 319 const DisplayInfo& mirror_display_info) { |
289 return new MirrorRootWindowTransformer(source_display_info, | 320 return new MirrorRootWindowTransformer(source_display_info, |
290 mirror_display_info); | 321 mirror_display_info); |
291 } | 322 } |
292 | 323 |
324 RootWindowTransformer* CreateRootWindowTransformerForUnifiedDesktop( | |
325 const gfx::Rect& screen_bounds, | |
326 const gfx::Display& display) { | |
327 return new PartialBoundsRootWindowTransformer(screen_bounds, display); | |
328 } | |
329 | |
293 } // namespace ash | 330 } // namespace ash |
OLD | NEW |