| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 is_directly_composited_image_(false) { | 113 is_directly_composited_image_(false) { |
| 114 layer_tree_impl()->RegisterPictureLayerImpl(this); | 114 layer_tree_impl()->RegisterPictureLayerImpl(this); |
| 115 } | 115 } |
| 116 | 116 |
| 117 PictureLayerImpl::~PictureLayerImpl() { | 117 PictureLayerImpl::~PictureLayerImpl() { |
| 118 if (twin_layer_) | 118 if (twin_layer_) |
| 119 twin_layer_->twin_layer_ = nullptr; | 119 twin_layer_->twin_layer_ = nullptr; |
| 120 layer_tree_impl()->UnregisterPictureLayerImpl(this); | 120 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void PictureLayerImpl::SetLayerMaskType(Layer::LayerMaskType mask_type) { |
| 124 if (mask_type_ == mask_type) |
| 125 return; |
| 126 // It is expected that a layer can never change from being a mask to not being |
| 127 // one and vice versa. Only changes that make mask layer single <-> multi are |
| 128 // expected. |
| 129 DCHECK(mask_type_ != Layer::LayerMaskType::NOT_MASK && |
| 130 mask_type != Layer::LayerMaskType::NOT_MASK); |
| 131 mask_type_ = mask_type; |
| 132 } |
| 133 |
| 123 const char* PictureLayerImpl::LayerTypeAsString() const { | 134 const char* PictureLayerImpl::LayerTypeAsString() const { |
| 124 return "cc::PictureLayerImpl"; | 135 return "cc::PictureLayerImpl"; |
| 125 } | 136 } |
| 126 | 137 |
| 127 std::unique_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( | 138 std::unique_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( |
| 128 LayerTreeImpl* tree_impl) { | 139 LayerTreeImpl* tree_impl) { |
| 129 return PictureLayerImpl::Create(tree_impl, id(), mask_type()); | 140 return PictureLayerImpl::Create(tree_impl, id(), mask_type()); |
| 130 } | 141 } |
| 131 | 142 |
| 132 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { | 143 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
| 133 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 144 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| 134 DCHECK_EQ(layer_impl->mask_type_, mask_type_); | |
| 135 | 145 |
| 136 LayerImpl::PushPropertiesTo(base_layer); | 146 LayerImpl::PushPropertiesTo(base_layer); |
| 137 | 147 |
| 148 layer_impl->SetLayerMaskType(mask_type()); |
| 138 // Twin relationships should never change once established. | 149 // Twin relationships should never change once established. |
| 139 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); | 150 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); |
| 140 DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this); | 151 DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this); |
| 141 // The twin relationship does not need to exist before the first | 152 // The twin relationship does not need to exist before the first |
| 142 // PushPropertiesTo from pending to active layer since before that the active | 153 // PushPropertiesTo from pending to active layer since before that the active |
| 143 // layer can not have a pile or tilings, it has only been created and inserted | 154 // layer can not have a pile or tilings, it has only been created and inserted |
| 144 // into the tree at that point. | 155 // into the tree at that point. |
| 145 twin_layer_ = layer_impl; | 156 twin_layer_ = layer_impl; |
| 146 layer_impl->twin_layer_ = this; | 157 layer_impl->twin_layer_ = this; |
| 147 | 158 |
| (...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 } | 1424 } |
| 1414 | 1425 |
| 1415 invalidation_.Union(invalidation); | 1426 invalidation_.Union(invalidation); |
| 1416 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); | 1427 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); |
| 1417 SetNeedsPushProperties(); | 1428 SetNeedsPushProperties(); |
| 1418 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", | 1429 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", |
| 1419 "Invalidation", invalidation.ToString()); | 1430 "Invalidation", invalidation.ToString()); |
| 1420 } | 1431 } |
| 1421 | 1432 |
| 1422 } // namespace cc | 1433 } // namespace cc |
| OLD | NEW |