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

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

Issue 2693703010: cc: Remove support for disabling non-root render surfaces. (Closed)
Patch Set: softwaredraw-remove-no-surfaces: rebase Created 3 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/draw_property_utils.h ('k') | cc/trees/layer_tree_host.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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } 706 }
707 707
708 static ConditionalClip LayerClipRect(PropertyTrees* property_trees, 708 static ConditionalClip LayerClipRect(PropertyTrees* property_trees,
709 LayerImpl* layer) { 709 LayerImpl* layer) {
710 const EffectTree* effect_tree = &property_trees->effect_tree; 710 const EffectTree* effect_tree = &property_trees->effect_tree;
711 const EffectNode* effect_node = effect_tree->Node(layer->effect_tree_index()); 711 const EffectNode* effect_node = effect_tree->Node(layer->effect_tree_index());
712 const EffectNode* target_node = 712 const EffectNode* target_node =
713 effect_node->has_render_surface 713 effect_node->has_render_surface
714 ? effect_node 714 ? effect_node
715 : effect_tree->Node(effect_node->target_id); 715 : effect_tree->Node(effect_node->target_id);
716 // TODO(weiliangc): When effect node has up to date render surface info on
717 // compositor thread, no need to check for resourceless draw mode
718 if (!property_trees->non_root_surfaces_enabled) {
719 target_node = effect_tree->Node(1);
720 }
721
722 bool include_expanding_clips = false; 716 bool include_expanding_clips = false;
723 return ComputeAccumulatedClip(property_trees, include_expanding_clips, 717 return ComputeAccumulatedClip(property_trees, include_expanding_clips,
724 layer->clip_tree_index(), target_node->id); 718 layer->clip_tree_index(), target_node->id);
725 } 719 }
726 720
727 static void UpdateRenderTarget(EffectTree* effect_tree, 721 static void UpdateRenderTarget(EffectTree* effect_tree) {
728 bool can_render_to_separate_surface) {
729 for (int i = EffectTree::kContentsRootNodeId; 722 for (int i = EffectTree::kContentsRootNodeId;
730 i < static_cast<int>(effect_tree->size()); ++i) { 723 i < static_cast<int>(effect_tree->size()); ++i) {
731 EffectNode* node = effect_tree->Node(i); 724 EffectNode* node = effect_tree->Node(i);
732 if (i == EffectTree::kContentsRootNodeId) { 725 if (i == EffectTree::kContentsRootNodeId) {
733 // Render target of the node corresponding to root is itself. 726 // Render target of the node corresponding to root is itself.
734 node->target_id = EffectTree::kContentsRootNodeId; 727 node->target_id = EffectTree::kContentsRootNodeId;
735 } else if (!can_render_to_separate_surface) {
736 node->target_id = EffectTree::kContentsRootNodeId;
737 } else if (effect_tree->parent(node)->has_render_surface) { 728 } else if (effect_tree->parent(node)->has_render_surface) {
738 node->target_id = node->parent_id; 729 node->target_id = node->parent_id;
739 } else { 730 } else {
740 node->target_id = effect_tree->parent(node)->target_id; 731 node->target_id = effect_tree->parent(node)->target_id;
741 } 732 }
742 } 733 }
743 } 734 }
744 735
745 static void UpdateScrollTree(ScrollTree* scroll_tree, 736 static void UpdateScrollTree(ScrollTree* scroll_tree,
746 const LayerTreeHost* layer_tree_host) { 737 const LayerTreeHost* layer_tree_host) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 void ComputeEffects(EffectTree* effect_tree) { 861 void ComputeEffects(EffectTree* effect_tree) {
871 if (!effect_tree->needs_update()) 862 if (!effect_tree->needs_update())
872 return; 863 return;
873 for (int i = EffectTree::kContentsRootNodeId; 864 for (int i = EffectTree::kContentsRootNodeId;
874 i < static_cast<int>(effect_tree->size()); ++i) 865 i < static_cast<int>(effect_tree->size()); ++i)
875 effect_tree->UpdateEffects(i); 866 effect_tree->UpdateEffects(i);
876 effect_tree->set_needs_update(false); 867 effect_tree->set_needs_update(false);
877 } 868 }
878 869
879 void UpdatePropertyTrees(LayerTreeHost* layer_tree_host, 870 void UpdatePropertyTrees(LayerTreeHost* layer_tree_host,
880 PropertyTrees* property_trees, 871 PropertyTrees* property_trees) {
881 bool can_render_to_separate_surface) {
882 DCHECK(layer_tree_host); 872 DCHECK(layer_tree_host);
883 DCHECK(property_trees); 873 DCHECK(property_trees);
884 DCHECK_EQ(layer_tree_host->property_trees(), property_trees); 874 DCHECK_EQ(layer_tree_host->property_trees(), property_trees);
885 if (property_trees->non_root_surfaces_enabled !=
886 can_render_to_separate_surface) {
887 property_trees->non_root_surfaces_enabled = can_render_to_separate_surface;
888 property_trees->transform_tree.set_needs_update(true);
889 }
890 if (property_trees->transform_tree.needs_update()) { 875 if (property_trees->transform_tree.needs_update()) {
891 property_trees->clip_tree.set_needs_update(true); 876 property_trees->clip_tree.set_needs_update(true);
892 property_trees->effect_tree.set_needs_update(true); 877 property_trees->effect_tree.set_needs_update(true);
893 } 878 }
894 UpdateScrollTree(&property_trees->scroll_tree, layer_tree_host); 879 UpdateScrollTree(&property_trees->scroll_tree, layer_tree_host);
895 ComputeTransforms(&property_trees->transform_tree); 880 ComputeTransforms(&property_trees->transform_tree);
896 ComputeEffects(&property_trees->effect_tree); 881 ComputeEffects(&property_trees->effect_tree);
897 // Computation of clips uses ToScreen which is updated while computing 882 // Computation of clips uses ToScreen which is updated while computing
898 // transforms. So, ComputeTransforms should be before ComputeClips. 883 // transforms. So, ComputeTransforms should be before ComputeClips.
899 ComputeClips(property_trees); 884 ComputeClips(property_trees);
900 } 885 }
901 886
902 void UpdatePropertyTreesAndRenderSurfaces(LayerImpl* root_layer, 887 void UpdatePropertyTreesAndRenderSurfaces(LayerImpl* root_layer,
903 PropertyTrees* property_trees, 888 PropertyTrees* property_trees,
904 bool can_render_to_separate_surface,
905 bool can_adjust_raster_scales) { 889 bool can_adjust_raster_scales) {
906 bool render_surfaces_need_update = false; 890 bool render_surfaces_need_update = false;
907 if (property_trees->non_root_surfaces_enabled !=
908 can_render_to_separate_surface) {
909 property_trees->non_root_surfaces_enabled = can_render_to_separate_surface;
910 property_trees->transform_tree.set_needs_update(true);
911 render_surfaces_need_update = true;
912 }
913 if (property_trees->can_adjust_raster_scales != can_adjust_raster_scales) { 891 if (property_trees->can_adjust_raster_scales != can_adjust_raster_scales) {
914 property_trees->can_adjust_raster_scales = can_adjust_raster_scales; 892 property_trees->can_adjust_raster_scales = can_adjust_raster_scales;
915 property_trees->transform_tree.set_needs_update(true); 893 property_trees->transform_tree.set_needs_update(true);
916 render_surfaces_need_update = true; 894 render_surfaces_need_update = true;
917 } 895 }
918 if (property_trees->transform_tree.needs_update()) { 896 if (property_trees->transform_tree.needs_update()) {
919 property_trees->clip_tree.set_needs_update(true); 897 property_trees->clip_tree.set_needs_update(true);
920 property_trees->effect_tree.set_needs_update(true); 898 property_trees->effect_tree.set_needs_update(true);
921 } 899 }
922 if (render_surfaces_need_update) { 900 if (render_surfaces_need_update) {
923 property_trees->effect_tree.UpdateRenderSurfaces( 901 property_trees->effect_tree.UpdateRenderSurfaces(
924 root_layer->layer_tree_impl(), 902 root_layer->layer_tree_impl());
925 property_trees->non_root_surfaces_enabled);
926 } 903 }
927 UpdateRenderTarget(&property_trees->effect_tree, 904 UpdateRenderTarget(&property_trees->effect_tree);
928 property_trees->non_root_surfaces_enabled);
929 905
930 ComputeTransforms(&property_trees->transform_tree); 906 ComputeTransforms(&property_trees->transform_tree);
931 ComputeEffects(&property_trees->effect_tree); 907 ComputeEffects(&property_trees->effect_tree);
932 // Computation of clips uses ToScreen which is updated while computing 908 // Computation of clips uses ToScreen which is updated while computing
933 // transforms. So, ComputeTransforms should be before ComputeClips. 909 // transforms. So, ComputeTransforms should be before ComputeClips.
934 ComputeClips(property_trees); 910 ComputeClips(property_trees);
935 } 911 }
936 912
937 bool LayerNeedsUpdate(Layer* layer, 913 bool LayerNeedsUpdate(Layer* layer,
938 bool layer_is_drawn, 914 bool layer_is_drawn,
939 const PropertyTrees* property_trees) { 915 const PropertyTrees* property_trees) {
940 return LayerNeedsUpdateInternal(layer, layer_is_drawn, property_trees); 916 return LayerNeedsUpdateInternal(layer, layer_is_drawn, property_trees);
941 } 917 }
942 918
943 bool LayerNeedsUpdate(LayerImpl* layer, 919 bool LayerNeedsUpdate(LayerImpl* layer,
944 bool layer_is_drawn, 920 bool layer_is_drawn,
945 const PropertyTrees* property_trees) { 921 const PropertyTrees* property_trees) {
946 return LayerNeedsUpdateInternal(layer, layer_is_drawn, property_trees); 922 return LayerNeedsUpdateInternal(layer, layer_is_drawn, property_trees);
947 } 923 }
948 924
949 gfx::Transform DrawTransform(const LayerImpl* layer, 925 gfx::Transform DrawTransform(const LayerImpl* layer,
950 const TransformTree& transform_tree, 926 const TransformTree& transform_tree,
951 const EffectTree& effect_tree) { 927 const EffectTree& effect_tree) {
952 // TransformTree::ToTarget computes transform between the layer's transform 928 // TransformTree::ToTarget computes transform between the layer's transform
953 // node and surface's transform node and scales it by the surface's content 929 // node and surface's transform node and scales it by the surface's content
954 // scale. 930 // scale.
955 gfx::Transform xform; 931 gfx::Transform xform;
956 if (transform_tree.property_trees()->non_root_surfaces_enabled) 932 transform_tree.property_trees()->GetToTarget(
957 transform_tree.property_trees()->GetToTarget( 933 layer->transform_tree_index(), layer->render_target_effect_tree_index(),
958 layer->transform_tree_index(), layer->render_target_effect_tree_index(), 934 &xform);
959 &xform);
960 else
961 xform = transform_tree.ToScreen(layer->transform_tree_index());
962 if (layer->should_flatten_transform_from_property_tree()) 935 if (layer->should_flatten_transform_from_property_tree())
963 xform.FlattenTo2d(); 936 xform.FlattenTo2d();
964 xform.Translate(layer->offset_to_transform_parent().x(), 937 xform.Translate(layer->offset_to_transform_parent().x(),
965 layer->offset_to_transform_parent().y()); 938 layer->offset_to_transform_parent().y());
966 return xform; 939 return xform;
967 } 940 }
968 941
969 gfx::Transform ScreenSpaceTransform(const Layer* layer, 942 gfx::Transform ScreenSpaceTransform(const Layer* layer,
970 const TransformTree& tree) { 943 const TransformTree& tree) {
971 return ScreenSpaceTransformInternal(layer, tree); 944 return ScreenSpaceTransformInternal(layer, tree);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1063 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1091 const Layer* overscroll_elasticity_layer, 1064 const Layer* overscroll_elasticity_layer,
1092 const gfx::Vector2dF& elastic_overscroll) { 1065 const gfx::Vector2dF& elastic_overscroll) {
1093 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1066 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1094 elastic_overscroll); 1067 elastic_overscroll);
1095 } 1068 }
1096 1069
1097 } // namespace draw_property_utils 1070 } // namespace draw_property_utils
1098 1071
1099 } // namespace cc 1072 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/draw_property_utils.h ('k') | cc/trees/layer_tree_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698