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/wm/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 transition->set_tween_type( | 115 transition->set_tween_type( |
116 show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT); | 116 show ? gfx::Tween::EASE_IN : gfx::Tween::EASE_IN_OUT); |
117 | 117 |
118 window->layer()->GetAnimator()->ScheduleAnimation( | 118 window->layer()->GetAnimator()->ScheduleAnimation( |
119 new ui::LayerAnimationSequence(transition.release())); | 119 new ui::LayerAnimationSequence(transition.release())); |
120 | 120 |
121 // When hiding a window, turn off blending until the animation is 3 / 4 done | 121 // When hiding a window, turn off blending until the animation is 3 / 4 done |
122 // to save bandwidth and reduce jank. | 122 // to save bandwidth and reduce jank. |
123 if (!show) { | 123 if (!show) { |
124 window->layer()->GetAnimator()->SchedulePauseForProperties( | 124 window->layer()->GetAnimator()->SchedulePauseForProperties( |
125 (duration * 3) / 4, ui::LayerAnimationElement::OPACITY, -1); | 125 (duration * 3) / 4, ui::LayerAnimationElement::OPACITY); |
126 } | 126 } |
127 | 127 |
128 // Fade in and out quickly when the window is small to reduce jank. | 128 // Fade in and out quickly when the window is small to reduce jank. |
129 float opacity = show ? 1.0f : 0.0f; | 129 float opacity = show ? 1.0f : 0.0f; |
130 window->layer()->GetAnimator()->ScheduleAnimation( | 130 window->layer()->GetAnimator()->ScheduleAnimation( |
131 new ui::LayerAnimationSequence( | 131 new ui::LayerAnimationSequence( |
132 ui::LayerAnimationElement::CreateOpacityElement( | 132 ui::LayerAnimationElement::CreateOpacityElement( |
133 opacity, duration / 4))); | 133 opacity, duration / 4))); |
134 } | 134 } |
135 | 135 |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 } | 541 } |
542 | 542 |
543 // Assume the shelf is overflowed, zoom off to the bottom right of the | 543 // Assume the shelf is overflowed, zoom off to the bottom right of the |
544 // work area. | 544 // work area. |
545 gfx::Rect work_area = | 545 gfx::Rect work_area = |
546 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 546 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
547 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); | 547 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); |
548 } | 548 } |
549 | 549 |
550 } // namespace ash | 550 } // namespace ash |
OLD | NEW |