| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 void TestScreen::SetUIScale(float ui_scale) { | 55 void TestScreen::SetUIScale(float ui_scale) { |
| 56 ui_scale_ = ui_scale; | 56 ui_scale_ = ui_scale; |
| 57 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); | 57 gfx::Rect bounds_in_pixel(display_.GetSizeInPixel()); |
| 58 gfx::Rect new_bounds = gfx::ToNearestRect( | 58 gfx::Rect new_bounds = gfx::ToNearestRect( |
| 59 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale)); | 59 gfx::ScaleRect(bounds_in_pixel, 1.0f / ui_scale)); |
| 60 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); | 60 display_.SetScaleAndBounds(display_.device_scale_factor(), new_bounds); |
| 61 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); | 61 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void TestScreen::SetWorkAreaInsets(const gfx::Insets& insets) { |
| 65 display_.UpdateWorkAreaFromInsets(insets); |
| 66 } |
| 67 |
| 64 gfx::Transform TestScreen::GetRotationTransform() const { | 68 gfx::Transform TestScreen::GetRotationTransform() const { |
| 65 gfx::Transform rotate; | 69 gfx::Transform rotate; |
| 66 float one_pixel = 1.0f / display_.device_scale_factor(); | 70 float one_pixel = 1.0f / display_.device_scale_factor(); |
| 67 switch (display_.rotation()) { | 71 switch (display_.rotation()) { |
| 68 case gfx::Display::ROTATE_0: | 72 case gfx::Display::ROTATE_0: |
| 69 break; | 73 break; |
| 70 case gfx::Display::ROTATE_90: | 74 case gfx::Display::ROTATE_90: |
| 71 rotate.Translate(display_.bounds().height() - one_pixel, 0); | 75 rotate.Translate(display_.bounds().height() - one_pixel, 0); |
| 72 rotate.Rotate(90); | 76 rotate.Rotate(90); |
| 73 break; | 77 break; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 156 |
| 153 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 157 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
| 154 : host_(NULL), | 158 : host_(NULL), |
| 155 ui_scale_(1.0f) { | 159 ui_scale_(1.0f) { |
| 156 static int64 synthesized_display_id = 2000; | 160 static int64 synthesized_display_id = 2000; |
| 157 display_.set_id(synthesized_display_id++); | 161 display_.set_id(synthesized_display_id++); |
| 158 display_.SetScaleAndBounds(1.0f, screen_bounds); | 162 display_.SetScaleAndBounds(1.0f, screen_bounds); |
| 159 } | 163 } |
| 160 | 164 |
| 161 } // namespace aura | 165 } // namespace aura |
| OLD | NEW |