| 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/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 layer_tree_impl_->UnregisterScrollLayer(this); | 94 layer_tree_impl_->UnregisterScrollLayer(this); |
| 95 layer_tree_impl_->UnregisterLayer(this); | 95 layer_tree_impl_->UnregisterLayer(this); |
| 96 layer_tree_impl_->RemoveLayerShouldPushProperties(this); | 96 layer_tree_impl_->RemoveLayerShouldPushProperties(this); |
| 97 | 97 |
| 98 layer_tree_impl_->RemoveFromElementMap(this); | 98 layer_tree_impl_->RemoveFromElementMap(this); |
| 99 | 99 |
| 100 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 100 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
| 101 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); | 101 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) { | |
| 105 child->test_properties()->parent = this; | |
| 106 DCHECK_EQ(layer_tree_impl(), child->layer_tree_impl()); | |
| 107 test_properties()->children.push_back(child.get()); | |
| 108 layer_tree_impl_->AddLayer(std::move(child)); | |
| 109 } | |
| 110 | |
| 111 std::unique_ptr<LayerImpl> LayerImpl::RemoveChildForTesting(LayerImpl* child) { | |
| 112 auto it = std::find(test_properties()->children.begin(), | |
| 113 test_properties()->children.end(), child); | |
| 114 if (it != test_properties()->children.end()) | |
| 115 test_properties()->children.erase(it); | |
| 116 layer_tree_impl()->property_trees()->RemoveIdFromIdToIndexMaps(child->id()); | |
| 117 return layer_tree_impl_->RemoveLayer(child->id()); | |
| 118 } | |
| 119 | |
| 120 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { | 104 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { |
| 121 if (has_will_change_transform_hint_ == has_will_change) | 105 if (has_will_change_transform_hint_ == has_will_change) |
| 122 return; | 106 return; |
| 123 has_will_change_transform_hint_ = has_will_change; | 107 has_will_change_transform_hint_ = has_will_change; |
| 124 SetNeedsPushProperties(); | 108 SetNeedsPushProperties(); |
| 125 } | 109 } |
| 126 | 110 |
| 127 void LayerImpl::SetDebugInfo( | 111 void LayerImpl::SetDebugInfo( |
| 128 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) { | 112 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) { |
| 129 owned_debug_info_ = std::move(debug_info); | 113 owned_debug_info_ = std::move(debug_info); |
| (...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 .layer_transforms_should_scale_layer_contents) { | 1248 .layer_transforms_should_scale_layer_contents) { |
| 1265 return default_scale; | 1249 return default_scale; |
| 1266 } | 1250 } |
| 1267 | 1251 |
| 1268 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1252 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1269 ScreenSpaceTransform(), default_scale); | 1253 ScreenSpaceTransform(), default_scale); |
| 1270 return std::max(transform_scales.x(), transform_scales.y()); | 1254 return std::max(transform_scales.x(), transform_scales.y()); |
| 1271 } | 1255 } |
| 1272 | 1256 |
| 1273 } // namespace cc | 1257 } // namespace cc |
| OLD | NEW |