OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |