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

Side by Side Diff: ash/common/wm/overview/scoped_transform_overview_window.cc

Issue 2126873005: [ash-md] Doesn't recreate a rounded rect mask for overview windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Doesn't recreate a rounded rect mask for overview windows (rebased) 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/compositor/layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/wm/overview/scoped_transform_overview_window.h" 5 #include "ash/common/wm/overview/scoped_transform_overview_window.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/material_design/material_design_controller.h" 10 #include "ash/common/material_design/material_design_controller.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } // namespace 176 } // namespace
177 177
178 // Mask layer that clips the window's original header in overview mode. 178 // Mask layer that clips the window's original header in overview mode.
179 // Only used with Material Design. 179 // Only used with Material Design.
180 class ScopedTransformOverviewWindow::OverviewContentMask 180 class ScopedTransformOverviewWindow::OverviewContentMask
181 : public ui::LayerDelegate { 181 : public ui::LayerDelegate {
182 public: 182 public:
183 explicit OverviewContentMask(float radius); 183 explicit OverviewContentMask(float radius);
184 ~OverviewContentMask() override; 184 ~OverviewContentMask() override;
185 185
186 void set_radius(float radius) { radius_ = radius; }
186 ui::Layer* layer() { return &layer_; } 187 ui::Layer* layer() { return &layer_; }
187 188
188 // Overridden from LayerDelegate. 189 // Overridden from LayerDelegate.
189 void OnPaintLayer(const ui::PaintContext& context) override; 190 void OnPaintLayer(const ui::PaintContext& context) override;
190 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {} 191 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override {}
191 void OnDeviceScaleFactorChanged(float device_scale_factor) override; 192 void OnDeviceScaleFactorChanged(float device_scale_factor) override;
192 base::Closure PrepareForLayerBoundsChange() override; 193 base::Closure PrepareForLayerBoundsChange() override;
193 194
194 private: 195 private:
195 ui::Layer layer_; 196 ui::Layer layer_;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 399 }
399 400
400 void ScopedTransformOverviewWindow::SetTransform( 401 void ScopedTransformOverviewWindow::SetTransform(
401 WmWindow* root_window, 402 WmWindow* root_window,
402 const gfx::Transform& transform, 403 const gfx::Transform& transform,
403 float radius) { 404 float radius) {
404 DCHECK(overview_started_); 405 DCHECK(overview_started_);
405 406
406 if (ash::MaterialDesignController::IsOverviewMaterial() && 407 if (ash::MaterialDesignController::IsOverviewMaterial() &&
407 &transform != &original_transform_) { 408 &transform != &original_transform_) {
409 if (!mask_) {
410 mask_.reset(new OverviewContentMask(radius));
411 mask_->layer()->SetFillsBoundsOpaquely(false);
412 window()->GetLayer()->SetMaskLayer(mask_->layer());
413 }
408 gfx::Rect bounds(GetTargetBoundsInScreen().size()); 414 gfx::Rect bounds(GetTargetBoundsInScreen().size());
409 mask_.reset(new OverviewContentMask(radius));
410 mask_->layer()->SetFillsBoundsOpaquely(false);
411 mask_->layer()->SetBounds(bounds); 415 mask_->layer()->SetBounds(bounds);
412 window()->GetLayer()->SetMaskLayer(mask_->layer()); 416 mask_->set_radius(radius);
417 window()->GetLayer()->SchedulePaint(bounds);
413 418
414 SkRegion* window_shape = window()->GetLayer()->alpha_shape(); 419 SkRegion* window_shape = window()->GetLayer()->alpha_shape();
415 if (!original_window_shape_ && window_shape) 420 if (!original_window_shape_ && window_shape)
416 original_window_shape_.reset(new SkRegion(*window_shape)); 421 original_window_shape_.reset(new SkRegion(*window_shape));
417 const int inset = 422 const int inset =
418 window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET); 423 window()->GetIntProperty(WmWindowProperty::TOP_VIEW_INSET);
419 if (inset > 0) { 424 if (inset > 0) {
420 bounds.Inset(0, inset, 0, 0); 425 bounds.Inset(0, inset, 0, 0);
421 SkRegion* region = new SkRegion; 426 SkRegion* region = new SkRegion;
422 region->setRect(RectToSkIRect(bounds)); 427 region->setRect(RectToSkIRect(bounds));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 if (parent_window) 476 if (parent_window)
472 parent_window->CloseWidget(); 477 parent_window->CloseWidget();
473 } 478 }
474 479
475 // static 480 // static
476 void ScopedTransformOverviewWindow::SetImmediateCloseForTests() { 481 void ScopedTransformOverviewWindow::SetImmediateCloseForTests() {
477 immediate_close_for_tests = true; 482 immediate_close_for_tests = true;
478 } 483 }
479 484
480 } // namespace ash 485 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698