OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/test/test_screen.h" | 5 #include "ui/aura/test/test_screen.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 display_.set_rotation(rotation); | 69 display_.set_rotation(rotation); |
70 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); | 70 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); |
71 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); | 71 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); |
72 } | 72 } |
73 | 73 |
74 void TestScreen::SetUIScale(float ui_scale) { | 74 void TestScreen::SetUIScale(float ui_scale) { |
75 ui_scale_ = ui_scale; | 75 ui_scale_ = ui_scale; |
76 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); | 76 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); |
77 gfx::Rect new_bounds = gfx::ToNearestRect( | 77 gfx::Rect new_bounds = gfx::ToNearestRect( |
78 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale)); | 78 gfx::ScaleRect(gfx::RectF(bounds_in_pixel), 1.0f / ui_scale)); |
79 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); | 79 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); |
80 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); | 80 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); |
81 } | 81 } |
82 | 82 |
83 void TestScreen::SetWorkAreaInsets(const gfx::Insets& insets) { | 83 void TestScreen::SetWorkAreaInsets(const gfx::Insets& insets) { |
84 display_.UpdateWorkAreaFromInsets(insets); | 84 display_.UpdateWorkAreaFromInsets(insets); |
85 } | 85 } |
86 | 86 |
87 gfx::Transform TestScreen::GetRotationTransform() const { | 87 gfx::Transform TestScreen::GetRotationTransform() const { |
88 gfx::Transform rotate; | 88 gfx::Transform rotate; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 171 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
172 : host_(NULL), | 172 : host_(NULL), |
173 ui_scale_(1.0f) { | 173 ui_scale_(1.0f) { |
174 static int64 synthesized_display_id = 2000; | 174 static int64 synthesized_display_id = 2000; |
175 display_.set_id(synthesized_display_id++); | 175 display_.set_id(synthesized_display_id++); |
176 display_.SetScaleAndBounds(1.0f, screen_bounds); | 176 display_.SetScaleAndBounds(1.0f, screen_bounds); |
177 } | 177 } |
178 | 178 |
179 } // namespace aura | 179 } // namespace aura |
OLD | NEW |