| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); | 61 host_->SetRootTransform(GetRotationTransform() * GetUIScaleTransform()); |
| 62 } | 62 } |
| 63 | 63 |
| 64 gfx::Transform TestScreen::GetRotationTransform() const { | 64 gfx::Transform TestScreen::GetRotationTransform() const { |
| 65 gfx::Transform rotate; | 65 gfx::Transform rotate; |
| 66 float one_pixel = 1.0f / display_.device_scale_factor(); | 66 float one_pixel = 1.0f / display_.device_scale_factor(); |
| 67 switch (display_.rotation()) { | 67 switch (display_.rotation()) { |
| 68 case gfx::Display::ROTATE_0: | 68 case gfx::Display::ROTATE_0: |
| 69 break; | 69 break; |
| 70 case gfx::Display::ROTATE_90: | 70 case gfx::Display::ROTATE_90: |
| 71 rotate.Translate(display_.bounds().height() - one_pixel, 0); | 71 rotate.Translate(display_.bounds().width() - one_pixel, 0); |
| 72 rotate.Rotate(90); | 72 rotate.Rotate(90); |
| 73 break; | 73 break; |
| 74 case gfx::Display::ROTATE_270: | 74 case gfx::Display::ROTATE_270: |
| 75 rotate.Translate(0, display_.bounds().width() - one_pixel); | 75 rotate.Translate(0, display_.bounds().height() - one_pixel); |
| 76 rotate.Rotate(270); | 76 rotate.Rotate(270); |
| 77 break; | 77 break; |
| 78 case gfx::Display::ROTATE_180: | 78 case gfx::Display::ROTATE_180: |
| 79 rotate.Translate(display_.bounds().width() - one_pixel, | 79 rotate.Translate(display_.bounds().height() - one_pixel, |
| 80 display_.bounds().height() - one_pixel); | 80 display_.bounds().width() - one_pixel); |
| 81 rotate.Rotate(180); | 81 rotate.Rotate(180); |
| 82 break; | 82 break; |
| 83 } | 83 } |
| 84 | 84 |
| 85 return rotate; | 85 return rotate; |
| 86 } | 86 } |
| 87 | 87 |
| 88 gfx::Transform TestScreen::GetUIScaleTransform() const { | 88 gfx::Transform TestScreen::GetUIScaleTransform() const { |
| 89 gfx::Transform ui_scale; | 89 gfx::Transform ui_scale; |
| 90 ui_scale.Scale(1.0f / ui_scale_, 1.0f / ui_scale_); | 90 ui_scale.Scale(1.0f / ui_scale_, 1.0f / ui_scale_); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 153 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
| 154 : host_(NULL), | 154 : host_(NULL), |
| 155 ui_scale_(1.0f) { | 155 ui_scale_(1.0f) { |
| 156 static int64 synthesized_display_id = 2000; | 156 static int64 synthesized_display_id = 2000; |
| 157 display_.set_id(synthesized_display_id++); | 157 display_.set_id(synthesized_display_id++); |
| 158 display_.SetScaleAndBounds(1.0f, screen_bounds); | 158 display_.SetScaleAndBounds(1.0f, screen_bounds); |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace aura | 161 } // namespace aura |
| OLD | NEW |