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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 2845143002: cc: Allow changing mask type when pushing properties. (Closed)
Patch Set: Add comment to SetLayerMaskType Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index f385bddd8003344734c5ee27c144d901da007d3e..0f35040fd9a4cf612c002f9ba995a82e912f2bde 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -120,6 +120,17 @@ PictureLayerImpl::~PictureLayerImpl() {
layer_tree_impl()->UnregisterPictureLayerImpl(this);
}
+void PictureLayerImpl::SetLayerMaskType(Layer::LayerMaskType mask_type) {
+ if (mask_type_ == mask_type)
+ return;
+ // It is expected that a layer can never change from being a mask to not being
+ // one and vice versa. Only changes that make mask layer single <-> multi are
+ // expected.
+ DCHECK(mask_type_ != Layer::LayerMaskType::NOT_MASK &&
+ mask_type != Layer::LayerMaskType::NOT_MASK);
+ mask_type_ = mask_type;
+}
+
const char* PictureLayerImpl::LayerTypeAsString() const {
return "cc::PictureLayerImpl";
}
@@ -131,10 +142,10 @@ std::unique_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl(
void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) {
PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
- DCHECK_EQ(layer_impl->mask_type_, mask_type_);
LayerImpl::PushPropertiesTo(base_layer);
+ layer_impl->SetLayerMaskType(mask_type());
// Twin relationships should never change once established.
DCHECK(!twin_layer_ || twin_layer_ == layer_impl);
DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this);
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698