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

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

Issue 519583003: Use the solid color detection to create solid layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a unit test for solid color on picturelayerimpl Created 6 years, 3 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
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.h" 5 #include "cc/layers/picture_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "cc/layers/content_layer_client.h" 8 #include "cc/layers/content_layer_client.h"
9 #include "cc/layers/picture_layer_impl.h" 9 #include "cc/layers/picture_layer_impl.h"
10 #include "cc/trees/layer_tree_impl.h" 10 #include "cc/trees/layer_tree_impl.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 31 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
32 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 32 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
33 } 33 }
34 34
35 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { 35 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
36 Layer::PushPropertiesTo(base_layer); 36 Layer::PushPropertiesTo(base_layer);
37 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 37 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
38 38
39 layer_impl->SetSolidColorState(pile_->IsSolidColor(), pile_->GetSolidColor());
danakj 2014/09/10 18:40:50 can the layerimpl not pull this off its own pile i
hendrikw 2014/09/11 00:27:40 PLI doesn't know if it's solid or not (only PL kno
danakj 2014/09/11 23:36:37 Can't the test set the bool in the pile? Take a lo
40
39 if (layer_impl->bounds().IsEmpty()) { 41 if (layer_impl->bounds().IsEmpty()) {
40 // Update may not get called for an empty layer, so resize here instead. 42 // Update may not get called for an empty layer, so resize here instead.
41 // Using layer_impl because either bounds() or paint_properties().bounds 43 // Using layer_impl because either bounds() or paint_properties().bounds
42 // may disagree and either one could have been pushed to layer_impl. 44 // may disagree and either one could have been pushed to layer_impl.
43 pile_->SetEmptyBounds(); 45 pile_->SetEmptyBounds();
44 } else if (update_source_frame_number_ == 46 } else if (update_source_frame_number_ ==
45 layer_tree_host()->source_frame_number()) { 47 layer_tree_host()->source_frame_number()) {
46 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect 48 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect
47 // is identical to the layer_rect. 49 // is identical to the layer_rect.
48 // If update called, then pile size must match bounds pushed to impl layer. 50 // If update called, then pile size must match bounds pushed to impl layer.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 207
206 bool PictureLayer::HasDrawableContent() const { 208 bool PictureLayer::HasDrawableContent() const {
207 return client_ && Layer::HasDrawableContent(); 209 return client_ && Layer::HasDrawableContent();
208 } 210 }
209 211
210 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 212 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
211 benchmark->RunOnLayer(this); 213 benchmark->RunOnLayer(this);
212 } 214 }
213 215
214 } // namespace cc 216 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698