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

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

Issue 1865693003: cc : Remove subtree skipping in LayerTreeHostCommon (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 | « no previous file | 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 }; 528 };
529 529
530 void CalculateRenderTarget(LayerImpl* layer, 530 void CalculateRenderTarget(LayerImpl* layer,
531 PropertyTrees* property_trees, 531 PropertyTrees* property_trees,
532 bool subtree_visible_from_ancestor, 532 bool subtree_visible_from_ancestor,
533 bool can_render_to_separate_surface) { 533 bool can_render_to_separate_surface) {
534 bool layer_is_drawn; 534 bool layer_is_drawn;
535 DCHECK_GE(layer->effect_tree_index(), 0); 535 DCHECK_GE(layer->effect_tree_index(), 0);
536 layer_is_drawn = property_trees->effect_tree.Node(layer->effect_tree_index()) 536 layer_is_drawn = property_trees->effect_tree.Node(layer->effect_tree_index())
537 ->data.is_drawn; 537 ->data.is_drawn;
538 bool can_render_to_separate_surface_for_children =
539 can_render_to_separate_surface;
538 540
539 // The root layer cannot be skipped. 541 // The root layer cannot be skipped.
540 if (!IsRootLayer(layer) && 542 if (!IsRootLayer(layer) &&
541 draw_property_utils::LayerShouldBeSkipped( 543 draw_property_utils::LayerShouldBeSkipped(
542 layer, layer_is_drawn, property_trees->transform_tree)) { 544 layer, layer_is_drawn, property_trees->transform_tree)) {
543 layer->draw_properties().render_target = nullptr; 545 layer->draw_properties().render_target = nullptr;
544 return; 546 can_render_to_separate_surface_for_children = false;
ajuma 2016/04/06 22:02:41 If I'm understanding, in order to completely clean
jaydasika 2016/04/07 00:32:21 Just removing it should handle it, right?
ajuma 2016/04/07 15:19:56 Yes, that works.
545 } 547 } else {
548 bool render_to_separate_surface =
549 IsRootLayer(layer) ||
550 (can_render_to_separate_surface && layer->render_surface());
546 551
547 bool render_to_separate_surface = 552 if (render_to_separate_surface) {
548 IsRootLayer(layer) || 553 DCHECK(layer->render_surface()) << IsRootLayer(layer)
549 (can_render_to_separate_surface && layer->render_surface()); 554 << can_render_to_separate_surface
555 << layer->has_render_surface();
556 layer->draw_properties().render_target = layer;
550 557
551 if (render_to_separate_surface) { 558 if (layer->mask_layer())
552 DCHECK(layer->render_surface()) << IsRootLayer(layer) 559 layer->mask_layer()->draw_properties().render_target = layer;
553 << can_render_to_separate_surface
554 << layer->has_render_surface();
555 layer->draw_properties().render_target = layer;
556 560
557 if (layer->mask_layer()) 561 if (layer->replica_layer() && layer->replica_layer()->mask_layer())
558 layer->mask_layer()->draw_properties().render_target = layer; 562 layer->replica_layer()->mask_layer()->draw_properties().render_target =
563 layer;
559 564
560 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) 565 } else {
561 layer->replica_layer()->mask_layer()->draw_properties().render_target = 566 DCHECK(!IsRootLayer(layer));
562 layer; 567 layer->draw_properties().render_target = layer->parent()->render_target();
563 568 }
564 } else {
565 DCHECK(!IsRootLayer(layer));
566 layer->draw_properties().render_target = layer->parent()->render_target();
567 } 569 }
568 for (size_t i = 0; i < layer->children().size(); ++i) { 570 for (size_t i = 0; i < layer->children().size(); ++i) {
569 CalculateRenderTarget( 571 CalculateRenderTarget(
570 LayerTreeHostCommon::get_layer_as_raw_ptr(layer->children(), i), 572 LayerTreeHostCommon::get_layer_as_raw_ptr(layer->children(), i),
571 property_trees, layer_is_drawn, can_render_to_separate_surface); 573 property_trees, layer_is_drawn,
574 can_render_to_separate_surface_for_children);
572 } 575 }
573 } 576 }
574 577
575 void CalculateRenderSurfaceLayerList( 578 void CalculateRenderSurfaceLayerList(
576 LayerImpl* layer, 579 LayerImpl* layer,
577 PropertyTrees* property_trees, 580 PropertyTrees* property_trees,
578 LayerImplList* render_surface_layer_list, 581 LayerImplList* render_surface_layer_list,
579 LayerImplList* descendants, 582 LayerImplList* descendants,
580 RenderSurfaceImpl* nearest_occlusion_immune_ancestor, 583 RenderSurfaceImpl* nearest_occlusion_immune_ancestor,
581 bool subtree_visible_from_ancestor, 584 bool subtree_visible_from_ancestor,
(...skipping 20 matching lines...) Expand all
602 layer_is_drawn = property_trees->effect_tree.Node(layer->effect_tree_index()) 605 layer_is_drawn = property_trees->effect_tree.Node(layer->effect_tree_index())
603 ->data.is_drawn; 606 ->data.is_drawn;
604 607
605 // The root layer cannot be skipped. 608 // The root layer cannot be skipped.
606 if (!IsRootLayer(layer) && 609 if (!IsRootLayer(layer) &&
607 draw_property_utils::LayerShouldBeSkipped( 610 draw_property_utils::LayerShouldBeSkipped(
608 layer, layer_is_drawn, property_trees->transform_tree)) { 611 layer, layer_is_drawn, property_trees->transform_tree)) {
609 if (layer->render_surface()) 612 if (layer->render_surface())
610 layer->ClearRenderSurfaceLayerList(); 613 layer->ClearRenderSurfaceLayerList();
611 layer->draw_properties().render_target = nullptr; 614 layer->draw_properties().render_target = nullptr;
615 for (auto* child_layer : layer->children()) {
616 CalculateRenderSurfaceLayerList(
617 child_layer, property_trees, render_surface_layer_list, descendants,
618 nearest_occlusion_immune_ancestor, layer_is_drawn,
619 can_render_to_separate_surface, current_render_surface_layer_list_id,
620 max_texture_size);
621 }
612 return; 622 return;
613 } 623 }
614 624
615 bool render_to_separate_surface = 625 bool render_to_separate_surface =
616 IsRootLayer(layer) || 626 IsRootLayer(layer) ||
617 (can_render_to_separate_surface && layer->render_surface()); 627 (can_render_to_separate_surface && layer->render_surface());
618 628
619 if (render_to_separate_surface) { 629 if (render_to_separate_surface) {
620 DCHECK(layer->render_surface()); 630 DCHECK(layer->render_surface());
621 draw_property_utils::ComputeSurfaceDrawProperties(property_trees, 631 draw_property_utils::ComputeSurfaceDrawProperties(property_trees,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 775
766 if (render_to_separate_surface && !IsRootLayer(layer) && 776 if (render_to_separate_surface && !IsRootLayer(layer) &&
767 layer->render_surface()->DrawableContentRect().IsEmpty()) { 777 layer->render_surface()->DrawableContentRect().IsEmpty()) {
768 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list); 778 RemoveSurfaceForEarlyExit(layer, render_surface_layer_list);
769 return; 779 return;
770 } 780 }
771 781
772 // If neither this layer nor any of its children were added, early out. 782 // If neither this layer nor any of its children were added, early out.
773 if (descendants_size == descendants->size()) { 783 if (descendants_size == descendants->size()) {
774 DCHECK(!render_to_separate_surface || IsRootLayer(layer)); 784 DCHECK(!render_to_separate_surface || IsRootLayer(layer));
775 return; 785 return;
jaydasika 2016/04/07 00:32:21 This is a clean up unrelated to the CL. This is no
776 } 786 }
777 } 787 }
778 788
779 static void ComputeMaskLayerDrawProperties(const LayerImpl* layer, 789 static void ComputeMaskLayerDrawProperties(const LayerImpl* layer,
780 LayerImpl* mask_layer) { 790 LayerImpl* mask_layer) {
781 DrawProperties& mask_layer_draw_properties = mask_layer->draw_properties(); 791 DrawProperties& mask_layer_draw_properties = mask_layer->draw_properties();
782 mask_layer_draw_properties.visible_layer_rect = gfx::Rect(layer->bounds()); 792 mask_layer_draw_properties.visible_layer_rect = gfx::Rect(layer->bounds());
783 mask_layer_draw_properties.target_space_transform = 793 mask_layer_draw_properties.target_space_transform =
784 layer->draw_properties().target_space_transform; 794 layer->draw_properties().target_space_transform;
785 mask_layer_draw_properties.screen_space_transform = 795 mask_layer_draw_properties.screen_space_transform =
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 } 876 }
867 877
868 if (should_measure_property_tree_performance) { 878 if (should_measure_property_tree_performance) {
869 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"), 879 TRACE_EVENT_BEGIN0(TRACE_DISABLED_BY_DEFAULT("cc.debug.cdp-perf"),
870 "LayerTreeHostCommon::CalculateDrawProperties"); 880 "LayerTreeHostCommon::CalculateDrawProperties");
871 } 881 }
872 882
873 DCHECK(inputs->can_render_to_separate_surface == 883 DCHECK(inputs->can_render_to_separate_surface ==
874 inputs->property_trees->non_root_surfaces_enabled); 884 inputs->property_trees->non_root_surfaces_enabled);
875 const bool subtree_visible_from_ancestor = true; 885 const bool subtree_visible_from_ancestor = true;
876 for (auto* layer : *inputs->root_layer->layer_tree_impl())
877 layer->draw_properties().render_target = nullptr;
878 CalculateRenderTarget(inputs->root_layer, inputs->property_trees, 886 CalculateRenderTarget(inputs->root_layer, inputs->property_trees,
879 subtree_visible_from_ancestor, 887 subtree_visible_from_ancestor,
880 inputs->can_render_to_separate_surface); 888 inputs->can_render_to_separate_surface);
881 for (LayerImpl* layer : visible_layer_list) { 889 for (LayerImpl* layer : visible_layer_list) {
882 draw_property_utils::ComputeLayerDrawProperties( 890 draw_property_utils::ComputeLayerDrawProperties(
883 layer, inputs->property_trees, inputs->layers_always_allowed_lcd_text, 891 layer, inputs->property_trees, inputs->layers_always_allowed_lcd_text,
884 inputs->can_use_lcd_text); 892 inputs->can_use_lcd_text);
885 if (layer->mask_layer()) 893 if (layer->mask_layer())
886 ComputeMaskLayerDrawProperties(layer, layer->mask_layer()); 894 ComputeMaskLayerDrawProperties(layer, layer->mask_layer());
887 LayerImpl* replica_mask_layer = 895 LayerImpl* replica_mask_layer =
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 1001
994 PropertyTrees* GetPropertyTrees(Layer* layer) { 1002 PropertyTrees* GetPropertyTrees(Layer* layer) {
995 return layer->layer_tree_host()->property_trees(); 1003 return layer->layer_tree_host()->property_trees();
996 } 1004 }
997 1005
998 PropertyTrees* GetPropertyTrees(LayerImpl* layer) { 1006 PropertyTrees* GetPropertyTrees(LayerImpl* layer) {
999 return layer->layer_tree_impl()->property_trees(); 1007 return layer->layer_tree_impl()->property_trees();
1000 } 1008 }
1001 1009
1002 } // namespace cc 1010 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698