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

Unified Diff: ash/wm/window_animations.cc

Issue 10825162: Turning off blending for part of the animation to reduce jank. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Altered transition animation duration. Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index a27fa1d43188c75e8e5e3a9092e451e923cfcdc6..6ff62b62481b92a00e1644d27ab8dd49e4876511 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -65,6 +65,7 @@ DEFINE_WINDOW_PROPERTY_KEY(float,
namespace {
const int kDefaultAnimationDurationForMenuMS = 150;
+const int kLayerAnimationsForMinimizeDurationMS = 350;
// Durations for the cross-fade animation, in milliseconds.
const float kCrossFadeDurationMinMs = 100.f;
@@ -435,7 +436,8 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
rotation_about_pivot->SetReversed(show);
- base::TimeDelta duration = base::TimeDelta::FromMilliseconds(350);
+ base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
+ kLayerAnimationsForMinimizeDurationMS);
scoped_ptr<ui::LayerAnimationElement> transition(
ui::LayerAnimationElement::CreateInterpolatedTransformElement(
@@ -447,10 +449,23 @@ void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
window->layer()->GetAnimator()->ScheduleAnimation(
new ui::LayerAnimationSequence(transition.release()));
+ // When hiding a window, turn off blending until the animation is
+ // 3 / 4 done to save bandwidth and reduce jank
+ if (!show) {
+ ui::LayerAnimationElement::AnimatableProperties propertiesToPause;
+ propertiesToPause.insert(ui::LayerAnimationElement::OPACITY);
+ window->layer()->GetAnimator()->ScheduleAnimation(
+ new ui::LayerAnimationSequence(
+ ui::LayerAnimationElement::CreatePauseElement(
+ propertiesToPause, (duration * 3 ) / 4)));
+ }
+
+ // Fade in and out quickly when the window is small to reduce jank
float opacity = show ? 1.0f : 0.0f;
window->layer()->GetAnimator()->ScheduleAnimation(
new ui::LayerAnimationSequence(
- ui::LayerAnimationElement::CreateOpacityElement(opacity, duration)));
+ ui::LayerAnimationElement::CreateOpacityElement(
+ opacity, duration / 4)));
}
void AnimateShowWindow_Minimize(aura::Window* window) {
@@ -469,6 +484,9 @@ void AnimateHideWindow_Minimize(aura::Window* window) {
// Property sets within this scope will be implicitly animated.
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
+ base::TimeDelta duration = base::TimeDelta::FromMilliseconds(
+ kLayerAnimationsForMinimizeDurationMS);
+ settings.SetTransitionDuration(duration);
settings.AddObserver(new HidingWindowAnimationObserver(window));
window->layer()->SetVisible(false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698