Commit 31a97410 authored by Danton Vu's avatar Danton Vu Committed by Commit Bot

overview: prevent off-screen windows from animating.

From a performance standpoint, it is important that windows that are
off-screen don't animate.

R=sammiequon@chromium.org

Test: manual
Bug: 981190

Change-Id: I4ba972c237e51425a4650a3aaba839ddfe2c2df0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1733718
Commit-Queue: Danton Vu <dantonvu@google.com>
Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#684148}
parent 64dc15ac
...@@ -424,9 +424,6 @@ void OverviewGrid::PositionWindows( ...@@ -424,9 +424,6 @@ void OverviewGrid::PositionWindows(
? GetWindowRectsForTabletModeLayout(ignored_items) ? GetWindowRectsForTabletModeLayout(ignored_items)
: GetWindowRects(ignored_items); : GetWindowRects(ignored_items);
// TODO(dantonvu): Performance-wise, windows offscreen should not be
// animated. If we're in entering overview process, not all window items in
// the grid might need animation even if the grid needs animation.
if (transition == OverviewSession::OverviewTransition::kEnter) { if (transition == OverviewSession::OverviewTransition::kEnter) {
CalculateWindowListAnimationStates(/*selected_item=*/nullptr, transition, CalculateWindowListAnimationStates(/*selected_item=*/nullptr, transition,
rects); rects);
...@@ -957,6 +954,7 @@ void OverviewGrid::CalculateWindowListAnimationStates( ...@@ -957,6 +954,7 @@ void OverviewGrid::CalculateWindowListAnimationStates(
return false; return false;
}); });
gfx::Rect screen_bounds = GetGridEffectiveBounds();
SkRegion occluded_region; SkRegion occluded_region;
for (size_t i = 0; i < items.size(); ++i) { for (size_t i = 0; i < items.size(); ++i) {
const bool minimized = const bool minimized =
...@@ -991,6 +989,12 @@ void OverviewGrid::CalculateWindowListAnimationStates( ...@@ -991,6 +989,12 @@ void OverviewGrid::CalculateWindowListAnimationStates(
transition == OverviewTransition::kEnter ? target_bounds[i] transition == OverviewTransition::kEnter ? target_bounds[i]
: items[i]->target_bounds())); : items[i]->target_bounds()));
if (!screen_bounds.Contains(gfx::SkIRectToRect(dst_bounds))) {
items[i]->set_should_animate_when_entering(false);
items[i]->set_should_animate_when_exiting(false);
continue;
}
if (!occluded_region.isEmpty()) { if (!occluded_region.isEmpty()) {
src_occluded |= src_occluded |=
(!src_bounds.isEmpty() && occluded_region.contains(src_bounds)); (!src_bounds.isEmpty() && occluded_region.contains(src_bounds));
......
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