| 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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 } | 942 } |
| 943 | 943 |
| 944 bool LayerImpl::OpacityIsAnimating() const { | 944 bool LayerImpl::OpacityIsAnimating() const { |
| 945 return layer_tree_impl_->IsAnimatingOpacityProperty(this); | 945 return layer_tree_impl_->IsAnimatingOpacityProperty(this); |
| 946 } | 946 } |
| 947 | 947 |
| 948 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { | 948 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { |
| 949 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); | 949 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); |
| 950 } | 950 } |
| 951 | 951 |
| 952 void LayerImpl::SetElementId(uint64_t element_id) { | 952 void LayerImpl::SetElementId(ElementId element_id) { |
| 953 if (element_id == element_id_) | 953 if (element_id == element_id_) |
| 954 return; | 954 return; |
| 955 | 955 |
| 956 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 956 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 957 "LayerImpl::SetElementId", "id", element_id); | 957 "LayerImpl::SetElementId", "element", |
| 958 element_id.AsValue().release()); |
| 958 | 959 |
| 959 layer_tree_impl_->RemoveFromElementMap(this); | 960 layer_tree_impl_->RemoveFromElementMap(this); |
| 960 element_id_ = element_id; | 961 element_id_ = element_id; |
| 961 layer_tree_impl_->AddToElementMap(this); | 962 layer_tree_impl_->AddToElementMap(this); |
| 963 |
| 962 SetNeedsPushProperties(); | 964 SetNeedsPushProperties(); |
| 963 } | 965 } |
| 964 | 966 |
| 965 void LayerImpl::SetMutableProperties(uint32_t properties) { | 967 void LayerImpl::SetMutableProperties(uint32_t properties) { |
| 966 if (mutable_properties_ == properties) | 968 if (mutable_properties_ == properties) |
| 967 return; | 969 return; |
| 968 | 970 |
| 969 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 971 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 970 "LayerImpl::SetMutableProperties", "properties", properties); | 972 "LayerImpl::SetMutableProperties", "properties", properties); |
| 971 | 973 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 MathUtil::AddToTracedValue("bounds", bounds_, state); | 1144 MathUtil::AddToTracedValue("bounds", bounds_, state); |
| 1143 | 1145 |
| 1144 state->SetDouble("opacity", Opacity()); | 1146 state->SetDouble("opacity", Opacity()); |
| 1145 | 1147 |
| 1146 MathUtil::AddToTracedValue("position", position_, state); | 1148 MathUtil::AddToTracedValue("position", position_, state); |
| 1147 | 1149 |
| 1148 state->SetInteger("draws_content", DrawsContent()); | 1150 state->SetInteger("draws_content", DrawsContent()); |
| 1149 state->SetInteger("gpu_memory_usage", | 1151 state->SetInteger("gpu_memory_usage", |
| 1150 base::saturated_cast<int>(GPUMemoryUsageInBytes())); | 1152 base::saturated_cast<int>(GPUMemoryUsageInBytes())); |
| 1151 | 1153 |
| 1152 if (mutable_properties_ != MutableProperty::kNone) { | 1154 if (element_id_) |
| 1153 state->SetInteger("element_id", base::saturated_cast<int>(element_id_)); | 1155 element_id_.AddToTracedValue(state); |
| 1156 |
| 1157 if (mutable_properties_ != MutableProperty::kNone) |
| 1154 state->SetInteger("mutable_properties", mutable_properties_); | 1158 state->SetInteger("mutable_properties", mutable_properties_); |
| 1155 } | |
| 1156 | 1159 |
| 1157 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); | 1160 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); |
| 1158 | 1161 |
| 1159 if (!transform().IsIdentity()) | 1162 if (!transform().IsIdentity()) |
| 1160 MathUtil::AddToTracedValue("transform", transform(), state); | 1163 MathUtil::AddToTracedValue("transform", transform(), state); |
| 1161 | 1164 |
| 1162 bool clipped; | 1165 bool clipped; |
| 1163 gfx::QuadF layer_quad = | 1166 gfx::QuadF layer_quad = |
| 1164 MathUtil::MapQuad(ScreenSpaceTransform(), | 1167 MathUtil::MapQuad(ScreenSpaceTransform(), |
| 1165 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); | 1168 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1368 .layer_transforms_should_scale_layer_contents) { | 1371 .layer_transforms_should_scale_layer_contents) { |
| 1369 return default_scale; | 1372 return default_scale; |
| 1370 } | 1373 } |
| 1371 | 1374 |
| 1372 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1375 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1373 ScreenSpaceTransform(), default_scale); | 1376 ScreenSpaceTransform(), default_scale); |
| 1374 return std::max(transform_scales.x(), transform_scales.y()); | 1377 return std::max(transform_scales.x(), transform_scales.y()); |
| 1375 } | 1378 } |
| 1376 | 1379 |
| 1377 } // namespace cc | 1380 } // namespace cc |
| OLD | NEW |