OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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.h" | 5 #include "cc/layers/layer.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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 : ignore_set_needs_commit_(false), | 80 : ignore_set_needs_commit_(false), |
81 parent_(nullptr), | 81 parent_(nullptr), |
82 layer_tree_host_(nullptr), | 82 layer_tree_host_(nullptr), |
83 layer_tree_(nullptr), | 83 layer_tree_(nullptr), |
84 // Layer IDs start from 1. | 84 // Layer IDs start from 1. |
85 inputs_(g_next_layer_id.GetNext() + 1), | 85 inputs_(g_next_layer_id.GetNext() + 1), |
86 num_descendants_that_draw_content_(0), | 86 num_descendants_that_draw_content_(0), |
87 transform_tree_index_(TransformTree::kInvalidNodeId), | 87 transform_tree_index_(TransformTree::kInvalidNodeId), |
88 effect_tree_index_(EffectTree::kInvalidNodeId), | 88 effect_tree_index_(EffectTree::kInvalidNodeId), |
89 clip_tree_index_(ClipTree::kInvalidNodeId), | 89 clip_tree_index_(ClipTree::kInvalidNodeId), |
| 90 new_clip_tree_index_(ClipTree::kInvalidNodeId), |
90 scroll_tree_index_(ScrollTree::kInvalidNodeId), | 91 scroll_tree_index_(ScrollTree::kInvalidNodeId), |
91 property_tree_sequence_number_(-1), | 92 property_tree_sequence_number_(-1), |
92 should_flatten_transform_from_property_tree_(false), | 93 should_flatten_transform_from_property_tree_(false), |
93 draws_content_(false), | 94 draws_content_(false), |
94 use_local_transform_for_backface_visibility_(false), | 95 use_local_transform_for_backface_visibility_(false), |
95 should_check_backface_visibility_(false), | 96 should_check_backface_visibility_(false), |
96 force_render_surface_for_testing_(false), | 97 force_render_surface_for_testing_(false), |
97 subtree_property_changed_(false), | 98 subtree_property_changed_(false), |
98 may_contain_video_(false), | 99 may_contain_video_(false), |
99 safe_opaque_background_color_(0), | 100 safe_opaque_background_color_(0), |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 | 951 |
951 int Layer::clip_tree_index() const { | 952 int Layer::clip_tree_index() const { |
952 if (!layer_tree_host_ || | 953 if (!layer_tree_host_ || |
953 layer_tree_->property_trees()->sequence_number != | 954 layer_tree_->property_trees()->sequence_number != |
954 property_tree_sequence_number_) { | 955 property_tree_sequence_number_) { |
955 return ClipTree::kInvalidNodeId; | 956 return ClipTree::kInvalidNodeId; |
956 } | 957 } |
957 return clip_tree_index_; | 958 return clip_tree_index_; |
958 } | 959 } |
959 | 960 |
| 961 void Layer::SetNewClipTreeIndex(int index) { |
| 962 if (new_clip_tree_index_ == index) |
| 963 return; |
| 964 new_clip_tree_index_ = index; |
| 965 SetNeedsPushProperties(); |
| 966 } |
| 967 |
| 968 int Layer::new_clip_tree_index() const { |
| 969 return new_clip_tree_index_; |
| 970 } |
| 971 |
960 void Layer::SetEffectTreeIndex(int index) { | 972 void Layer::SetEffectTreeIndex(int index) { |
961 DCHECK(IsPropertyChangeAllowed()); | 973 DCHECK(IsPropertyChangeAllowed()); |
962 if (effect_tree_index_ == index) | 974 if (effect_tree_index_ == index) |
963 return; | 975 return; |
964 effect_tree_index_ = index; | 976 effect_tree_index_ = index; |
965 SetNeedsPushProperties(); | 977 SetNeedsPushProperties(); |
966 } | 978 } |
967 | 979 |
968 int Layer::effect_tree_index() const { | 980 int Layer::effect_tree_index() const { |
969 if (!layer_tree_host_ || | 981 if (!layer_tree_host_ || |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 #if defined(NDEBUG) | 1148 #if defined(NDEBUG) |
1137 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) | 1149 if (frame_viewer_instrumentation::IsTracingLayerTreeSnapshots()) |
1138 layer->SetDebugInfo(TakeDebugInfo()); | 1150 layer->SetDebugInfo(TakeDebugInfo()); |
1139 #else | 1151 #else |
1140 layer->SetDebugInfo(TakeDebugInfo()); | 1152 layer->SetDebugInfo(TakeDebugInfo()); |
1141 #endif | 1153 #endif |
1142 | 1154 |
1143 layer->SetTransformTreeIndex(transform_tree_index()); | 1155 layer->SetTransformTreeIndex(transform_tree_index()); |
1144 layer->SetEffectTreeIndex(effect_tree_index()); | 1156 layer->SetEffectTreeIndex(effect_tree_index()); |
1145 layer->SetClipTreeIndex(clip_tree_index()); | 1157 layer->SetClipTreeIndex(clip_tree_index()); |
| 1158 layer->SetNewClipTreeIndex(new_clip_tree_index()); |
1146 layer->SetScrollTreeIndex(scroll_tree_index()); | 1159 layer->SetScrollTreeIndex(scroll_tree_index()); |
1147 layer->set_offset_to_transform_parent(offset_to_transform_parent_); | 1160 layer->set_offset_to_transform_parent(offset_to_transform_parent_); |
1148 layer->SetDrawsContent(DrawsContent()); | 1161 layer->SetDrawsContent(DrawsContent()); |
1149 // subtree_property_changed_ is propagated to all descendants while building | 1162 // subtree_property_changed_ is propagated to all descendants while building |
1150 // property trees. So, it is enough to check it only for the current layer. | 1163 // property trees. So, it is enough to check it only for the current layer. |
1151 if (subtree_property_changed_) | 1164 if (subtree_property_changed_) |
1152 layer->NoteLayerPropertyChanged(); | 1165 layer->NoteLayerPropertyChanged(); |
1153 layer->set_may_contain_video(may_contain_video_); | 1166 layer->set_may_contain_video(may_contain_video_); |
1154 layer->SetMasksToBounds(inputs_.masks_to_bounds); | 1167 layer->SetMasksToBounds(inputs_.masks_to_bounds); |
1155 layer->set_main_thread_scrolling_reasons( | 1168 layer->set_main_thread_scrolling_reasons( |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1664 | 1677 |
1665 LayerTree* Layer::GetLayerTree() const { | 1678 LayerTree* Layer::GetLayerTree() const { |
1666 return layer_tree_; | 1679 return layer_tree_; |
1667 } | 1680 } |
1668 | 1681 |
1669 void Layer::SetLayerIdForTesting(int id) { | 1682 void Layer::SetLayerIdForTesting(int id) { |
1670 inputs_.layer_id = id; | 1683 inputs_.layer_id = id; |
1671 } | 1684 } |
1672 | 1685 |
1673 } // namespace cc | 1686 } // namespace cc |
OLD | NEW |