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

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: Created 8 years, 5 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 b3f80e34d66e6dc6664f20fce0dea976a1cb4046..d7e4ca3777f7090aa0418b16fbba3b89fc383be3 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -149,8 +149,10 @@ class HidingWindowAnimationObserver : public ui::ImplicitAnimationObserver,
// Overridden from ui::ImplicitAnimationObserver:
virtual void OnImplicitAnimationsCompleted() OVERRIDE {
// Window may have been destroyed by this point.
- if (window_)
+ if (window_) {
+ window_->layer()->SetVisible(false);
sky 2012/08/10 15:47:39 If you do this then the TargetVisibility is true a
alexst (slow to review) 2012/08/10 17:50:55 Ah, this was the wrong solution to a real problem.
window_->RemoveObserver(this);
+ }
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
@@ -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) {
@@ -470,7 +485,6 @@ void AnimateHideWindow_Minimize(aura::Window* window) {
// Property sets within this scope will be implicitly animated.
ui::ScopedLayerAnimationSettings settings(window->layer()->GetAnimator());
settings.AddObserver(new HidingWindowAnimationObserver(window));
- window->layer()->SetVisible(false);
AddLayerAnimationsForMinimize(window, 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