| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 const gfx::Transform& gfx_transform = test_properties()->transform; | 396 const gfx::Transform& gfx_transform = test_properties()->transform; |
| 397 double transform[16]; | 397 double transform[16]; |
| 398 gfx_transform.matrix().asColMajord(transform); | 398 gfx_transform.matrix().asColMajord(transform); |
| 399 list = base::MakeUnique<base::ListValue>(); | 399 list = base::MakeUnique<base::ListValue>(); |
| 400 for (int i = 0; i < 16; ++i) | 400 for (int i = 0; i < 16; ++i) |
| 401 list->AppendDouble(transform[i]); | 401 list->AppendDouble(transform[i]); |
| 402 result->Set("Transform", std::move(list)); | 402 result->Set("Transform", std::move(list)); |
| 403 | 403 |
| 404 result->SetBoolean("DrawsContent", draws_content_); | 404 result->SetBoolean("DrawsContent", draws_content_); |
| 405 result->SetBoolean("Is3dSorted", Is3dSorted()); | 405 result->SetBoolean("Is3dSorted", Is3dSorted()); |
| 406 result->SetDouble("OPACITY", Opacity()); | |
| 407 result->SetBoolean("ContentsOpaque", contents_opaque_); | 406 result->SetBoolean("ContentsOpaque", contents_opaque_); |
| 408 | 407 |
| 409 if (scrollable()) | 408 if (scrollable()) |
| 410 result->SetBoolean("Scrollable", true); | 409 result->SetBoolean("Scrollable", true); |
| 411 | 410 |
| 412 if (!touch_event_handler_region_.IsEmpty()) { | 411 if (!touch_event_handler_region_.IsEmpty()) { |
| 413 std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue(); | 412 std::unique_ptr<base::Value> region = touch_event_handler_region_.AsValue(); |
| 414 result->Set("TouchRegion", std::move(region)); | 413 result->Set("TouchRegion", std::move(region)); |
| 415 } | 414 } |
| 416 | 415 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 606 } |
| 608 | 607 |
| 609 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { | 608 void LayerImpl::SetMasksToBounds(bool masks_to_bounds) { |
| 610 masks_to_bounds_ = masks_to_bounds; | 609 masks_to_bounds_ = masks_to_bounds; |
| 611 } | 610 } |
| 612 | 611 |
| 613 void LayerImpl::SetContentsOpaque(bool opaque) { | 612 void LayerImpl::SetContentsOpaque(bool opaque) { |
| 614 contents_opaque_ = opaque; | 613 contents_opaque_ = opaque; |
| 615 } | 614 } |
| 616 | 615 |
| 617 float LayerImpl::Opacity() const { | |
| 618 if (const EffectNode* node = GetEffectTree().FindNodeFromOwningLayerId(id())) | |
| 619 return node->opacity; | |
| 620 else | |
| 621 return 1.f; | |
| 622 } | |
| 623 | |
| 624 const gfx::Transform& LayerImpl::Transform() const { | 616 const gfx::Transform& LayerImpl::Transform() const { |
| 625 DCHECK_NE(GetTransformTree().FindNodeFromOwningLayerId(id()), nullptr); | 617 DCHECK_NE(GetTransformTree().FindNodeFromOwningLayerId(id()), nullptr); |
| 626 return GetTransformTree().FindNodeFromOwningLayerId(id())->local; | 618 return GetTransformTree().FindNodeFromOwningLayerId(id())->local; |
| 627 } | 619 } |
| 628 | 620 |
| 629 void LayerImpl::SetElementId(ElementId element_id) { | 621 void LayerImpl::SetElementId(ElementId element_id) { |
| 630 if (element_id == element_id_) | 622 if (element_id == element_id_) |
| 631 return; | 623 return; |
| 632 | 624 |
| 633 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 625 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { | 780 void LayerImpl::AsValueInto(base::trace_event::TracedValue* state) const { |
| 789 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( | 781 TracedValue::MakeDictIntoImplicitSnapshotWithCategory( |
| 790 TRACE_DISABLED_BY_DEFAULT("cc.debug"), | 782 TRACE_DISABLED_BY_DEFAULT("cc.debug"), |
| 791 state, | 783 state, |
| 792 "cc::LayerImpl", | 784 "cc::LayerImpl", |
| 793 LayerTypeAsString(), | 785 LayerTypeAsString(), |
| 794 this); | 786 this); |
| 795 state->SetInteger("layer_id", id()); | 787 state->SetInteger("layer_id", id()); |
| 796 MathUtil::AddToTracedValue("bounds", bounds_, state); | 788 MathUtil::AddToTracedValue("bounds", bounds_, state); |
| 797 | 789 |
| 798 state->SetDouble("opacity", Opacity()); | |
| 799 | |
| 800 MathUtil::AddToTracedValue("position", position_, state); | 790 MathUtil::AddToTracedValue("position", position_, state); |
| 801 | 791 |
| 802 state->SetInteger("draws_content", DrawsContent()); | 792 state->SetInteger("draws_content", DrawsContent()); |
| 803 state->SetInteger("gpu_memory_usage", | 793 state->SetInteger("gpu_memory_usage", |
| 804 base::saturated_cast<int>(GPUMemoryUsageInBytes())); | 794 base::saturated_cast<int>(GPUMemoryUsageInBytes())); |
| 805 | 795 |
| 806 if (element_id_) | 796 if (element_id_) |
| 807 element_id_.AddToTracedValue(state); | 797 element_id_.AddToTracedValue(state); |
| 808 | 798 |
| 809 if (mutable_properties_ != MutableProperty::kNone) | 799 if (mutable_properties_ != MutableProperty::kNone) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 963 |
| 974 ScrollTree& LayerImpl::GetScrollTree() const { | 964 ScrollTree& LayerImpl::GetScrollTree() const { |
| 975 return GetPropertyTrees()->scroll_tree; | 965 return GetPropertyTrees()->scroll_tree; |
| 976 } | 966 } |
| 977 | 967 |
| 978 TransformTree& LayerImpl::GetTransformTree() const { | 968 TransformTree& LayerImpl::GetTransformTree() const { |
| 979 return GetPropertyTrees()->transform_tree; | 969 return GetPropertyTrees()->transform_tree; |
| 980 } | 970 } |
| 981 | 971 |
| 982 } // namespace cc | 972 } // namespace cc |
| OLD | NEW |