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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/property_tree_builder.cc
diff --git a/cc/trees/property_tree_builder.cc b/cc/trees/property_tree_builder.cc
index f025162e9f554d087b97826e28df916f65262272..a7efa0a71556ec6e68c77605d7e907fe504f32b3 100644
--- a/cc/trees/property_tree_builder.cc
+++ b/cc/trees/property_tree_builder.cc
@@ -55,6 +55,7 @@ struct DataForRecursion {
const gfx::Transform* device_transform;
gfx::Transform compound_transform_since_render_target;
bool animation_axis_aligned_since_render_target;
+ bool not_axis_aligned_since_last_clip;
SkColor safe_opaque_background_color;
};
@@ -882,8 +883,19 @@ bool AddEffectNodeIfNeeded(
layer, data_for_children->compound_transform_since_render_target,
data_for_children->animation_axis_aligned_since_render_target);
+ bool not_axis_aligned_since_last_clip =
+ data_from_ancestor.not_axis_aligned_since_last_clip
+ ? true
+ : !AnimationsPreserveAxisAlignment(layer) ||
+ !Transform(layer).Preserves2dAxisAlignment();
+ // A non-axis aligned clip may need a render surface. So, we create an effect
+ // node.
+ bool has_non_axis_aligned_clip =
+ not_axis_aligned_since_last_clip && LayerClipsSubtree(layer);
+
bool requires_node = is_root || has_transparency ||
has_potential_opacity_animation || has_proxied_opacity ||
+ has_non_axis_aligned_clip ||
should_create_render_surface;
int parent_id = data_from_ancestor.effect_tree_parent;
@@ -1149,6 +1161,16 @@ void BuildPropertyTreesInternal(
SetBackfaceVisibilityTransform(layer, created_transform_node);
SetSafeOpaqueBackgroundColor(data_from_parent, layer, &data_for_children);
+ bool not_axis_aligned_since_last_clip =
+ data_from_parent.not_axis_aligned_since_last_clip
+ ? true
+ : !AnimationsPreserveAxisAlignment(layer) ||
+ !Transform(layer).Preserves2dAxisAlignment();
+ bool has_non_axis_aligned_clip =
+ not_axis_aligned_since_last_clip && LayerClipsSubtree(layer);
+ data_for_children.not_axis_aligned_since_last_clip =
+ !has_non_axis_aligned_clip;
+
for (size_t i = 0; i < Children(layer).size(); ++i) {
LayerType* current_child = ChildAt(layer, i);
SetLayerPropertyChangedForChild(layer, current_child);
@@ -1259,6 +1281,7 @@ void BuildPropertyTreesTopLevelInternal(
data_for_recursion.property_trees->clear();
data_for_recursion.compound_transform_since_render_target = gfx::Transform();
data_for_recursion.animation_axis_aligned_since_render_target = true;
+ data_for_recursion.not_axis_aligned_since_last_clip = false;
data_for_recursion.property_trees->transform_tree.set_device_scale_factor(
device_scale_factor);
data_for_recursion.safe_opaque_background_color = color;
« 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