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 "ash/display/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "ash/ash_root_window_transformer.h" | 10 #include "ash/ash_root_window_transformer.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return; | 136 return; |
137 root_window->SetProperty(kRotationPropertyKey, info.rotation()); | 137 root_window->SetProperty(kRotationPropertyKey, info.rotation()); |
138 #endif | 138 #endif |
139 gfx::Transform rotate; | 139 gfx::Transform rotate; |
140 // TODO(oshima): Manually complute the inverse of the | 140 // TODO(oshima): Manually complute the inverse of the |
141 // rotate+translate matrix to compensate for computation error in | 141 // rotate+translate matrix to compensate for computation error in |
142 // the inverted matrix. Ideally, SkMatrix should have special | 142 // the inverted matrix. Ideally, SkMatrix should have special |
143 // case handling for rotate+translate case. crbug.com/222483. | 143 // case handling for rotate+translate case. crbug.com/222483. |
144 gfx::Transform reverse_rotate; | 144 gfx::Transform reverse_rotate; |
145 | 145 |
146 // The origin is (0, 0), so the translate width/height must be reduced by 1. | 146 // The origin is (0, 0), so the translate width/height must be reduced by |
| 147 // 1 pixel. |
| 148 float one_pixel = 1.0f / display.device_scale_factor(); |
147 switch (info.rotation()) { | 149 switch (info.rotation()) { |
148 case gfx::Display::ROTATE_0: | 150 case gfx::Display::ROTATE_0: |
149 break; | 151 break; |
150 case gfx::Display::ROTATE_90: | 152 case gfx::Display::ROTATE_90: |
151 rotate.Translate(display.bounds().height() - 1, 0); | 153 rotate.Translate(display.bounds().height() - one_pixel, 0); |
152 rotate.Rotate(90); | 154 rotate.Rotate(90); |
153 // Rotate 270 instead of 90 as it will cause calcuration error. | 155 // Rotate 270 instead of 90 as it will cause calcuration error. |
154 reverse_rotate.Rotate(270); | 156 reverse_rotate.Rotate(270); |
155 reverse_rotate.Translate(-(display.bounds().height() - 1), 0); | 157 reverse_rotate.Translate(-(display.bounds().height() - one_pixel), 0); |
156 break; | 158 break; |
157 case gfx::Display::ROTATE_270: | 159 case gfx::Display::ROTATE_270: |
158 rotate.Translate(0, display.bounds().width() - 1); | 160 rotate.Translate(0, display.bounds().width() - one_pixel); |
159 rotate.Rotate(270); | 161 rotate.Rotate(270); |
160 reverse_rotate.Rotate(90); | 162 reverse_rotate.Rotate(90); |
161 reverse_rotate.Translate(0, -(display.bounds().width() - 1)); | 163 reverse_rotate.Translate(0, -(display.bounds().width() - one_pixel)); |
162 break; | 164 break; |
163 case gfx::Display::ROTATE_180: | 165 case gfx::Display::ROTATE_180: |
164 rotate.Translate(display.bounds().width() - 1, | 166 rotate.Translate(display.bounds().width() - one_pixel, |
165 display.bounds().height() - 1); | 167 display.bounds().height() - one_pixel); |
166 rotate.Rotate(180); | 168 rotate.Rotate(180); |
167 reverse_rotate.Rotate(180); | 169 reverse_rotate.Rotate(180); |
168 reverse_rotate.Translate(-(display.bounds().width() - 1), | 170 reverse_rotate.Translate(-(display.bounds().width() - one_pixel), |
169 -(display.bounds().height() - 1)); | 171 -(display.bounds().height() - one_pixel)); |
170 break; | 172 break; |
171 } | 173 } |
172 scoped_ptr<aura::RootWindowTransformer> transformer( | 174 scoped_ptr<aura::RootWindowTransformer> transformer( |
173 new AshRootWindowTransformer(root_window, | 175 new AshRootWindowTransformer(root_window, |
174 rotate, | 176 rotate, |
175 reverse_rotate, | 177 reverse_rotate, |
176 info.GetOverscanInsetsInPixel(), | 178 info.GetOverscanInsetsInPixel(), |
177 info.ui_scale())); | 179 info.ui_scale())); |
178 root_window->SetRootWindowTransformer(transformer.Pass()); | 180 root_window->SetRootWindowTransformer(transformer.Pass()); |
179 } | 181 } |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 } | 1017 } |
1016 | 1018 |
1017 void DisplayController::OnFadeOutForSwapDisplayFinished() { | 1019 void DisplayController::OnFadeOutForSwapDisplayFinished() { |
1018 #if defined(OS_CHROMEOS) | 1020 #if defined(OS_CHROMEOS) |
1019 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); | 1021 SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); |
1020 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); | 1022 Shell::GetInstance()->output_configurator_animation()->StartFadeInAnimation(); |
1021 #endif | 1023 #endif |
1022 } | 1024 } |
1023 | 1025 |
1024 } // namespace ash | 1026 } // namespace ash |
OLD | NEW |