| 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.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/resources/picture_pile.h" | 10 #include "cc/resources/picture_pile.h" |
| 11 #include "cc/trees/layer_tree_impl.h" | 11 #include "cc/trees/layer_tree_impl.h" |
| 12 #include "third_party/skia/include/core/SkPictureRecorder.h" | 12 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 13 #include "ui/gfx/geometry/rect_conversions.h" | 13 #include "ui/gfx/geometry/rect_conversions.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { | 17 scoped_refptr<PictureLayer> PictureLayer::Create(ContentLayerClient* client) { |
| 18 return make_scoped_refptr(new PictureLayer(client)); | 18 return make_scoped_refptr(new PictureLayer(client)); |
| 19 } | 19 } |
| 20 | 20 |
| 21 PictureLayer::PictureLayer(ContentLayerClient* client) | 21 PictureLayer::PictureLayer(ContentLayerClient* client) |
| 22 : client_(client), | 22 : client_(client), |
| 23 recording_source_(new PicturePile), | 23 recording_source_(new PicturePile), |
| 24 instrumentation_object_tracker_(id()), | 24 instrumentation_object_tracker_(id()), |
| 25 update_source_frame_number_(-1), | 25 update_source_frame_number_(-1), |
| 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(ContentLayerClient* client, |
| 30 scoped_ptr<RecordingSource> source) |
| 31 : PictureLayer(client) { |
| 32 recording_source_ = source.Pass(); |
| 33 } |
| 34 |
| 29 PictureLayer::~PictureLayer() { | 35 PictureLayer::~PictureLayer() { |
| 30 } | 36 } |
| 31 | 37 |
| 32 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 38 scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
| 33 return PictureLayerImpl::Create(tree_impl, id()); | 39 return PictureLayerImpl::Create(tree_impl, id()); |
| 34 } | 40 } |
| 35 | 41 |
| 36 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { | 42 void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { |
| 37 Layer::PushPropertiesTo(base_layer); | 43 Layer::PushPropertiesTo(base_layer); |
| 38 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); | 44 PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 199 |
| 194 bool PictureLayer::HasDrawableContent() const { | 200 bool PictureLayer::HasDrawableContent() const { |
| 195 return client_ && Layer::HasDrawableContent(); | 201 return client_ && Layer::HasDrawableContent(); |
| 196 } | 202 } |
| 197 | 203 |
| 198 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { | 204 void PictureLayer::RunMicroBenchmark(MicroBenchmark* benchmark) { |
| 199 benchmark->RunOnLayer(this); | 205 benchmark->RunOnLayer(this); |
| 200 } | 206 } |
| 201 | 207 |
| 202 } // namespace cc | 208 } // namespace cc |
| OLD | NEW |