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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void TestScreen::SetUIScale(float ui_scale) { | 70 void TestScreen::SetUIScale(float ui_scale) { |
71 ui_scale_ = ui_scale; | 71 ui_scale_ = ui_scale; |
72 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); | 72 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); |
73 gfx::Rect new_bounds = gfx::ToNearestRect( | 73 gfx::Rect new_bounds = gfx::ToNearestRect( |
74 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale)); | 74 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale)); |
75 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); | 75 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); |
76 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); | 76 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); |
77 } | 77 } |
78 | 78 |
| 79 void TestScreen::SetWorkAreaInsets(const gfx::Insets& insets) { |
| 80 display_.UpdateWorkAreaFromInsets(insets); |
| 81 } |
| 82 |
79 gfx::Transform TestScreen::GetRotationTransform() const { | 83 gfx::Transform TestScreen::GetRotationTransform() const { |
80 gfx::Transform rotate; | 84 gfx::Transform rotate; |
81 switch (display_.rotation()) { | 85 switch (display_.rotation()) { |
82 case gfx::Display::ROTATE_0: | 86 case gfx::Display::ROTATE_0: |
83 break; | 87 break; |
84 case gfx::Display::ROTATE_90: | 88 case gfx::Display::ROTATE_90: |
85 rotate.Translate(display_.bounds().height(), 0); | 89 rotate.Translate(display_.bounds().height(), 0); |
86 rotate.Rotate(90); | 90 rotate.Rotate(90); |
87 break; | 91 break; |
88 case gfx::Display::ROTATE_270: | 92 case gfx::Display::ROTATE_270: |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 170 |
167 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 171 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
168 : host_(NULL), | 172 : host_(NULL), |
169 ui_scale_(1.0f) { | 173 ui_scale_(1.0f) { |
170 static int64 synthesized_display_id = 2000; | 174 static int64 synthesized_display_id = 2000; |
171 display_.set_id(synthesized_display_id++); | 175 display_.set_id(synthesized_display_id++); |
172 display_.SetScaleAndBounds(1.0f, screen_bounds); | 176 display_.SetScaleAndBounds(1.0f, screen_bounds); |
173 } | 177 } |
174 | 178 |
175 } // namespace aura | 179 } // namespace aura |
OLD | NEW |