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

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

Issue 2755803003: cc: Remove SetNeedsCommitNoRebuild from Layer API (Closed)
Patch Set: check for LTH Created 3 years, 9 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
11 #include "cc/base/math_util.h" 11 #include "cc/base/math_util.h"
12 #include "cc/layers/draw_properties.h" 12 #include "cc/layers/draw_properties.h"
13 #include "cc/layers/layer.h" 13 #include "cc/layers/layer.h"
14 #include "cc/layers/layer_impl.h" 14 #include "cc/layers/layer_impl.h"
15 #include "cc/trees/clip_node.h" 15 #include "cc/trees/clip_node.h"
16 #include "cc/trees/effect_node.h" 16 #include "cc/trees/effect_node.h"
17 #include "cc/trees/layer_tree_impl.h" 17 #include "cc/trees/layer_tree_impl.h"
18 #include "cc/trees/property_tree.h" 18 #include "cc/trees/property_tree.h"
19 #include "cc/trees/property_tree_builder.h" 19 #include "cc/trees/property_tree_builder.h"
20 #include "cc/trees/scroll_node.h"
20 #include "cc/trees/transform_node.h" 21 #include "cc/trees/transform_node.h"
21 #include "ui/gfx/geometry/rect_conversions.h" 22 #include "ui/gfx/geometry/rect_conversions.h"
22 23
23 namespace cc { 24 namespace cc {
24 25
25 namespace draw_property_utils { 26 namespace draw_property_utils {
26 27
27 namespace { 28 namespace {
28 29
29 static bool IsRootLayer(const Layer* layer) { 30 static bool IsRootLayer(const Layer* layer) {
(...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 903
903 clip_node->combined_clip_in_target_space = gfx::IntersectRects( 904 clip_node->combined_clip_in_target_space = gfx::IntersectRects(
904 parent_combined_clip_in_target_space, source_clip_in_target_space); 905 parent_combined_clip_in_target_space, source_clip_in_target_space);
905 } 906 }
906 ResetIfHasNanCoordinate(&clip_node->clip_in_target_space); 907 ResetIfHasNanCoordinate(&clip_node->clip_in_target_space);
907 ResetIfHasNanCoordinate(&clip_node->combined_clip_in_target_space); 908 ResetIfHasNanCoordinate(&clip_node->combined_clip_in_target_space);
908 } 909 }
909 clip_tree->set_needs_update(false); 910 clip_tree->set_needs_update(false);
910 } 911 }
911 912
913 void UpdateScrollTree(ScrollTree* scroll_tree,
914 const LayerTreeHost* layer_tree_host) {
915 if (!scroll_tree->needs_update())
916 return;
917
918 for (int i = ScrollTree::kRootNodeId;
919 i < static_cast<int>(scroll_tree->size()); ++i) {
920 ScrollNode* scroll_node = scroll_tree->Node(i);
921 if (Layer* scroll_layer =
922 layer_tree_host->LayerById(scroll_node->owning_layer_id)) {
923 if (Layer* scroll_clip_layer = scroll_layer->scroll_clip_layer()) {
924 scroll_node->scroll_clip_layer_bounds = scroll_clip_layer->bounds();
925 }
926 }
927 }
928 }
929
912 void ComputeTransforms(TransformTree* transform_tree) { 930 void ComputeTransforms(TransformTree* transform_tree) {
913 if (!transform_tree->needs_update()) 931 if (!transform_tree->needs_update())
914 return; 932 return;
915 for (int i = TransformTree::kContentsRootNodeId; 933 for (int i = TransformTree::kContentsRootNodeId;
916 i < static_cast<int>(transform_tree->size()); ++i) 934 i < static_cast<int>(transform_tree->size()); ++i)
917 transform_tree->UpdateTransforms(i); 935 transform_tree->UpdateTransforms(i);
918 transform_tree->set_needs_update(false); 936 transform_tree->set_needs_update(false);
919 } 937 }
920 938
921 void UpdateRenderTarget(EffectTree* effect_tree, 939 void UpdateRenderTarget(EffectTree* effect_tree,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 ComputeClips(property_trees, can_render_to_separate_surface); 1066 ComputeClips(property_trees, can_render_to_separate_surface);
1049 1067
1050 FindLayersThatNeedUpdates(root_layer->layer_tree_impl(), property_trees, 1068 FindLayersThatNeedUpdates(root_layer->layer_tree_impl(), property_trees,
1051 visible_layer_list); 1069 visible_layer_list);
1052 CalculateClipRects(*visible_layer_list, property_trees, 1070 CalculateClipRects(*visible_layer_list, property_trees,
1053 can_render_to_separate_surface); 1071 can_render_to_separate_surface);
1054 CalculateVisibleRects(*visible_layer_list, property_trees, 1072 CalculateVisibleRects(*visible_layer_list, property_trees,
1055 can_render_to_separate_surface); 1073 can_render_to_separate_surface);
1056 } 1074 }
1057 1075
1058 void UpdatePropertyTrees(PropertyTrees* property_trees, 1076 void UpdatePropertyTrees(LayerTreeHost* layer_tree_host,
1077 PropertyTrees* property_trees,
1059 bool can_render_to_separate_surface) { 1078 bool can_render_to_separate_surface) {
1079 DCHECK(layer_tree_host);
1080 DCHECK(property_trees);
1081 DCHECK_EQ(layer_tree_host->property_trees(), property_trees);
1060 if (property_trees->non_root_surfaces_enabled != 1082 if (property_trees->non_root_surfaces_enabled !=
1061 can_render_to_separate_surface) { 1083 can_render_to_separate_surface) {
1062 property_trees->non_root_surfaces_enabled = can_render_to_separate_surface; 1084 property_trees->non_root_surfaces_enabled = can_render_to_separate_surface;
1063 property_trees->transform_tree.set_needs_update(true); 1085 property_trees->transform_tree.set_needs_update(true);
1064 } 1086 }
1065 if (property_trees->transform_tree.needs_update()) { 1087 if (property_trees->transform_tree.needs_update()) {
1066 property_trees->clip_tree.set_needs_update(true); 1088 property_trees->clip_tree.set_needs_update(true);
1067 property_trees->effect_tree.set_needs_update(true); 1089 property_trees->effect_tree.set_needs_update(true);
1068 } 1090 }
1091 UpdateScrollTree(&property_trees->scroll_tree, layer_tree_host);
1069 ComputeTransforms(&property_trees->transform_tree); 1092 ComputeTransforms(&property_trees->transform_tree);
1070 // Computation of clips uses surface contents scale which is updated while 1093 // Computation of clips uses surface contents scale which is updated while
1071 // computing effects. So, ComputeEffects should be before ComputeClips. 1094 // computing effects. So, ComputeEffects should be before ComputeClips.
1072 ComputeEffects(&property_trees->effect_tree); 1095 ComputeEffects(&property_trees->effect_tree);
1073 ComputeClips(property_trees, can_render_to_separate_surface); 1096 ComputeClips(property_trees, can_render_to_separate_surface);
1074 } 1097 }
1075 1098
1076 void BuildPropertyTreesAndComputeVisibleRects( 1099 void BuildPropertyTreesAndComputeVisibleRects(
1077 LayerImpl* root_layer, 1100 LayerImpl* root_layer,
1078 const LayerImpl* page_scale_layer, 1101 const LayerImpl* page_scale_layer,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 void UpdateElasticOverscroll(PropertyTrees* property_trees, 1494 void UpdateElasticOverscroll(PropertyTrees* property_trees,
1472 const Layer* overscroll_elasticity_layer, 1495 const Layer* overscroll_elasticity_layer,
1473 const gfx::Vector2dF& elastic_overscroll) { 1496 const gfx::Vector2dF& elastic_overscroll) {
1474 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer, 1497 UpdateElasticOverscrollInternal(property_trees, overscroll_elasticity_layer,
1475 elastic_overscroll); 1498 elastic_overscroll);
1476 } 1499 }
1477 1500
1478 } // namespace draw_property_utils 1501 } // namespace draw_property_utils
1479 1502
1480 } // namespace cc 1503 } // 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