| 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/test/fake_picture_layer.h" | 5 #include "cc/test/fake_picture_layer.h" |
| 6 | 6 |
| 7 #include "cc/proto/layer.pb.h" |
| 7 #include "cc/test/fake_picture_layer_impl.h" | 8 #include "cc/test/fake_picture_layer_impl.h" |
| 8 | 9 |
| 9 namespace cc { | 10 namespace cc { |
| 10 | 11 |
| 11 FakePictureLayer::FakePictureLayer(ContentLayerClient* client) | 12 FakePictureLayer::FakePictureLayer(ContentLayerClient* client) |
| 12 : PictureLayer(client), | 13 : PictureLayer(client), |
| 13 update_count_(0), | 14 update_count_(0), |
| 14 push_properties_count_(0), | |
| 15 always_update_resources_(false), | 15 always_update_resources_(false), |
| 16 force_unsuitable_for_gpu_rasterization_(false) { | 16 force_unsuitable_for_gpu_rasterization_(false) { |
| 17 SetBounds(gfx::Size(1, 1)); | 17 SetBounds(gfx::Size(1, 1)); |
| 18 SetIsDrawable(true); | 18 SetIsDrawable(true); |
| 19 } | 19 } |
| 20 | 20 |
| 21 FakePictureLayer::FakePictureLayer(ContentLayerClient* client, | 21 FakePictureLayer::FakePictureLayer(ContentLayerClient* client, |
| 22 std::unique_ptr<RecordingSource> source) | 22 std::unique_ptr<RecordingSource> source) |
| 23 : PictureLayer(client, std::move(source)), | 23 : PictureLayer(client, std::move(source)), |
| 24 update_count_(0), | 24 update_count_(0), |
| 25 push_properties_count_(0), | |
| 26 always_update_resources_(false), | 25 always_update_resources_(false), |
| 27 force_unsuitable_for_gpu_rasterization_(false) { | 26 force_unsuitable_for_gpu_rasterization_(false) { |
| 28 SetBounds(gfx::Size(1, 1)); | 27 SetBounds(gfx::Size(1, 1)); |
| 29 SetIsDrawable(true); | 28 SetIsDrawable(true); |
| 30 } | 29 } |
| 31 | 30 |
| 32 FakePictureLayer::~FakePictureLayer() {} | 31 FakePictureLayer::~FakePictureLayer() {} |
| 33 | 32 |
| 34 std::unique_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( | 33 std::unique_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( |
| 35 LayerTreeImpl* tree_impl) { | 34 LayerTreeImpl* tree_impl) { |
| 36 if (is_mask()) | 35 if (is_mask()) |
| 37 return FakePictureLayerImpl::CreateMask(tree_impl, id()); | 36 return FakePictureLayerImpl::CreateMask(tree_impl, id()); |
| 38 return FakePictureLayerImpl::Create(tree_impl, id()); | 37 return FakePictureLayerImpl::Create(tree_impl, id()); |
| 39 } | 38 } |
| 40 | 39 |
| 41 bool FakePictureLayer::Update() { | 40 bool FakePictureLayer::Update() { |
| 42 bool updated = PictureLayer::Update(); | 41 bool updated = PictureLayer::Update(); |
| 43 update_count_++; | 42 update_count_++; |
| 44 return updated || always_update_resources_; | 43 return updated || always_update_resources_; |
| 45 } | 44 } |
| 46 | 45 |
| 47 void FakePictureLayer::PushPropertiesTo(LayerImpl* layer) { | |
| 48 PictureLayer::PushPropertiesTo(layer); | |
| 49 push_properties_count_++; | |
| 50 } | |
| 51 | |
| 52 bool FakePictureLayer::IsSuitableForGpuRasterization() const { | 46 bool FakePictureLayer::IsSuitableForGpuRasterization() const { |
| 53 if (force_unsuitable_for_gpu_rasterization_) | 47 if (force_unsuitable_for_gpu_rasterization_) |
| 54 return false; | 48 return false; |
| 55 return PictureLayer::IsSuitableForGpuRasterization(); | 49 return PictureLayer::IsSuitableForGpuRasterization(); |
| 56 } | 50 } |
| 57 | 51 |
| 52 void FakePictureLayer::SetTypeForProtoSerialization( |
| 53 proto::LayerNode* proto) const { |
| 54 proto->set_type(proto::LayerNode::FAKE_PICTURE_LAYER); |
| 55 } |
| 56 |
| 58 } // namespace cc | 57 } // namespace cc |
| OLD | NEW |