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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "ui/compositor/layer_owner_delegate.h" | 10 #include "ui/compositor/layer_owner_delegate.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 new_layer->set_name(old_layer->name()); | 48 new_layer->set_name(old_layer->name()); |
49 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); | 49 new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely()); |
50 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); | 50 new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely()); |
51 new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset()); | 51 new_layer->SetSubpixelPositionOffset(old_layer->subpixel_position_offset()); |
52 new_layer->SetLayerInverted(old_layer->layer_inverted()); | 52 new_layer->SetLayerInverted(old_layer->layer_inverted()); |
53 new_layer->SetTransform(old_layer->GetTargetTransform()); | 53 new_layer->SetTransform(old_layer->GetTargetTransform()); |
54 if (old_layer->type() == LAYER_SOLID_COLOR) | 54 if (old_layer->type() == LAYER_SOLID_COLOR) |
55 new_layer->SetColor(old_layer->GetTargetColor()); | 55 new_layer->SetColor(old_layer->GetTargetColor()); |
56 SkRegion* alpha_shape = old_layer->alpha_shape(); | 56 SkRegion* alpha_shape = old_layer->alpha_shape(); |
57 if (alpha_shape) | 57 if (alpha_shape) |
58 new_layer->SetAlphaShape(base::WrapUnique(new SkRegion(*alpha_shape))); | 58 new_layer->SetAlphaShape(base::MakeUnique<SkRegion>(*alpha_shape)); |
59 | 59 |
60 if (old_layer->parent()) { | 60 if (old_layer->parent()) { |
61 // Install new layer as a sibling of the old layer, stacked below it. | 61 // Install new layer as a sibling of the old layer, stacked below it. |
62 old_layer->parent()->Add(new_layer); | 62 old_layer->parent()->Add(new_layer); |
63 old_layer->parent()->StackBelow(new_layer, old_layer.get()); | 63 old_layer->parent()->StackBelow(new_layer, old_layer.get()); |
64 } else if (old_layer->GetCompositor()) { | 64 } else if (old_layer->GetCompositor()) { |
65 // If old_layer was the layer tree root then we need to move the Compositor | 65 // If old_layer was the layer tree root then we need to move the Compositor |
66 // over to the new root. | 66 // over to the new root. |
67 old_layer->GetCompositor()->SetRootLayer(new_layer); | 67 old_layer->GetCompositor()->SetRootLayer(new_layer); |
68 } | 68 } |
(...skipping 21 matching lines...) Expand all Loading... |
90 void LayerOwner::DestroyLayer() { | 90 void LayerOwner::DestroyLayer() { |
91 layer_ = NULL; | 91 layer_ = NULL; |
92 layer_owner_.reset(); | 92 layer_owner_.reset(); |
93 } | 93 } |
94 | 94 |
95 bool LayerOwner::OwnsLayer() const { | 95 bool LayerOwner::OwnsLayer() const { |
96 return !!layer_owner_; | 96 return !!layer_owner_; |
97 } | 97 } |
98 | 98 |
99 } // namespace ui | 99 } // namespace ui |
OLD | NEW |