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

Side by Side Diff: cc/trees/property_tree_builder.cc

Issue 1906003002: cc: Stop cache transform invertibility at Layer and LayerImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-remove skipping due to invertibility in precalc, this was lost in rebase Created 4 years, 7 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/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/trees/property_tree_builder.h" 5 #include "cc/trees/property_tree_builder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 data.num_layer_or_descendants_with_touch_handler; 99 data.num_layer_or_descendants_with_touch_handler;
100 num_unclipped_descendants += data.num_unclipped_descendants; 100 num_unclipped_descendants += data.num_unclipped_descendants;
101 num_descendants_that_draw_content += data.num_descendants_that_draw_content; 101 num_descendants_that_draw_content += data.num_descendants_that_draw_content;
102 } 102 }
103 }; 103 };
104 104
105 static inline bool IsRootLayer(const Layer* layer) { 105 static inline bool IsRootLayer(const Layer* layer) {
106 return !layer->parent(); 106 return !layer->parent();
107 } 107 }
108 108
109 static bool HasInvertibleOrAnimatedTransform(Layer* layer) {
110 return layer->transform_is_invertible() ||
111 layer->HasPotentiallyRunningTransformAnimation();
112 }
113
114 static bool HasInvertibleOrAnimatedTransformForTesting(LayerImpl* layer) {
115 return layer->transform().IsInvertible() ||
116 layer->HasPotentiallyRunningTransformAnimation();
117 }
118
119 static bool IsMetaInformationRecomputationNeeded(Layer* layer) { 109 static bool IsMetaInformationRecomputationNeeded(Layer* layer) {
120 return layer->layer_tree_host()->needs_meta_info_recomputation(); 110 return layer->layer_tree_host()->needs_meta_info_recomputation();
121 } 111 }
122 112
123 // Recursively walks the layer tree(if needed) to compute any information 113 // Recursively walks the layer tree(if needed) to compute any information
124 // that is needed before doing the main recursion. 114 // that is needed before doing the main recursion.
125 static void PreCalculateMetaInformationInternal( 115 static void PreCalculateMetaInformationInternal(
126 Layer* layer, 116 Layer* layer,
127 PreCalculateMetaInformationRecursiveData* recursive_data) { 117 PreCalculateMetaInformationRecursiveData* recursive_data) {
128 if (!IsMetaInformationRecomputationNeeded(layer)) { 118 if (!IsMetaInformationRecomputationNeeded(layer)) {
129 DCHECK(IsRootLayer(layer)); 119 DCHECK(IsRootLayer(layer));
130 return; 120 return;
131 } 121 }
132 122
133 if (layer->clip_parent()) 123 if (layer->clip_parent())
134 recursive_data->num_unclipped_descendants++; 124 recursive_data->num_unclipped_descendants++;
135 125
136 if (!HasInvertibleOrAnimatedTransform(layer)) {
137 // Layers with singular transforms should not be drawn, the whole subtree
138 // can be skipped.
139 return;
140 }
141
142 for (size_t i = 0; i < layer->children().size(); ++i) { 126 for (size_t i = 0; i < layer->children().size(); ++i) {
143 Layer* child_layer = layer->child_at(i); 127 Layer* child_layer = layer->child_at(i);
144 128
145 PreCalculateMetaInformationRecursiveData data_for_child; 129 PreCalculateMetaInformationRecursiveData data_for_child;
146 PreCalculateMetaInformationInternal(child_layer, &data_for_child); 130 PreCalculateMetaInformationInternal(child_layer, &data_for_child);
147 recursive_data->Merge(data_for_child); 131 recursive_data->Merge(data_for_child);
148 } 132 }
149 133
150 if (layer->clip_children()) { 134 if (layer->clip_children()) {
151 size_t num_clip_children = layer->clip_children()->size(); 135 size_t num_clip_children = layer->clip_children()->size();
(...skipping 13 matching lines...) Expand all
165 if (IsRootLayer(layer)) 149 if (IsRootLayer(layer))
166 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false); 150 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false);
167 } 151 }
168 152
169 static void PreCalculateMetaInformationInternalForTesting( 153 static void PreCalculateMetaInformationInternalForTesting(
170 LayerImpl* layer, 154 LayerImpl* layer,
171 PreCalculateMetaInformationRecursiveData* recursive_data) { 155 PreCalculateMetaInformationRecursiveData* recursive_data) {
172 if (layer->test_properties()->clip_parent) 156 if (layer->test_properties()->clip_parent)
173 recursive_data->num_unclipped_descendants++; 157 recursive_data->num_unclipped_descendants++;
174 158
175 if (!HasInvertibleOrAnimatedTransformForTesting(layer)) {
176 // Layers with singular transforms should not be drawn, the whole subtree
177 // can be skipped.
178 return;
179 }
180
181 for (size_t i = 0; i < layer->children().size(); ++i) { 159 for (size_t i = 0; i < layer->children().size(); ++i) {
182 LayerImpl* child_layer = layer->child_at(i); 160 LayerImpl* child_layer = layer->child_at(i);
183 161
184 PreCalculateMetaInformationRecursiveData data_for_child; 162 PreCalculateMetaInformationRecursiveData data_for_child;
185 PreCalculateMetaInformationInternalForTesting(child_layer, &data_for_child); 163 PreCalculateMetaInformationInternalForTesting(child_layer, &data_for_child);
186 recursive_data->Merge(data_for_child); 164 recursive_data->Merge(data_for_child);
187 } 165 }
188 166
189 if (layer->test_properties()->clip_children) { 167 if (layer->test_properties()->clip_children) {
190 size_t num_clip_children = layer->test_properties()->clip_children->size(); 168 size_t num_clip_children = layer->test_properties()->clip_children->size();
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 if (SkColorGetA(color) != 255) 1244 if (SkColorGetA(color) != 255)
1267 color = SkColorSetA(color, 255); 1245 color = SkColorSetA(color, 255);
1268 BuildPropertyTreesTopLevelInternal( 1246 BuildPropertyTreesTopLevelInternal(
1269 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1247 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1270 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1248 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1271 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1249 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1272 device_transform, property_trees, color); 1250 device_transform, property_trees, color);
1273 } 1251 }
1274 1252
1275 } // namespace cc 1253 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698