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

Side by Side Diff: ash/rotator/screen_rotation_animator.cc

Issue 1540753002: Switch to standard integer types in ash/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: arraysize Created 5 years 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/rotator/screen_rotation_animator.h ('k') | ash/rotator/window_rotation.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/rotator/screen_rotation_animator.h" 5 #include "ash/rotator/screen_rotation_animator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/display/display_info.h" 10 #include "ash/display/display_info.h"
(...skipping 24 matching lines...) Expand all
35 namespace { 35 namespace {
36 36
37 // The number of degrees that the rotation animations animate through. 37 // The number of degrees that the rotation animations animate through.
38 const int kRotationDegrees = 20; 38 const int kRotationDegrees = 20;
39 39
40 // The time it takes for the rotation animations to run. 40 // The time it takes for the rotation animations to run.
41 const int kRotationDurationInMs = 250; 41 const int kRotationDurationInMs = 250;
42 42
43 // Gets the current display rotation for the display with the specified 43 // Gets the current display rotation for the display with the specified
44 // |display_id|. 44 // |display_id|.
45 gfx::Display::Rotation GetCurrentRotation(int64 display_id) { 45 gfx::Display::Rotation GetCurrentRotation(int64_t display_id) {
46 return Shell::GetInstance() 46 return Shell::GetInstance()
47 ->display_manager() 47 ->display_manager()
48 ->GetDisplayInfo(display_id) 48 ->GetDisplayInfo(display_id)
49 .GetActiveRotation(); 49 .GetActiveRotation();
50 } 50 }
51 51
52 // Returns true if the rotation between |initial_rotation| and |new_rotation| is 52 // Returns true if the rotation between |initial_rotation| and |new_rotation| is
53 // 180 degrees. 53 // 180 degrees.
54 bool Is180DegreeFlip(gfx::Display::Rotation initial_rotation, 54 bool Is180DegreeFlip(gfx::Display::Rotation initial_rotation,
55 gfx::Display::Rotation new_rotation) { 55 gfx::Display::Rotation new_rotation) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 for (ui::Layer* child_layer : layer->children()) 138 for (ui::Layer* child_layer : layer->children())
139 AbortAnimations(child_layer); 139 AbortAnimations(child_layer);
140 layer->GetAnimator()->AbortAllAnimations(); 140 layer->GetAnimator()->AbortAllAnimations();
141 } 141 }
142 142
143 // Set the screen orientation for the given |display_id| to |new_rotation| and 143 // Set the screen orientation for the given |display_id| to |new_rotation| and
144 // animate the change. The animation will rotate the initial orientation's 144 // animate the change. The animation will rotate the initial orientation's
145 // layer towards the new orientation through |rotation_degrees| while fading 145 // layer towards the new orientation through |rotation_degrees| while fading
146 // out, and the new orientation's layer will be rotated in to the 146 // out, and the new orientation's layer will be rotated in to the
147 // |new_orientation| through |rotation_degrees| arc. 147 // |new_orientation| through |rotation_degrees| arc.
148 void RotateScreen(int64 display_id, 148 void RotateScreen(int64_t display_id,
149 gfx::Display::Rotation new_rotation, 149 gfx::Display::Rotation new_rotation,
150 gfx::Display::RotationSource source) { 150 gfx::Display::RotationSource source) {
151 aura::Window* root_window = Shell::GetInstance() 151 aura::Window* root_window = Shell::GetInstance()
152 ->window_tree_host_manager() 152 ->window_tree_host_manager()
153 ->GetRootWindowForDisplayId(display_id); 153 ->GetRootWindowForDisplayId(display_id);
154 154
155 const gfx::Display::Rotation initial_orientation = 155 const gfx::Display::Rotation initial_orientation =
156 GetCurrentRotation(display_id); 156 GetCurrentRotation(display_id);
157 157
158 const gfx::Rect original_screen_bounds = root_window->GetTargetBounds(); 158 const gfx::Rect original_screen_bounds = root_window->GetTargetBounds();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 scoped_ptr<ui::LayerAnimationSequence> animation_sequence( 236 scoped_ptr<ui::LayerAnimationSequence> animation_sequence(
237 new ui::LayerAnimationSequence(screen_rotation.release())); 237 new ui::LayerAnimationSequence(screen_rotation.release()));
238 // Add an observer so that the cloned layers can be cleaned up with the 238 // Add an observer so that the cloned layers can be cleaned up with the
239 // animation completes/aborts. 239 // animation completes/aborts.
240 animation_sequence->AddObserver(layer_cleanup_observer.release()); 240 animation_sequence->AddObserver(layer_cleanup_observer.release());
241 animator->StartAnimation(animation_sequence.release()); 241 animator->StartAnimation(animation_sequence.release());
242 } 242 }
243 243
244 } // namespace 244 } // namespace
245 245
246 ScreenRotationAnimator::ScreenRotationAnimator(int64 display_id) 246 ScreenRotationAnimator::ScreenRotationAnimator(int64_t display_id)
247 : display_id_(display_id) { 247 : display_id_(display_id) {}
248 }
249 248
250 ScreenRotationAnimator::~ScreenRotationAnimator() { 249 ScreenRotationAnimator::~ScreenRotationAnimator() {
251 } 250 }
252 251
253 bool ScreenRotationAnimator::CanAnimate() const { 252 bool ScreenRotationAnimator::CanAnimate() const {
254 return Shell::GetInstance() 253 return Shell::GetInstance()
255 ->display_manager() 254 ->display_manager()
256 ->GetDisplayForId(display_id_) 255 ->GetDisplayForId(display_id_)
257 .is_valid(); 256 .is_valid();
258 } 257 }
259 258
260 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation, 259 void ScreenRotationAnimator::Rotate(gfx::Display::Rotation new_rotation,
261 gfx::Display::RotationSource source) { 260 gfx::Display::RotationSource source) {
262 const gfx::Display::Rotation current_rotation = 261 const gfx::Display::Rotation current_rotation =
263 GetCurrentRotation(display_id_); 262 GetCurrentRotation(display_id_);
264 263
265 if (current_rotation == new_rotation) 264 if (current_rotation == new_rotation)
266 return; 265 return;
267 266
268 RotateScreen(display_id_, new_rotation, source); 267 RotateScreen(display_id_, new_rotation, source);
269 } 268 }
270 269
271 } // namespace ash 270 } // namespace ash
OLDNEW
« no previous file with comments | « ash/rotator/screen_rotation_animator.h ('k') | ash/rotator/window_rotation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698