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

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

Issue 2095193002: clang-format all of //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/rotator/screen_rotation_animator.cc ('k') | ash/scoped_target_root_window.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) 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/rotator/window_rotation.h" 5 #include "ash/rotator/window_rotation.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/interpolated_transform.h" 10 #include "ui/gfx/interpolated_transform.h"
(...skipping 19 matching lines...) Expand all
30 30
31 } // namespace 31 } // namespace
32 32
33 WindowRotation::WindowRotation(int degrees, ui::Layer* layer) 33 WindowRotation::WindowRotation(int degrees, ui::Layer* layer)
34 : ui::LayerAnimationElement(LayerAnimationElement::TRANSFORM, 34 : ui::LayerAnimationElement(LayerAnimationElement::TRANSFORM,
35 GetTransitionDuration(degrees)), 35 GetTransitionDuration(degrees)),
36 degrees_(degrees) { 36 degrees_(degrees) {
37 InitTransform(layer); 37 InitTransform(layer);
38 } 38 }
39 39
40 WindowRotation::~WindowRotation() { 40 WindowRotation::~WindowRotation() {}
41 }
42 41
43 void WindowRotation::InitTransform(ui::Layer* layer) { 42 void WindowRotation::InitTransform(ui::Layer* layer) {
44 // No rotation required, use the identity transform. 43 // No rotation required, use the identity transform.
45 if (degrees_ == 0) { 44 if (degrees_ == 0) {
46 interpolated_transform_.reset( 45 interpolated_transform_.reset(
47 new ui::InterpolatedConstantTransform(gfx::Transform())); 46 new ui::InterpolatedConstantTransform(gfx::Transform()));
48 return; 47 return;
49 } 48 }
50 49
51 // Use the target transform/bounds in case the layer is already animating. 50 // Use the target transform/bounds in case the layer is already animating.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 94
96 interpolated_transform_.reset( 95 interpolated_transform_.reset(
97 new ui::InterpolatedConstantTransform(current_transform)); 96 new ui::InterpolatedConstantTransform(current_transform));
98 97
99 scale_up->SetChild(scale_down.release()); 98 scale_up->SetChild(scale_down.release());
100 translation->SetChild(scale_up.release()); 99 translation->SetChild(scale_up.release());
101 rotation->SetChild(translation.release()); 100 rotation->SetChild(translation.release());
102 interpolated_transform_->SetChild(rotation.release()); 101 interpolated_transform_->SetChild(rotation.release());
103 } 102 }
104 103
105 void WindowRotation::OnStart(ui::LayerAnimationDelegate* delegate) { 104 void WindowRotation::OnStart(ui::LayerAnimationDelegate* delegate) {}
106 }
107 105
108 bool WindowRotation::OnProgress(double t, 106 bool WindowRotation::OnProgress(double t,
109 ui::LayerAnimationDelegate* delegate) { 107 ui::LayerAnimationDelegate* delegate) {
110 delegate->SetTransformFromAnimation(interpolated_transform_->Interpolate(t)); 108 delegate->SetTransformFromAnimation(interpolated_transform_->Interpolate(t));
111 return true; 109 return true;
112 } 110 }
113 111
114 void WindowRotation::OnGetTarget(TargetValue* target) const { 112 void WindowRotation::OnGetTarget(TargetValue* target) const {
115 target->transform = interpolated_transform_->Interpolate(1.0); 113 target->transform = interpolated_transform_->Interpolate(1.0);
116 } 114 }
117 115
118 void WindowRotation::OnAbort(ui::LayerAnimationDelegate* delegate) { 116 void WindowRotation::OnAbort(ui::LayerAnimationDelegate* delegate) {}
119 }
120 117
121 } // namespace ash 118 } // namespace ash
OLDNEW
« no previous file with comments | « ash/rotator/screen_rotation_animator.cc ('k') | ash/scoped_target_root_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698