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

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

Issue 2885233002: cc : Create effect nodes for non axis aligned clips (Closed)
Patch Set: 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/layer_tree_host_common_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 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/property_tree_builder.h" 5 #include "cc/trees/property_tree_builder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 bool in_subtree_of_page_scale_layer; 48 bool in_subtree_of_page_scale_layer;
49 bool affected_by_inner_viewport_bounds_delta; 49 bool affected_by_inner_viewport_bounds_delta;
50 bool affected_by_outer_viewport_bounds_delta; 50 bool affected_by_outer_viewport_bounds_delta;
51 bool should_flatten; 51 bool should_flatten;
52 bool is_hidden; 52 bool is_hidden;
53 uint32_t main_thread_scrolling_reasons; 53 uint32_t main_thread_scrolling_reasons;
54 bool scroll_tree_parent_created_by_uninheritable_criteria; 54 bool scroll_tree_parent_created_by_uninheritable_criteria;
55 const gfx::Transform* device_transform; 55 const gfx::Transform* device_transform;
56 gfx::Transform compound_transform_since_render_target; 56 gfx::Transform compound_transform_since_render_target;
57 bool animation_axis_aligned_since_render_target; 57 bool animation_axis_aligned_since_render_target;
58 bool not_axis_aligned_since_last_clip;
58 SkColor safe_opaque_background_color; 59 SkColor safe_opaque_background_color;
59 }; 60 };
60 61
61 static LayerPositionConstraint PositionConstraint(Layer* layer) { 62 static LayerPositionConstraint PositionConstraint(Layer* layer) {
62 return layer->position_constraint(); 63 return layer->position_constraint();
63 } 64 }
64 65
65 static LayerPositionConstraint PositionConstraint(LayerImpl* layer) { 66 static LayerPositionConstraint PositionConstraint(LayerImpl* layer) {
66 return layer->test_properties()->position_constraint; 67 return layer->test_properties()->position_constraint;
67 } 68 }
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 const bool has_proxied_opacity = 876 const bool has_proxied_opacity =
876 !!(layer->mutable_properties() & MutableProperty::kOpacity); 877 !!(layer->mutable_properties() & MutableProperty::kOpacity);
877 878
878 data_for_children->animation_axis_aligned_since_render_target &= 879 data_for_children->animation_axis_aligned_since_render_target &=
879 AnimationsPreserveAxisAlignment(layer); 880 AnimationsPreserveAxisAlignment(layer);
880 data_for_children->compound_transform_since_render_target *= Transform(layer); 881 data_for_children->compound_transform_since_render_target *= Transform(layer);
881 const bool should_create_render_surface = ShouldCreateRenderSurface( 882 const bool should_create_render_surface = ShouldCreateRenderSurface(
882 layer, data_for_children->compound_transform_since_render_target, 883 layer, data_for_children->compound_transform_since_render_target,
883 data_for_children->animation_axis_aligned_since_render_target); 884 data_for_children->animation_axis_aligned_since_render_target);
884 885
886 bool not_axis_aligned_since_last_clip =
887 data_from_ancestor.not_axis_aligned_since_last_clip
888 ? true
889 : !AnimationsPreserveAxisAlignment(layer) ||
890 !Transform(layer).Preserves2dAxisAlignment();
891 // A non-axis aligned clip may need a render surface. So, we create an effect
892 // node.
893 bool has_non_axis_aligned_clip =
894 not_axis_aligned_since_last_clip && LayerClipsSubtree(layer);
895
885 bool requires_node = is_root || has_transparency || 896 bool requires_node = is_root || has_transparency ||
886 has_potential_opacity_animation || has_proxied_opacity || 897 has_potential_opacity_animation || has_proxied_opacity ||
898 has_non_axis_aligned_clip ||
887 should_create_render_surface; 899 should_create_render_surface;
888 900
889 int parent_id = data_from_ancestor.effect_tree_parent; 901 int parent_id = data_from_ancestor.effect_tree_parent;
890 902
891 if (!requires_node) { 903 if (!requires_node) {
892 layer->SetEffectTreeIndex(parent_id); 904 layer->SetEffectTreeIndex(parent_id);
893 data_for_children->effect_tree_parent = parent_id; 905 data_for_children->effect_tree_parent = parent_id;
894 return false; 906 return false;
895 } 907 }
896 908
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 bool created_transform_node = AddTransformNodeIfNeeded( 1154 bool created_transform_node = AddTransformNodeIfNeeded(
1143 data_from_parent, layer, created_render_surface, &data_for_children); 1155 data_from_parent, layer, created_render_surface, &data_for_children);
1144 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node, 1156 AddClipNodeIfNeeded(data_from_parent, layer, created_transform_node,
1145 &data_for_children); 1157 &data_for_children);
1146 1158
1147 AddScrollNodeIfNeeded(data_from_parent, layer, &data_for_children); 1159 AddScrollNodeIfNeeded(data_from_parent, layer, &data_for_children);
1148 1160
1149 SetBackfaceVisibilityTransform(layer, created_transform_node); 1161 SetBackfaceVisibilityTransform(layer, created_transform_node);
1150 SetSafeOpaqueBackgroundColor(data_from_parent, layer, &data_for_children); 1162 SetSafeOpaqueBackgroundColor(data_from_parent, layer, &data_for_children);
1151 1163
1164 bool not_axis_aligned_since_last_clip =
1165 data_from_parent.not_axis_aligned_since_last_clip
1166 ? true
1167 : !AnimationsPreserveAxisAlignment(layer) ||
1168 !Transform(layer).Preserves2dAxisAlignment();
1169 bool has_non_axis_aligned_clip =
1170 not_axis_aligned_since_last_clip && LayerClipsSubtree(layer);
1171 data_for_children.not_axis_aligned_since_last_clip =
1172 !has_non_axis_aligned_clip;
1173
1152 for (size_t i = 0; i < Children(layer).size(); ++i) { 1174 for (size_t i = 0; i < Children(layer).size(); ++i) {
1153 LayerType* current_child = ChildAt(layer, i); 1175 LayerType* current_child = ChildAt(layer, i);
1154 SetLayerPropertyChangedForChild(layer, current_child); 1176 SetLayerPropertyChangedForChild(layer, current_child);
1155 if (!ScrollParent(current_child)) { 1177 if (!ScrollParent(current_child)) {
1156 BuildPropertyTreesInternal(current_child, data_for_children); 1178 BuildPropertyTreesInternal(current_child, data_for_children);
1157 } else { 1179 } else {
1158 // The child should be included in its scroll parent's list of scroll 1180 // The child should be included in its scroll parent's list of scroll
1159 // children. 1181 // children.
1160 DCHECK(ScrollChildren(ScrollParent(current_child))->count(current_child)); 1182 DCHECK(ScrollChildren(ScrollParent(current_child))->count(current_child));
1161 } 1183 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 data_for_recursion.is_hidden = false; 1274 data_for_recursion.is_hidden = false;
1253 data_for_recursion.main_thread_scrolling_reasons = 1275 data_for_recursion.main_thread_scrolling_reasons =
1254 MainThreadScrollingReason::kNotScrollingOnMain; 1276 MainThreadScrollingReason::kNotScrollingOnMain;
1255 data_for_recursion.scroll_tree_parent_created_by_uninheritable_criteria = 1277 data_for_recursion.scroll_tree_parent_created_by_uninheritable_criteria =
1256 true; 1278 true;
1257 data_for_recursion.device_transform = &device_transform; 1279 data_for_recursion.device_transform = &device_transform;
1258 1280
1259 data_for_recursion.property_trees->clear(); 1281 data_for_recursion.property_trees->clear();
1260 data_for_recursion.compound_transform_since_render_target = gfx::Transform(); 1282 data_for_recursion.compound_transform_since_render_target = gfx::Transform();
1261 data_for_recursion.animation_axis_aligned_since_render_target = true; 1283 data_for_recursion.animation_axis_aligned_since_render_target = true;
1284 data_for_recursion.not_axis_aligned_since_last_clip = false;
1262 data_for_recursion.property_trees->transform_tree.set_device_scale_factor( 1285 data_for_recursion.property_trees->transform_tree.set_device_scale_factor(
1263 device_scale_factor); 1286 device_scale_factor);
1264 data_for_recursion.safe_opaque_background_color = color; 1287 data_for_recursion.safe_opaque_background_color = color;
1265 1288
1266 ClipNode root_clip; 1289 ClipNode root_clip;
1267 root_clip.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP; 1290 root_clip.clip_type = ClipNode::ClipType::APPLIES_LOCAL_CLIP;
1268 root_clip.clip = gfx::RectF(viewport); 1291 root_clip.clip = gfx::RectF(viewport);
1269 root_clip.transform_id = TransformTree::kRootNodeId; 1292 root_clip.transform_id = TransformTree::kRootNodeId;
1270 data_for_recursion.clip_tree_parent = 1293 data_for_recursion.clip_tree_parent =
1271 data_for_recursion.property_trees->clip_tree.Insert( 1294 data_for_recursion.property_trees->clip_tree.Insert(
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 root_layer, page_scale_layer, inner_viewport_scroll_layer, 1388 root_layer, page_scale_layer, inner_viewport_scroll_layer,
1366 outer_viewport_scroll_layer, overscroll_elasticity_layer, 1389 outer_viewport_scroll_layer, overscroll_elasticity_layer,
1367 elastic_overscroll, page_scale_factor, device_scale_factor, viewport, 1390 elastic_overscroll, page_scale_factor, device_scale_factor, viewport,
1368 device_transform, property_trees, color); 1391 device_transform, property_trees, color);
1369 property_trees->effect_tree.CreateOrReuseRenderSurfaces( 1392 property_trees->effect_tree.CreateOrReuseRenderSurfaces(
1370 &render_surfaces, root_layer->layer_tree_impl()); 1393 &render_surfaces, root_layer->layer_tree_impl());
1371 property_trees->ResetCachedData(); 1394 property_trees->ResetCachedData();
1372 } 1395 }
1373 1396
1374 } // namespace cc 1397 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698