Index: cc/trees/property_tree.cc |
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc |
index 7eea35e1152329e819f1dcfafa0ca08607e98d1b..f9f4d0ea1155f611e69f81e50ce504d9bc6d77cf 100644 |
--- a/cc/trees/property_tree.cc |
+++ b/cc/trees/property_tree.cc |
@@ -438,6 +438,9 @@ EffectNodeData::EffectNodeData() |
has_render_surface(false), |
has_copy_request(false), |
has_background_filters(false), |
+ node_or_ancestor_has_background_filters(false), |
+ to_screen_opacity_is_animated(false), |
+ node_or_ancestor_has_backface_visible_surface(false), |
is_drawn(true), |
has_animated_opacity(false), |
effect_changed(false), |
@@ -453,6 +456,11 @@ bool EffectNodeData::operator==(const EffectNodeData& other) const { |
has_render_surface == other.has_render_surface && |
has_copy_request == other.has_copy_request && |
has_background_filters == other.has_background_filters && |
+ node_or_ancestor_has_background_filters == |
+ other.node_or_ancestor_has_background_filters && |
+ to_screen_opacity_is_animated == other.to_screen_opacity_is_animated && |
+ node_or_ancestor_has_backface_visible_surface == |
+ other.node_or_ancestor_has_backface_visible_surface && |
is_drawn == other.is_drawn && |
has_animated_opacity == other.has_animated_opacity && |
effect_changed == other.effect_changed && |
@@ -468,6 +476,11 @@ void EffectNodeData::ToProtobuf(proto::TreeNode* proto) const { |
data->set_has_render_surface(has_render_surface); |
data->set_has_copy_request(has_copy_request); |
data->set_has_background_filters(has_background_filters); |
+ data->set_node_or_ancestor_has_background_filters( |
+ node_or_ancestor_has_background_filters); |
+ data->set_to_screen_opacity_is_animated(to_screen_opacity_is_animated); |
+ data->set_node_or_ancestor_has_backface_visible_surface( |
+ node_or_ancestor_has_backface_visible_surface); |
data->set_is_drawn(is_drawn); |
data->set_has_animated_opacity(has_animated_opacity); |
data->set_effect_changed(effect_changed); |
@@ -485,6 +498,11 @@ void EffectNodeData::FromProtobuf(const proto::TreeNode& proto) { |
has_render_surface = data.has_render_surface(); |
has_copy_request = data.has_copy_request(); |
has_background_filters = data.has_background_filters(); |
+ node_or_ancestor_has_background_filters = |
+ data.node_or_ancestor_has_background_filters(); |
+ to_screen_opacity_is_animated = data.to_screen_opacity_is_animated(); |
+ node_or_ancestor_has_backface_visible_surface = |
+ data.node_or_ancestor_has_backface_visible_surface(); |
is_drawn = data.is_drawn(); |
has_animated_opacity = data.has_animated_opacity(); |
effect_changed = data.effect_changed(); |
@@ -1205,6 +1223,46 @@ void EffectTree::UpdateEffectChanged(EffectNode* node, |
} |
} |
+void EffectTree::UpdateBackfaceVisibility(EffectNode* node, |
+ EffectNode* parent_node) { |
+ if (node->owner_id == -1) { |
jaydasika
2016/03/29 15:48:43
Are there any cases where the owner id will be -1
sunxd
2016/03/30 15:21:34
The only case is the dummy tree root. Another opti
ajuma
2016/03/30 17:10:11
How about just checking if parent_node is null?
|
+ node->data.node_or_ancestor_has_backface_visible_surface = false; |
+ return; |
+ } |
+ if (parent_node && |
+ parent_node->data.node_or_ancestor_has_backface_visible_surface) { |
+ node->data.node_or_ancestor_has_backface_visible_surface = true; |
ajuma
2016/03/29 17:06:46
I think this early-out is only valid if we're taki
sunxd
2016/03/30 15:21:34
Done.
|
+ return; |
+ } |
+ |
+ TransformTree& transform_tree = property_trees()->transform_tree; |
+ TransformNode* transform_node = transform_tree.Node(node->data.transform_id); |
ajuma
2016/03/29 17:06:46
Is this the right transform id? I think this is th
sunxd
2016/03/30 15:21:34
I think it is the correct one. In AddEffectNodeIfN
|
+ if (node->data.has_render_surface) { |
+ if (transform_node->data.is_invertible && |
+ transform_node->data.ancestors_are_invertible) { |
+ if (transform_node->data.sorting_context_id) { |
+ const TransformNode* parent_transform_node = |
+ transform_tree.parent(transform_node); |
+ if (parent_transform_node && |
+ parent_transform_node->data.sorting_context_id == |
+ transform_node->data.sorting_context_id) { |
+ gfx::Transform surface_draw_transform; |
+ transform_tree.ComputeTransform(transform_node->id, |
+ transform_node->data.target_id, |
+ &surface_draw_transform); |
+ node->data.node_or_ancestor_has_backface_visible_surface = |
+ surface_draw_transform.IsBackFaceVisible(); |
+ } else { |
+ node->data.node_or_ancestor_has_backface_visible_surface = |
+ transform_node->data.local.IsBackFaceVisible(); |
+ } |
+ return; |
+ } |
+ } |
+ } |
+ node->data.node_or_ancestor_has_backface_visible_surface = false; |
+} |
+ |
void EffectTree::UpdateEffects(int id) { |
EffectNode* node = Node(id); |
EffectNode* parent_node = parent(node); |
@@ -1212,6 +1270,7 @@ void EffectTree::UpdateEffects(int id) { |
UpdateOpacities(node, parent_node); |
UpdateIsDrawn(node, parent_node); |
UpdateEffectChanged(node, parent_node); |
+ UpdateBackfaceVisibility(node, parent_node); |
} |
void EffectTree::ClearCopyRequests() { |