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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 host_->window()->AddObserver(this); | 56 host_->window()->AddObserver(this); |
57 host_->InitHost(); | 57 host_->InitHost(); |
58 return host_; | 58 return host_; |
59 } | 59 } |
60 | 60 |
61 void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { | 61 void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { |
62 display::Display display(GetPrimaryDisplay()); | 62 display::Display display(GetPrimaryDisplay()); |
63 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); | 63 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); |
64 display.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); | 64 display.SetScaleAndBounds(device_scale_factor, bounds_in_pixel); |
65 display_list().UpdateDisplay(display); | 65 display_list().UpdateDisplay(display); |
66 host_->OnHostResized(bounds_in_pixel.size()); | 66 host_->OnHostResizedInPixels(bounds_in_pixel.size()); |
67 } | 67 } |
68 | 68 |
69 void TestScreen::SetDisplayRotation(display::Display::Rotation rotation) { | 69 void TestScreen::SetDisplayRotation(display::Display::Rotation rotation) { |
70 display::Display display(GetPrimaryDisplay()); | 70 display::Display display(GetPrimaryDisplay()); |
71 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); | 71 gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); |
72 gfx::Rect new_bounds(bounds_in_pixel); | 72 gfx::Rect new_bounds(bounds_in_pixel); |
73 if (IsRotationPortrait(rotation) != IsRotationPortrait(display.rotation())) { | 73 if (IsRotationPortrait(rotation) != IsRotationPortrait(display.rotation())) { |
74 new_bounds.set_width(bounds_in_pixel.height()); | 74 new_bounds.set_width(bounds_in_pixel.height()); |
75 new_bounds.set_height(bounds_in_pixel.width()); | 75 new_bounds.set_height(bounds_in_pixel.width()); |
76 } | 76 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 TestScreen::TestScreen(const gfx::Rect& screen_bounds, | 162 TestScreen::TestScreen(const gfx::Rect& screen_bounds, |
163 WindowTreeClient* window_tree_client) | 163 WindowTreeClient* window_tree_client) |
164 : host_(nullptr), ui_scale_(1.0f), window_tree_client_(window_tree_client) { | 164 : host_(nullptr), ui_scale_(1.0f), window_tree_client_(window_tree_client) { |
165 static int64_t synthesized_display_id = 2000; | 165 static int64_t synthesized_display_id = 2000; |
166 display::Display display(synthesized_display_id++); | 166 display::Display display(synthesized_display_id++); |
167 display.SetScaleAndBounds(1.0f, screen_bounds); | 167 display.SetScaleAndBounds(1.0f, screen_bounds); |
168 ProcessDisplayChanged(display, true /* is_primary */); | 168 ProcessDisplayChanged(display, true /* is_primary */); |
169 } | 169 } |
170 | 170 |
171 } // namespace aura | 171 } // namespace aura |
OLD | NEW |