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

Side by Side Diff: ui/compositor/layer_owner.cc

Issue 547283003: [Ash] Copy alpha_shape when recreating layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 3 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 | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer_owner.h" 5 #include "ui/compositor/layer_owner.h"
6 6
7 #include "ui/compositor/layer_owner_delegate.h" 7 #include "ui/compositor/layer_owner_delegate.h"
8 8
9 namespace ui { 9 namespace ui {
10 10
(...skipping 28 matching lines...) Expand all
39 Layer* new_layer = new ui::Layer(old_layer->type()); 39 Layer* new_layer = new ui::Layer(old_layer->type());
40 SetLayer(new_layer); 40 SetLayer(new_layer);
41 new_layer->SetVisible(old_layer->GetTargetVisibility()); 41 new_layer->SetVisible(old_layer->GetTargetVisibility());
42 new_layer->SetOpacity(old_layer->GetTargetOpacity()); 42 new_layer->SetOpacity(old_layer->GetTargetOpacity());
43 new_layer->SetBounds(layer_bounds); 43 new_layer->SetBounds(layer_bounds);
44 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds()); 44 new_layer->SetMasksToBounds(old_layer->GetMasksToBounds());
45 new_layer->set_name(old_layer->name()); 45 new_layer->set_name(old_layer->name());
46 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); 46 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely());
47 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); 47 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely());
48 new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset()); 48 new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset());
49 SkRegion* alpha_shape = old_layer->alpha_shape();
50 if (alpha_shape)
51 new_layer->SetAlphaShape(make_scoped_ptr(new SkRegion(*alpha_shape)));
49 52
50 // Install new layer as a sibling of the old layer, stacked below it. 53 // Install new layer as a sibling of the old layer, stacked below it.
51 if (old_layer->parent()) { 54 if (old_layer->parent()) {
52 old_layer->parent()->Add(new_layer); 55 old_layer->parent()->Add(new_layer);
53 old_layer->parent()->StackBelow(new_layer, old_layer.get()); 56 old_layer->parent()->StackBelow(new_layer, old_layer.get());
54 } 57 }
55 58
56 // Migrate all the child layers over to the new layer. Copy the list because 59 // Migrate all the child layers over to the new layer. Copy the list because
57 // the items are removed during iteration. 60 // the items are removed during iteration.
58 std::vector<ui::Layer*> children_copy = old_layer->children(); 61 std::vector<ui::Layer*> children_copy = old_layer->children();
(...skipping 17 matching lines...) Expand all
76 void LayerOwner::DestroyLayer() { 79 void LayerOwner::DestroyLayer() {
77 layer_ = NULL; 80 layer_ = NULL;
78 layer_owner_.reset(); 81 layer_owner_.reset();
79 } 82 }
80 83
81 bool LayerOwner::OwnsLayer() const { 84 bool LayerOwner::OwnsLayer() const {
82 return !!layer_owner_; 85 return !!layer_owner_;
83 } 86 }
84 87
85 } // namespace ui 88 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698