| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/host/transformer_helper.h" | 5 #include "ash/host/transformer_helper.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "ash/host/ash_window_tree_host.h" | 9 #include "ash/host/ash_window_tree_host.h" |
| 8 #include "ash/host/root_window_transformer.h" | 10 #include "ash/host/root_window_transformer.h" |
| 9 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_tree_host.h" | 12 #include "ui/aura/window_tree_host.h" |
| 11 #include "ui/compositor/dip_util.h" | 13 #include "ui/compositor/dip_util.h" |
| 12 #include "ui/gfx/geometry/insets.h" | 14 #include "ui/gfx/geometry/insets.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/geometry/rect_f.h" | 16 #include "ui/gfx/geometry/rect_f.h" |
| 15 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/geometry/size_conversions.h" | 18 #include "ui/gfx/geometry/size_conversions.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 SetTransform(gfx::Transform()); | 68 SetTransform(gfx::Transform()); |
| 67 } | 69 } |
| 68 | 70 |
| 69 gfx::Insets TransformerHelper::GetHostInsets() const { | 71 gfx::Insets TransformerHelper::GetHostInsets() const { |
| 70 return transformer_->GetHostInsets(); | 72 return transformer_->GetHostInsets(); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void TransformerHelper::SetTransform(const gfx::Transform& transform) { | 75 void TransformerHelper::SetTransform(const gfx::Transform& transform) { |
| 74 scoped_ptr<RootWindowTransformer> transformer(new SimpleRootWindowTransformer( | 76 scoped_ptr<RootWindowTransformer> transformer(new SimpleRootWindowTransformer( |
| 75 ash_host_->AsWindowTreeHost()->window(), transform)); | 77 ash_host_->AsWindowTreeHost()->window(), transform)); |
| 76 SetRootWindowTransformer(transformer.Pass()); | 78 SetRootWindowTransformer(std::move(transformer)); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void TransformerHelper::SetRootWindowTransformer( | 81 void TransformerHelper::SetRootWindowTransformer( |
| 80 scoped_ptr<RootWindowTransformer> transformer) { | 82 scoped_ptr<RootWindowTransformer> transformer) { |
| 81 transformer_ = transformer.Pass(); | 83 transformer_ = std::move(transformer); |
| 82 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); | 84 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); |
| 83 aura::Window* window = host->window(); | 85 aura::Window* window = host->window(); |
| 84 window->SetTransform(transformer_->GetTransform()); | 86 window->SetTransform(transformer_->GetTransform()); |
| 85 // If the layer is not animating, then we need to update the root window | 87 // If the layer is not animating, then we need to update the root window |
| 86 // size immediately. | 88 // size immediately. |
| 87 if (!window->layer()->GetAnimator()->is_animating()) | 89 if (!window->layer()->GetAnimator()->is_animating()) |
| 88 host->UpdateRootWindowSize(host->GetBounds().size()); | 90 host->UpdateRootWindowSize(host->GetBounds().size()); |
| 89 } | 91 } |
| 90 | 92 |
| 91 gfx::Transform TransformerHelper::GetTransform() const { | 93 gfx::Transform TransformerHelper::GetTransform() const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 104 transform.Scale(1.0f / scale, 1.0f / scale); | 106 transform.Scale(1.0f / scale, 1.0f / scale); |
| 105 return transformer_->GetInverseTransform() * transform; | 107 return transformer_->GetInverseTransform() * transform; |
| 106 } | 108 } |
| 107 | 109 |
| 108 void TransformerHelper::UpdateWindowSize(const gfx::Size& host_size) { | 110 void TransformerHelper::UpdateWindowSize(const gfx::Size& host_size) { |
| 109 ash_host_->AsWindowTreeHost()->window()->SetBounds( | 111 ash_host_->AsWindowTreeHost()->window()->SetBounds( |
| 110 transformer_->GetRootWindowBounds(host_size)); | 112 transformer_->GetRootWindowBounds(host_size)); |
| 111 } | 113 } |
| 112 | 114 |
| 113 } // namespace ash | 115 } // namespace ash |
| OLD | NEW |