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

Side by Side Diff: ash/host/transformer_helper.cc

Issue 2525113002: Rename WindowTreeHost functions to indicate pixels/dips. (Closed)
Patch Set: win Created 4 years 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 unified diff | Download patch
« no previous file with comments | « ash/host/ash_window_tree_host_x11.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 7 #include <utility>
8 8
9 #include "ash/host/ash_window_tree_host.h" 9 #include "ash/host/ash_window_tree_host.h"
10 #include "ash/host/root_window_transformer.h" 10 #include "ash/host/root_window_transformer.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 void TransformerHelper::SetRootWindowTransformer( 81 void TransformerHelper::SetRootWindowTransformer(
82 std::unique_ptr<RootWindowTransformer> transformer) { 82 std::unique_ptr<RootWindowTransformer> transformer) {
83 transformer_ = std::move(transformer); 83 transformer_ = std::move(transformer);
84 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost(); 84 aura::WindowTreeHost* host = ash_host_->AsWindowTreeHost();
85 aura::Window* window = host->window(); 85 aura::Window* window = host->window();
86 window->SetTransform(transformer_->GetTransform()); 86 window->SetTransform(transformer_->GetTransform());
87 // 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
88 // size immediately. 88 // size immediately.
89 if (!window->layer()->GetAnimator()->is_animating()) 89 if (!window->layer()->GetAnimator()->is_animating())
90 host->UpdateRootWindowSize(host->GetBoundsInPixels().size()); 90 host->UpdateRootWindowSizeInPixels(host->GetBoundsInPixels().size());
91 } 91 }
92 92
93 gfx::Transform TransformerHelper::GetTransform() const { 93 gfx::Transform TransformerHelper::GetTransform() const {
94 float scale = ui::GetDeviceScaleFactor( 94 float scale = ui::GetDeviceScaleFactor(
95 ash_host_->AsWindowTreeHost()->window()->layer()); 95 ash_host_->AsWindowTreeHost()->window()->layer());
96 gfx::Transform transform; 96 gfx::Transform transform;
97 transform.Scale(scale, scale); 97 transform.Scale(scale, scale);
98 transform *= transformer_->GetTransform(); 98 transform *= transformer_->GetTransform();
99 return transform; 99 return transform;
100 } 100 }
101 101
102 gfx::Transform TransformerHelper::GetInverseTransform() const { 102 gfx::Transform TransformerHelper::GetInverseTransform() const {
103 float scale = ui::GetDeviceScaleFactor( 103 float scale = ui::GetDeviceScaleFactor(
104 ash_host_->AsWindowTreeHost()->window()->layer()); 104 ash_host_->AsWindowTreeHost()->window()->layer());
105 gfx::Transform transform; 105 gfx::Transform transform;
106 transform.Scale(1.0f / scale, 1.0f / scale); 106 transform.Scale(1.0f / scale, 1.0f / scale);
107 return transformer_->GetInverseTransform() * transform; 107 return transformer_->GetInverseTransform() * transform;
108 } 108 }
109 109
110 void TransformerHelper::UpdateWindowSize(const gfx::Size& host_size) { 110 void TransformerHelper::UpdateWindowSize(const gfx::Size& host_size) {
111 ash_host_->AsWindowTreeHost()->window()->SetBounds( 111 ash_host_->AsWindowTreeHost()->window()->SetBounds(
112 transformer_->GetRootWindowBounds(host_size)); 112 transformer_->GetRootWindowBounds(host_size));
113 } 113 }
114 114
115 } // namespace ash 115 } // namespace ash
OLDNEW
« no previous file with comments | « ash/host/ash_window_tree_host_x11.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698