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

Unified Diff: ash/common/wm/overview/scoped_transform_overview_window.cc

Issue 2146323004: [ash-md] Improves smoothness with many windows in overview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Improves smoothness with many windows in overview (added flags) Created 4 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 | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_grid.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/overview/scoped_transform_overview_window.cc
diff --git a/ash/common/wm/overview/scoped_transform_overview_window.cc b/ash/common/wm/overview/scoped_transform_overview_window.cc
index a2abe5d0e1a77c9b1e202b0c0937221f80d6ad02..8e5cf5fdf7a3266d9412d235f2b678951c82167c 100644
--- a/ash/common/wm/overview/scoped_transform_overview_window.cc
+++ b/ash/common/wm/overview/scoped_transform_overview_window.cc
@@ -180,10 +180,11 @@ TransientDescendantIteratorRange GetTransientTreeIterator(WmWindow* window) {
class ScopedTransformOverviewWindow::OverviewContentMask
: public ui::LayerDelegate {
public:
- explicit OverviewContentMask(float radius);
+ explicit OverviewContentMask();
~OverviewContentMask() override;
void set_radius(float radius) { radius_ = radius; }
+ void set_inset(int inset) { inset_ = inset; }
ui::Layer* layer() { return &layer_; }
// Overridden from LayerDelegate.
@@ -195,13 +196,13 @@ class ScopedTransformOverviewWindow::OverviewContentMask
private:
ui::Layer layer_;
float radius_;
+ int inset_;
DISALLOW_COPY_AND_ASSIGN(OverviewContentMask);
};
-ScopedTransformOverviewWindow::OverviewContentMask::OverviewContentMask(
- float radius)
- : layer_(ui::LAYER_TEXTURED), radius_(radius) {
+ScopedTransformOverviewWindow::OverviewContentMask::OverviewContentMask()
+ : layer_(ui::LAYER_TEXTURED), radius_(0), inset_(0) {
layer_.set_delegate(this);
}
@@ -213,6 +214,7 @@ void ScopedTransformOverviewWindow::OverviewContentMask::OnPaintLayer(
const ui::PaintContext& context) {
ui::PaintRecorder recorder(context, layer()->size());
gfx::Rect bounds(layer()->bounds().size());
+ bounds.Inset(0, inset_, 0, 0);
// Tile a window into an area, rounding the bottom corners.
const SkRect rect = gfx::RectToSkRect(bounds);
@@ -268,7 +270,8 @@ void ScopedTransformOverviewWindow::RestoreWindow() {
ScopedAnimationSettings animation_settings_list;
BeginScopedAnimation(OverviewAnimationType::OVERVIEW_ANIMATION_RESTORE_WINDOW,
&animation_settings_list);
- SetTransform(window()->GetRootWindow(), original_transform_, 0);
+ SetTransform(window()->GetRootWindow(), original_transform_,
+ false /* use_mask */, false /* use_shape */, 0);
std::unique_ptr<ScopedOverviewAnimationSettings> animation_settings =
CreateScopedOverviewAnimationSettings(
@@ -417,30 +420,39 @@ gfx::Transform ScopedTransformOverviewWindow::GetTransformForRect(
void ScopedTransformOverviewWindow::SetTransform(
WmWindow* root_window,
const gfx::Transform& transform,
+ bool use_mask,
+ bool use_shape,
float radius) {
DCHECK(overview_started_);
if (ash::MaterialDesignController::IsOverviewMaterial() &&
&transform != &original_transform_) {
- if (!mask_) {
- mask_.reset(new OverviewContentMask(radius));
+ if (use_mask && !mask_) {
+ mask_.reset(new OverviewContentMask());
mask_->layer()->SetFillsBoundsOpaquely(false);
window()->GetLayer()->SetMaskLayer(mask_->layer());
}
- gfx::Rect bounds(GetTargetBoundsInScreen().size());
- mask_->layer()->SetBounds(bounds);
- mask_->set_radius(radius);
- window()->GetLayer()->SchedulePaint(bounds);
-
if (!determined_original_window_shape_) {
determined_original_window_shape_ = true;
SkRegion* window_shape = window()->GetLayer()->alpha_shape();
if (!original_window_shape_ && window_shape)
original_window_shape_.reset(new SkRegion(*window_shape));
}
+ gfx::Rect bounds(GetTargetBoundsInScreen().size());
const int inset =
- window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET);
- if (inset > 0) {
+ (use_mask || use_shape)
+ ? window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET)
+ : 0;
+ if (mask_) {
+ // Mask layer is used both to hide the window header and to use rounded
+ // corners. Its layout needs to be update when setting a transform.
+ mask_->layer()->SetBounds(bounds);
+ mask_->set_inset(inset);
+ mask_->set_radius(radius);
+ window()->GetLayer()->SchedulePaint(bounds);
+ } else if (inset > 0) {
+ // Alpha shape is only used to to hide the window header and only when
+ // not using a mask layer.
bounds.Inset(0, inset, 0, 0);
SkRegion* region = new SkRegion;
region->setRect(RectToSkIRect(bounds));
« no previous file with comments | « ash/common/wm/overview/scoped_transform_overview_window.h ('k') | ash/common/wm/overview/window_grid.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698