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

Side by Side Diff: cc/trees/layer_tree_host_common.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: more cleanup Created 4 years, 8 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
« cc/layers/layer.cc ('K') | « cc/layers/layer_unittest.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layer_tree_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 gfx::Rect layer_in_surface_space = 242 gfx::Rect layer_in_surface_space =
243 MathUtil::MapEnclosingClippedRect(transform, layer_bound_rect); 243 MathUtil::MapEnclosingClippedRect(transform, layer_bound_rect);
244 return CalculateVisibleRectWithCachedLayerRect( 244 return CalculateVisibleRectWithCachedLayerRect(
245 target_surface_rect, layer_bound_rect, layer_in_surface_space, transform); 245 target_surface_rect, layer_bound_rect, layer_in_surface_space, transform);
246 } 246 }
247 247
248 static inline bool IsRootLayer(const Layer* layer) { 248 static inline bool IsRootLayer(const Layer* layer) {
249 return !layer->parent(); 249 return !layer->parent();
250 } 250 }
251 251
252 template <typename LayerType>
253 static bool HasInvertibleOrAnimatedTransform(LayerType* layer) {
254 return layer->transform_is_invertible() ||
255 layer->HasPotentiallyRunningTransformAnimation();
256 }
257
258 static inline void MarkLayerWithRenderSurfaceLayerListId( 252 static inline void MarkLayerWithRenderSurfaceLayerListId(
259 LayerImpl* layer, 253 LayerImpl* layer,
260 int current_render_surface_layer_list_id) { 254 int current_render_surface_layer_list_id) {
261 layer->draw_properties().last_drawn_render_surface_layer_list_id = 255 layer->draw_properties().last_drawn_render_surface_layer_list_id =
262 current_render_surface_layer_list_id; 256 current_render_surface_layer_list_id;
263 } 257 }
264 258
265 static inline void MarkMasksWithRenderSurfaceLayerListId( 259 static inline void MarkMasksWithRenderSurfaceLayerListId(
266 LayerImpl* layer, 260 LayerImpl* layer,
267 int current_render_surface_layer_list_id) { 261 int current_render_surface_layer_list_id) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 Layer* layer, 323 Layer* layer,
330 PreCalculateMetaInformationRecursiveData* recursive_data) { 324 PreCalculateMetaInformationRecursiveData* recursive_data) {
331 if (!IsMetaInformationRecomputationNeeded(layer)) { 325 if (!IsMetaInformationRecomputationNeeded(layer)) {
332 DCHECK(IsRootLayer(layer)); 326 DCHECK(IsRootLayer(layer));
333 return; 327 return;
334 } 328 }
335 329
336 if (layer->clip_parent()) 330 if (layer->clip_parent())
337 recursive_data->num_unclipped_descendants++; 331 recursive_data->num_unclipped_descendants++;
338 332
339 if (!HasInvertibleOrAnimatedTransform(layer)) {
340 // Layers with singular transforms should not be drawn, the whole subtree
341 // can be skipped.
342 return;
343 }
344
345 for (size_t i = 0; i < layer->children().size(); ++i) { 333 for (size_t i = 0; i < layer->children().size(); ++i) {
346 Layer* child_layer = layer->child_at(i); 334 Layer* child_layer = layer->child_at(i);
347 335
348 PreCalculateMetaInformationRecursiveData data_for_child; 336 PreCalculateMetaInformationRecursiveData data_for_child;
349 PreCalculateMetaInformationInternal(child_layer, &data_for_child); 337 PreCalculateMetaInformationInternal(child_layer, &data_for_child);
350 recursive_data->Merge(data_for_child); 338 recursive_data->Merge(data_for_child);
351 } 339 }
352 340
353 if (layer->clip_children()) { 341 if (layer->clip_children()) {
354 size_t num_clip_children = layer->clip_children()->size(); 342 size_t num_clip_children = layer->clip_children()->size();
(...skipping 13 matching lines...) Expand all
368 if (IsRootLayer(layer)) 356 if (IsRootLayer(layer))
369 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false); 357 layer->layer_tree_host()->SetNeedsMetaInfoRecomputation(false);
370 } 358 }
371 359
372 static void PreCalculateMetaInformationInternalForTesting( 360 static void PreCalculateMetaInformationInternalForTesting(
373 LayerImpl* layer, 361 LayerImpl* layer,
374 PreCalculateMetaInformationRecursiveData* recursive_data) { 362 PreCalculateMetaInformationRecursiveData* recursive_data) {
375 if (layer->clip_parent()) 363 if (layer->clip_parent())
376 recursive_data->num_unclipped_descendants++; 364 recursive_data->num_unclipped_descendants++;
377 365
378 if (!HasInvertibleOrAnimatedTransform(layer)) {
379 // Layers with singular transforms should not be drawn, the whole subtree
380 // can be skipped.
381 return;
382 }
383
384 for (size_t i = 0; i < layer->children().size(); ++i) { 366 for (size_t i = 0; i < layer->children().size(); ++i) {
385 LayerImpl* child_layer = layer->child_at(i); 367 LayerImpl* child_layer = layer->child_at(i);
386 368
387 PreCalculateMetaInformationRecursiveData data_for_child; 369 PreCalculateMetaInformationRecursiveData data_for_child;
388 PreCalculateMetaInformationInternalForTesting(child_layer, &data_for_child); 370 PreCalculateMetaInformationInternalForTesting(child_layer, &data_for_child);
389 recursive_data->Merge(data_for_child); 371 recursive_data->Merge(data_for_child);
390 } 372 }
391 373
392 if (layer->clip_children()) { 374 if (layer->clip_children()) {
393 size_t num_clip_children = layer->clip_children()->size(); 375 size_t num_clip_children = layer->clip_children()->size();
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 918
937 PropertyTrees* GetPropertyTrees(Layer* layer) { 919 PropertyTrees* GetPropertyTrees(Layer* layer) {
938 return layer->layer_tree_host()->property_trees(); 920 return layer->layer_tree_host()->property_trees();
939 } 921 }
940 922
941 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 923 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
942 return layer->layer_tree_impl()->property_trees(); 924 return layer->layer_tree_impl()->property_trees();
943 } 925 }
944 926
945 } // namespace cc 927 } // namespace cc
OLDNEW
« cc/layers/layer.cc ('K') | « cc/layers/layer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698