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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 2845143002: cc: Allow changing mask type when pushing properties. (Closed)
Patch Set: Disable mask tiling. Created 3 years, 7 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 | « cc/layers/picture_layer_impl.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 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
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 DCHECK(mask_type_ != Layer::LayerMaskType::NOT_MASK &&
enne (OOO) 2017/04/28 17:08:30 Maybe leave a comment here saying that it's expect
sunxd 2017/04/28 17:53:20 Done.
127 mask_type != Layer::LayerMaskType::NOT_MASK);
128 mask_type_ = mask_type;
129 }
130
123 const char* PictureLayerImpl::LayerTypeAsString() const { 131 const char* PictureLayerImpl::LayerTypeAsString() const {
124 return "cc::PictureLayerImpl"; 132 return "cc::PictureLayerImpl";
125 } 133 }
126 134
127 std::unique_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( 135 std::unique_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl(
128 LayerTreeImpl* tree_impl) { 136 LayerTreeImpl* tree_impl) {
129 return PictureLayerImpl::Create(tree_impl, id(), mask_type()); 137 return PictureLayerImpl::Create(tree_impl, id(), mask_type());
130 } 138 }
131 139
132 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { 140 void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) {
133 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 141 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
134 DCHECK_EQ(layer_impl->mask_type_, mask_type_);
135 142
136 LayerImpl::PushPropertiesTo(base_layer); 143 LayerImpl::PushPropertiesTo(base_layer);
137 144
145 layer_impl->SetLayerMaskType(mask_type());
138 // Twin relationships should never change once established. 146 // Twin relationships should never change once established.
139 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); 147 DCHECK(!twin_layer_ || twin_layer_ == layer_impl);
140 DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this); 148 DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this);
141 // The twin relationship does not need to exist before the first 149 // The twin relationship does not need to exist before the first
142 // PushPropertiesTo from pending to active layer since before that the active 150 // 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 151 // layer can not have a pile or tilings, it has only been created and inserted
144 // into the tree at that point. 152 // into the tree at that point.
145 twin_layer_ = layer_impl; 153 twin_layer_ = layer_impl;
146 layer_impl->twin_layer_ = this; 154 layer_impl->twin_layer_ = this;
147 155
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 } 1421 }
1414 1422
1415 invalidation_.Union(invalidation); 1423 invalidation_.Union(invalidation);
1416 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); 1424 tilings_->UpdateTilingsForImplSideInvalidation(invalidation);
1417 SetNeedsPushProperties(); 1425 SetNeedsPushProperties();
1418 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", 1426 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages",
1419 "Invalidation", invalidation.ToString()); 1427 "Invalidation", invalidation.ToString());
1420 } 1428 }
1421 1429
1422 } // namespace cc 1430 } // namespace cc
OLDNEW
« 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