| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/layer_impl_test_properties.h" | 5 #include "cc/layers/layer_impl_test_properties.h" |
| 6 | 6 |
| 7 #include "cc/layers/layer_impl.h" |
| 7 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
| 9 #include "cc/trees/layer_tree_impl.h" |
| 8 | 10 |
| 9 namespace cc { | 11 namespace cc { |
| 10 | 12 |
| 11 LayerImplTestProperties::LayerImplTestProperties() | 13 LayerImplTestProperties::LayerImplTestProperties(LayerImpl* owning_layer) |
| 12 : double_sided(true), | 14 : owning_layer(owning_layer), |
| 15 double_sided(true), |
| 13 force_render_surface(false), | 16 force_render_surface(false), |
| 14 is_container_for_fixed_position_layers(false), | 17 is_container_for_fixed_position_layers(false), |
| 15 should_flatten_transform(true), | 18 should_flatten_transform(true), |
| 16 hide_layer_and_subtree(false), | 19 hide_layer_and_subtree(false), |
| 17 opacity_can_animate(false), | 20 opacity_can_animate(false), |
| 18 num_descendants_that_draw_content(0), | 21 num_descendants_that_draw_content(0), |
| 19 num_unclipped_descendants(0), | 22 num_unclipped_descendants(0), |
| 20 opacity(1.f), | 23 opacity(1.f), |
| 21 scroll_parent(nullptr), | 24 scroll_parent(nullptr), |
| 22 clip_parent(nullptr) {} | 25 clip_parent(nullptr), |
| 26 mask_layer(nullptr), |
| 27 replica_layer(nullptr) {} |
| 23 | 28 |
| 24 LayerImplTestProperties::~LayerImplTestProperties() {} | 29 LayerImplTestProperties::~LayerImplTestProperties() {} |
| 25 | 30 |
| 31 void LayerImplTestProperties::SetMaskLayer(std::unique_ptr<LayerImpl> mask) { |
| 32 if (mask_layer) |
| 33 owning_layer->layer_tree_impl()->RemoveLayer(mask_layer->id()); |
| 34 mask_layer = mask.get(); |
| 35 if (mask) |
| 36 owning_layer->layer_tree_impl()->AddLayer(std::move(mask)); |
| 37 } |
| 38 |
| 39 void LayerImplTestProperties::SetReplicaLayer( |
| 40 std::unique_ptr<LayerImpl> replica) { |
| 41 if (replica_layer) { |
| 42 replica_layer->test_properties()->SetMaskLayer(nullptr); |
| 43 owning_layer->layer_tree_impl()->RemoveLayer(replica_layer->id()); |
| 44 } |
| 45 replica_layer = replica.get(); |
| 46 if (replica) { |
| 47 replica->SetParent(owning_layer); |
| 48 owning_layer->layer_tree_impl()->AddLayer(std::move(replica)); |
| 49 } |
| 50 } |
| 51 |
| 26 } // namespace cc | 52 } // namespace cc |
| OLD | NEW |