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

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

Issue 1876903003: cc : Add node and ancestors are animated or invertible to transform tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/layer_tree_host_common_unittest.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 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/draw_property_utils.h" 5 #include "cc/trees/draw_property_utils.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return !node->data.to_screen_is_potentially_animated; 302 return !node->data.to_screen_is_potentially_animated;
303 } 303 }
304 304
305 static inline bool TransformToScreenIsKnown(LayerImpl* layer, 305 static inline bool TransformToScreenIsKnown(LayerImpl* layer,
306 int transform_tree_index, 306 int transform_tree_index,
307 const TransformTree& tree) { 307 const TransformTree& tree) {
308 return true; 308 return true;
309 } 309 }
310 310
311 template <typename LayerType> 311 template <typename LayerType>
312 static bool HasInvertibleOrAnimatedTransform(LayerType* layer) {
313 return layer->transform_is_invertible() ||
314 layer->HasPotentiallyRunningTransformAnimation();
315 }
316
317 template <typename LayerType>
318 static bool LayerNeedsUpdateInternal(LayerType* layer, 312 static bool LayerNeedsUpdateInternal(LayerType* layer,
319 bool layer_is_drawn, 313 bool layer_is_drawn,
320 const TransformTree& tree) { 314 const TransformTree& tree) {
321 // Layers can be skipped if any of these conditions are met. 315 // Layers can be skipped if any of these conditions are met.
322 // - is not drawn due to it or one of its ancestors being hidden (or having 316 // - is not drawn due to it or one of its ancestors being hidden (or having
323 // no copy requests). 317 // no copy requests).
324 // - does not draw content. 318 // - does not draw content.
325 // - is transparent. 319 // - is transparent.
326 // - has empty bounds 320 // - has empty bounds
327 // - the layer is not double-sided, but its back face is visible. 321 // - the layer is not double-sided, but its back face is visible.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 407
414 static inline bool LayerShouldBeSkipped(Layer* layer, 408 static inline bool LayerShouldBeSkipped(Layer* layer,
415 bool layer_is_drawn, 409 bool layer_is_drawn,
416 const TransformTree& transform_tree, 410 const TransformTree& transform_tree,
417 const EffectTree& effect_tree) { 411 const EffectTree& effect_tree) {
418 const TransformNode* transform_node = 412 const TransformNode* transform_node =
419 transform_tree.Node(layer->transform_tree_index()); 413 transform_tree.Node(layer->transform_tree_index());
420 const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index()); 414 const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index());
421 415
422 // If the layer transform is not invertible, it should not be drawn. 416 // If the layer transform is not invertible, it should not be drawn.
423 bool has_inherited_invertible_or_animated_transform = 417 if (!transform_node->data.node_and_ancestors_are_animated_or_invertible)
424 (transform_node->data.is_invertible &&
425 transform_node->data.ancestors_are_invertible) ||
426 transform_node->data.to_screen_is_potentially_animated;
427 if (!has_inherited_invertible_or_animated_transform)
428 return true; 418 return true;
429 419
430 // When we need to do a readback/copy of a layer's output, we can not skip 420 // When we need to do a readback/copy of a layer's output, we can not skip
431 // it or any of its ancestors. 421 // it or any of its ancestors.
432 if (effect_node->data.num_copy_requests_in_subtree > 0) 422 if (effect_node->data.num_copy_requests_in_subtree > 0)
433 return false; 423 return false;
434 424
435 // If the layer is not drawn, then skip it and its subtree. 425 // If the layer is not drawn, then skip it and its subtree.
436 if (!effect_node->data.is_drawn) 426 if (!effect_node->data.is_drawn)
437 return true; 427 return true;
(...skipping 21 matching lines...) Expand all
459 bool layer_is_drawn, 449 bool layer_is_drawn,
460 const TransformTree& transform_tree, 450 const TransformTree& transform_tree,
461 const EffectTree& effect_tree) { 451 const EffectTree& effect_tree) {
462 const TransformNode* transform_node = 452 const TransformNode* transform_node =
463 transform_tree.Node(layer->transform_tree_index()); 453 transform_tree.Node(layer->transform_tree_index());
464 const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index()); 454 const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index());
465 // If the layer transform is not invertible, it should not be drawn. 455 // If the layer transform is not invertible, it should not be drawn.
466 // TODO(ajuma): Correctly process subtrees with singular transform for the 456 // TODO(ajuma): Correctly process subtrees with singular transform for the
467 // case where we may animate to a non-singular transform and wish to 457 // case where we may animate to a non-singular transform and wish to
468 // pre-raster. 458 // pre-raster.
469 bool has_inherited_invertible_or_animated_transform = 459 if (!transform_node->data.node_and_ancestors_are_animated_or_invertible)
470 (transform_node->data.is_invertible &&
471 transform_node->data.ancestors_are_invertible) ||
472 transform_node->data.to_screen_is_potentially_animated;
473 if (!has_inherited_invertible_or_animated_transform)
474 return true; 460 return true;
475 461
476 // When we need to do a readback/copy of a layer's output, we can not skip 462 // When we need to do a readback/copy of a layer's output, we can not skip
477 // it or any of its ancestors. 463 // it or any of its ancestors.
478 if (effect_node->data.num_copy_requests_in_subtree > 0) 464 if (effect_node->data.num_copy_requests_in_subtree > 0)
479 return false; 465 return false;
480 466
481 // If the layer is not drawn, then skip it and its subtree. 467 // If the layer is not drawn, then skip it and its subtree.
482 if (!effect_node->data.is_drawn) 468 if (!effect_node->data.is_drawn)
483 return true; 469 return true;
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1162 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1177 const Layer* overscroll_elasticity_layer, 1163 const Layer* overscroll_elasticity_layer,
1178 const gfx::Vector2dF& elastic_overscroll) { 1164 const gfx::Vector2dF& elastic_overscroll) {
1179 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1165 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1180 elastic_overscroll); 1166 elastic_overscroll);
1181 } 1167 }
1182 1168
1183 } // namespace draw_property_utils 1169 } // namespace draw_property_utils
1184 1170
1185 } // namespace cc 1171 } // namespace cc
OLDNEW
« no previous file with comments | « cc/proto/property_tree.proto ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698