Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: ash/display/root_window_transformers.cc

Issue 1071353003: Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/root_window_transformers_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/root_window_transformers.h" 5 #include "ash/display/root_window_transformers.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_info.h" 10 #include "ash/display/display_info.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 const gfx::Display& display) { 55 const gfx::Display& display) {
56 DisplayInfo info = 56 DisplayInfo info =
57 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); 57 Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id());
58 58
59 // TODO(oshima): Add animation. (crossfade+rotation, or just cross-fade) 59 // TODO(oshima): Add animation. (crossfade+rotation, or just cross-fade)
60 #if defined(OS_WIN) 60 #if defined(OS_WIN)
61 // Windows 8 bots refused to resize the host window, and 61 // Windows 8 bots refused to resize the host window, and
62 // updating the transform results in incorrectly resizing 62 // updating the transform results in incorrectly resizing
63 // the root window. Don't apply the transform unless 63 // the root window. Don't apply the transform unless
64 // necessary so that unit tests pass on win8 bots. 64 // necessary so that unit tests pass on win8 bots.
65 if (info.rotation() == root_window->GetProperty(kRotationPropertyKey)) 65 if (info.GetActiveRotation() ==
66 root_window->GetProperty(kRotationPropertyKey)) {
66 return gfx::Transform(); 67 return gfx::Transform();
67 root_window->SetProperty(kRotationPropertyKey, info.rotation()); 68 }
69 root_window->SetProperty(kRotationPropertyKey, info.GetActiveRotation());
68 #endif 70 #endif
69 71
70 gfx::Transform rotate; 72 gfx::Transform rotate;
71 // The origin is (0, 0), so the translate width/height must be reduced by 73 // The origin is (0, 0), so the translate width/height must be reduced by
72 // 1 pixel. 74 // 1 pixel.
73 float one_pixel = 1.0f / display.device_scale_factor(); 75 float one_pixel = 1.0f / display.device_scale_factor();
74 switch (info.rotation()) { 76 switch (info.GetActiveRotation()) {
75 case gfx::Display::ROTATE_0: 77 case gfx::Display::ROTATE_0:
76 break; 78 break;
77 case gfx::Display::ROTATE_90: 79 case gfx::Display::ROTATE_90:
78 rotate.Translate(display.bounds().height() - one_pixel, 0); 80 rotate.Translate(display.bounds().height() - one_pixel, 0);
79 rotate.Rotate(90); 81 rotate.Rotate(90);
80 break; 82 break;
81 case gfx::Display::ROTATE_270: 83 case gfx::Display::ROTATE_270:
82 rotate.Translate(0, display.bounds().width() - one_pixel); 84 rotate.Translate(0, display.bounds().width() - one_pixel);
83 rotate.Rotate(270); 85 rotate.Rotate(270);
84 break; 86 break;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 284 }
283 285
284 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay( 286 RootWindowTransformer* CreateRootWindowTransformerForMirroredDisplay(
285 const DisplayInfo& source_display_info, 287 const DisplayInfo& source_display_info,
286 const DisplayInfo& mirror_display_info) { 288 const DisplayInfo& mirror_display_info) {
287 return new MirrorRootWindowTransformer(source_display_info, 289 return new MirrorRootWindowTransformer(source_display_info,
288 mirror_display_info); 290 mirror_display_info);
289 } 291 }
290 292
291 } // namespace ash 293 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.cc ('k') | ash/display/root_window_transformers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698