Commit 0f37dbb9 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

wallpaper: Fix bug with blur reseting when rotating in overview.

Do not repaint to 1.f opacity if the blur is already 0. Also fix a bug
with the cross fading animation being darker in the middle than the end.
This is caused by the how the layers with different opacities stacked
ontop of each other work. With both tweens linear the combined opacity
near the gets to like .2. Changed to use tweens where the combined
opacity stays close to .9 ish.

Bug: 1009971, 1016267
Test: manual
Change-Id: I9cb00afa869a8b83369ae871862700a2df864ead
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1898147Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712903}
parent 42fe0860
...@@ -127,6 +127,11 @@ class WallpaperWidgetController::WidgetHandler ...@@ -127,6 +127,11 @@ class WallpaperWidgetController::WidgetHandler
parent_window_->layer()->RemoveCacheRenderSurfaceRequest(); parent_window_->layer()->RemoveCacheRenderSurfaceRequest();
has_blur_cache_ = false; has_blur_cache_ = false;
} }
// No need to repaint if blur is already zero.
if (blur == 0.f)
return;
widget_->GetLayer()->SetLayerBlur(0.f); widget_->GetLayer()->SetLayerBlur(0.f);
wallpaper_view_->RepaintBlurAndOpacity(blur, 1.f); wallpaper_view_->RepaintBlurAndOpacity(blur, 1.f);
} }
......
...@@ -270,8 +270,14 @@ void OverviewWallpaperController::OnBlurChangeCrossFade( ...@@ -270,8 +270,14 @@ void OverviewWallpaperController::OnBlurChangeCrossFade(
ui::Layer* original_layer = wallpaper_window->layer(); ui::Layer* original_layer = wallpaper_window->layer();
original_layer->GetAnimator()->StopAnimating(); original_layer->GetAnimator()->StopAnimating();
// Tablet mode wallpaper is already dimmed, so no need to change the
// opacity.
const float dimming =
Shell::Get()->tablet_mode_controller()->InTabletMode() || !should_blur
? 1.f
: kShieldOpacity;
wallpaper_widget_controller->wallpaper_view()->RepaintBlurAndOpacity( wallpaper_widget_controller->wallpaper_view()->RepaintBlurAndOpacity(
should_blur ? kWallpaperBlurSigma : kWallpaperClearBlurSigma, 1.f); should_blur ? kWallpaperBlurSigma : kWallpaperClearBlurSigma, dimming);
original_layer->SetOpacity(should_blur ? 0.f : 1.f); original_layer->SetOpacity(should_blur ? 0.f : 1.f);
ui::Layer* copy_layer = copy_layer_tree ? copy_layer_tree->root() : nullptr; ui::Layer* copy_layer = copy_layer_tree ? copy_layer_tree->root() : nullptr;
...@@ -292,7 +298,7 @@ void OverviewWallpaperController::OnBlurChangeCrossFade( ...@@ -292,7 +298,7 @@ void OverviewWallpaperController::OnBlurChangeCrossFade(
copy_layer->GetAnimator()); copy_layer->GetAnimator());
copy_settings->SetTransitionDuration( copy_settings->SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kBlurSlideDurationMs)); base::TimeDelta::FromMilliseconds(kBlurSlideDurationMs));
copy_settings->SetTweenType(gfx::Tween::EASE_OUT); copy_settings->SetTweenType(gfx::Tween::EASE_IN);
copy_settings->AddObserver(this); copy_settings->AddObserver(this);
animating_copies_.emplace_back(std::move(copy_layer_tree)); animating_copies_.emplace_back(std::move(copy_layer_tree));
...@@ -300,12 +306,7 @@ void OverviewWallpaperController::OnBlurChangeCrossFade( ...@@ -300,12 +306,7 @@ void OverviewWallpaperController::OnBlurChangeCrossFade(
state_ = WallpaperAnimationState::kNormal; state_ = WallpaperAnimationState::kNormal;
} }
// Tablet mode wallpaper is already dimmed, so no need to change the original_layer->SetOpacity(1.f);
// opacity.
float target_opacity =
Shell::Get()->tablet_mode_controller()->InTabletMode() ? 1.f
: kShieldOpacity;
original_layer->SetOpacity(should_blur ? target_opacity : 1.f);
if (copy_layer) if (copy_layer)
copy_layer->SetOpacity(0.f); copy_layer->SetOpacity(0.f);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment