Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 2616353003: Clarify property tree id-to-index map names. (Closed)
Patch Set: Sync to head. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/render_surface_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 return GetEffectTree() 498 return GetEffectTree()
499 .Node(effect_tree_index()) 499 .Node(effect_tree_index())
500 ->num_copy_requests_in_subtree; 500 ->num_copy_requests_in_subtree;
501 } 501 }
502 502
503 void LayerImpl::UpdatePropertyTreeTransformIsAnimated(bool is_animated) { 503 void LayerImpl::UpdatePropertyTreeTransformIsAnimated(bool is_animated) {
504 PropertyTrees* property_trees = GetPropertyTrees(); 504 PropertyTrees* property_trees = GetPropertyTrees();
505 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, 505 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
506 id())) { 506 id())) {
507 TransformTree& transform_tree = GetTransformTree(); 507 TransformTree& transform_tree = GetTransformTree();
508 TransformNode* node = 508 TransformNode* node = transform_tree.Node(
509 transform_tree.Node(property_trees->transform_id_to_index_map[id()]); 509 property_trees->layer_id_to_transform_node_index[id()]);
510 // A LayerImpl's own current state is insufficient for determining whether 510 // A LayerImpl's own current state is insufficient for determining whether
511 // it owns a TransformNode, since this depends on the state of the 511 // it owns a TransformNode, since this depends on the state of the
512 // corresponding Layer at the time of the last commit. For example, if 512 // corresponding Layer at the time of the last commit. For example, if
513 // |is_animated| is false, this might mean a transform animation just ticked 513 // |is_animated| is false, this might mean a transform animation just ticked
514 // past its finish point (so the LayerImpl still owns a TransformNode) or it 514 // past its finish point (so the LayerImpl still owns a TransformNode) or it
515 // might mean that a transform animation was removed during commit or 515 // might mean that a transform animation was removed during commit or
516 // activation (and, in that case, the LayerImpl will no longer own a 516 // activation (and, in that case, the LayerImpl will no longer own a
517 // TransformNode, unless it has non-animation-related reasons for owning a 517 // TransformNode, unless it has non-animation-related reasons for owning a
518 // node). 518 // node).
519 if (node->has_potential_animation != is_animated) { 519 if (node->has_potential_animation != is_animated) {
(...skipping 26 matching lines...) Expand all
546 546
547 void LayerImpl::OnIsAnimatingChanged(const PropertyAnimationState& mask, 547 void LayerImpl::OnIsAnimatingChanged(const PropertyAnimationState& mask,
548 const PropertyAnimationState& state) { 548 const PropertyAnimationState& state) {
549 DCHECK(layer_tree_impl_); 549 DCHECK(layer_tree_impl_);
550 PropertyTrees* property_trees = GetPropertyTrees(); 550 PropertyTrees* property_trees = GetPropertyTrees();
551 551
552 TransformNode* transform_node = nullptr; 552 TransformNode* transform_node = nullptr;
553 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, 553 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
554 id())) { 554 id())) {
555 transform_node = GetTransformTree().Node( 555 transform_node = GetTransformTree().Node(
556 property_trees->transform_id_to_index_map[id()]); 556 property_trees->layer_id_to_transform_node_index[id()]);
557 } 557 }
558 558
559 EffectNode* effect_node = nullptr; 559 EffectNode* effect_node = nullptr;
560 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) { 560 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) {
561 effect_node = 561 effect_node = GetEffectTree().Node(
562 GetEffectTree().Node(property_trees->effect_id_to_index_map[id()]); 562 property_trees->layer_id_to_effect_node_index[id()]);
563 } 563 }
564 564
565 for (int property = TargetProperty::FIRST_TARGET_PROPERTY; 565 for (int property = TargetProperty::FIRST_TARGET_PROPERTY;
566 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) { 566 property <= TargetProperty::LAST_TARGET_PROPERTY; ++property) {
567 switch (property) { 567 switch (property) {
568 case TargetProperty::TRANSFORM: 568 case TargetProperty::TRANSFORM:
569 if (transform_node) { 569 if (transform_node) {
570 if (mask.currently_running[property]) 570 if (mask.currently_running[property])
571 transform_node->is_currently_animating = 571 transform_node->is_currently_animating =
572 state.currently_running[property]; 572 state.currently_running[property];
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 714
715 void LayerImpl::SetContentsOpaque(bool opaque) { 715 void LayerImpl::SetContentsOpaque(bool opaque) {
716 contents_opaque_ = opaque; 716 contents_opaque_ = opaque;
717 } 717 }
718 718
719 float LayerImpl::Opacity() const { 719 float LayerImpl::Opacity() const {
720 PropertyTrees* property_trees = GetPropertyTrees(); 720 PropertyTrees* property_trees = GetPropertyTrees();
721 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id())) 721 if (!property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::EFFECT, id()))
722 return 1.f; 722 return 1.f;
723 EffectNode* node = 723 EffectNode* node =
724 GetEffectTree().Node(property_trees->effect_id_to_index_map[id()]); 724 GetEffectTree().Node(property_trees->layer_id_to_effect_node_index[id()]);
725 return node->opacity; 725 return node->opacity;
726 } 726 }
727 727
728 const gfx::Transform& LayerImpl::Transform() const { 728 const gfx::Transform& LayerImpl::Transform() const {
729 PropertyTrees* property_trees = GetPropertyTrees(); 729 PropertyTrees* property_trees = GetPropertyTrees();
730 DCHECK(property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM, 730 DCHECK(property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::TRANSFORM,
731 id())); 731 id()));
732 TransformNode* node = 732 TransformNode* node = GetTransformTree().Node(
733 GetTransformTree().Node(property_trees->transform_id_to_index_map[id()]); 733 property_trees->layer_id_to_transform_node_index[id()]);
734 return node->local; 734 return node->local;
735 } 735 }
736 736
737 void LayerImpl::SetElementId(ElementId element_id) { 737 void LayerImpl::SetElementId(ElementId element_id) {
738 if (element_id == element_id_) 738 if (element_id == element_id_)
739 return; 739 return;
740 740
741 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 741 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
742 "LayerImpl::SetElementId", "element", 742 "LayerImpl::SetElementId", "element",
743 element_id.AsValue().release()); 743 element_id.AsValue().release());
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1097
1098 ScrollTree& LayerImpl::GetScrollTree() const { 1098 ScrollTree& LayerImpl::GetScrollTree() const {
1099 return GetPropertyTrees()->scroll_tree; 1099 return GetPropertyTrees()->scroll_tree;
1100 } 1100 }
1101 1101
1102 TransformTree& LayerImpl::GetTransformTree() const { 1102 TransformTree& LayerImpl::GetTransformTree() const {
1103 return GetPropertyTrees()->transform_tree; 1103 return GetPropertyTrees()->transform_tree;
1104 } 1104 }
1105 1105
1106 } // namespace cc 1106 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/render_surface_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698