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

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: 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 15 matching lines...) Expand all
26 can_use_lcd_text_last_frame_(can_use_lcd_text()) { 26 can_use_lcd_text_last_frame_(can_use_lcd_text()) {
27 } 27 }
28 28
29 PictureLayer::~PictureLayer() { 29 PictureLayer::~PictureLayer() {
30 } 30 }
31 31
32 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { 32 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) {
33 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); 33 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
34 } 34 }
35 35
36 void PictureLayer::SetSolidColorPropertiesTo(
37 PictureLayerImpl* layer_impl) const {
38 layer_impl->SetSolidColorState(pile_->IsSolidColor(), pile_->GetSolidColor());
39 }
40
36 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { 41 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
37 Layer::PushPropertiesTo(base_layer); 42 Layer::PushPropertiesTo(base_layer);
38 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); 43 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer);
39 44
45 SetSolidColorPropertiesTo(layer_impl);
vmpstr 2014/08/29 06:49:14 Why not just layer_impl->SetSolidColorState(...) d
hendrikw 2014/08/29 14:03:21 see prev comment
vmpstr 2014/08/29 14:20:44 Acknowledged.
46
40 if (layer_impl->bounds().IsEmpty()) { 47 if (layer_impl->bounds().IsEmpty()) {
41 // Update may not get called for an empty layer, so resize here instead. 48 // Update may not get called for an empty layer, so resize here instead.
42 // Using layer_impl because either bounds() or paint_properties().bounds 49 // Using layer_impl because either bounds() or paint_properties().bounds
43 // may disagree and either one could have been pushed to layer_impl. 50 // may disagree and either one could have been pushed to layer_impl.
44 pile_->SetEmptyBounds(); 51 pile_->SetEmptyBounds();
45 } else if (update_source_frame_number_ == 52 } else if (update_source_frame_number_ ==
46 layer_tree_host()->source_frame_number()) { 53 layer_tree_host()->source_frame_number()) {
47 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect 54 // TODO(ernstm): This DCHECK is only valid as long as the pile's tiling_rect
48 // is identical to the layer_rect. 55 // is identical to the layer_rect.
49 // If update called, then pile size must match bounds pushed to impl layer. 56 // If update called, then pile size must match bounds pushed to impl layer.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 215
209 bool PictureLayer::HasDrawableContent() const { 216 bool PictureLayer::HasDrawableContent() const {
210 return client_ && Layer::HasDrawableContent(); 217 return client_ && Layer::HasDrawableContent();
211 } 218 }
212 219
213 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { 220 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) {
214 benchmark->RunOnLayer(this); 221 benchmark->RunOnLayer(this);
215 } 222 }
216 223
217 } // namespace cc 224 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698