Chromium Code Reviews| Index: cc/trees/layer_tree_host_common.cc |
| diff --git a/cc/trees/layer_tree_host_common.cc b/cc/trees/layer_tree_host_common.cc |
| index 8f6614536d42110f9f1030edb9265ad29a3e8115..63d6be0bddb94d2306dbcc6950934015b4687bd9 100644 |
| --- a/cc/trees/layer_tree_host_common.cc |
| +++ b/cc/trees/layer_tree_host_common.cc |
| @@ -1470,7 +1470,7 @@ static void CalculateDrawPropertiesInternal( |
| // the right results. |
| const bool layer_is_visible = |
| data_from_ancestor.subtree_is_visible_from_ancestor && |
| - !layer->hide_layer_and_subtree(); |
| + layer->opacity() != 0; |
| const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest(); |
| // The root layer cannot skip CalcDrawProperties. |
| @@ -2282,11 +2282,20 @@ enum PropertyTreeOption { |
| }; |
| void CalculateRenderTargetInternal(LayerImpl* layer, |
| + PropertyTrees* property_trees, |
| bool subtree_visible_from_ancestor, |
| - bool can_render_to_separate_surface) { |
| - const bool layer_is_visible = |
| - subtree_visible_from_ancestor && !layer->hide_layer_and_subtree(); |
| - const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest(); |
| + bool can_render_to_separate_surface, |
| + bool use_property_trees) { |
| + bool layer_is_drawn; |
| + if (use_property_trees) { |
| + DCHECK_GE(layer->effect_tree_index(), 0); |
| + layer_is_drawn = |
| + property_trees->effect_tree.Node(layer->effect_tree_index()) |
| + ->data.is_drawn; |
| + } else { |
| + layer_is_drawn = (subtree_visible_from_ancestor && layer->opacity() != 0) || |
| + layer->HasCopyRequest(); |
| + } |
| // The root layer cannot be skipped. |
| if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_drawn)) { |
| @@ -2319,7 +2328,8 @@ void CalculateRenderTargetInternal(LayerImpl* layer, |
| for (size_t i = 0; i < layer->children().size(); ++i) { |
| CalculateRenderTargetInternal( |
| LayerTreeHostCommon::get_layer_as_raw_ptr(layer->children(), i), |
| - layer_is_drawn, can_render_to_separate_surface); |
| + property_trees, layer_is_drawn, can_render_to_separate_surface, |
| + use_property_trees); |
| } |
| } |
| @@ -2350,14 +2360,16 @@ void CalculateRenderSurfaceLayerListInternal( |
| // |can_render_to_separate_surface| and |current_render_surface_layer_list_id| |
| // are settings that should stay the same during recursion. |
| - |
| - // Layers that are marked as hidden will hide themselves and their subtree. |
| - // Exception: Layers with copy requests, whether hidden or not, must be drawn |
| - // anyway. In this case, we will inform their subtree they are visible to get |
| - // the right results. |
| - const bool layer_is_visible = |
| - subtree_visible_from_ancestor && !layer->hide_layer_and_subtree(); |
| - const bool layer_is_drawn = layer_is_visible || layer->HasCopyRequest(); |
| + bool layer_is_drawn; |
|
weiliangc
2016/01/19 21:03:08
Initialize this please.
jaydasika
2016/01/19 22:10:36
Done.
|
| + if (use_property_trees) { |
| + DCHECK_GE(layer->effect_tree_index(), 0); |
| + layer_is_drawn = |
| + property_trees->effect_tree.Node(layer->effect_tree_index()) |
| + ->data.is_drawn; |
| + } else { |
| + layer_is_drawn = (subtree_visible_from_ancestor && layer->opacity() != 0) || |
| + layer->HasCopyRequest(); |
| + } |
| // The root layer cannot be skipped. |
| if (!IsRootLayer(layer) && SubtreeShouldBeSkipped(layer, layer_is_drawn)) { |
| @@ -2374,6 +2386,7 @@ void CalculateRenderSurfaceLayerListInternal( |
| if (render_to_separate_surface) { |
| DCHECK(layer->render_surface()); |
| + bool contributes_to_drawn_surface; |
|
weiliangc
2016/01/19 21:03:08
No need to compute here. Just compute at the locat
jaydasika
2016/01/19 22:10:36
Done.
|
| if (use_property_trees) { |
| RenderSurfaceDrawProperties draw_properties; |
| ComputeSurfaceDrawPropertiesUsingPropertyTrees( |
| @@ -2391,6 +2404,12 @@ void CalculateRenderSurfaceLayerListInternal( |
| layer->render_surface()->SetReplicaScreenSpaceTransform( |
| draw_properties.replica_screen_space_transform); |
| layer->render_surface()->SetClipRect(draw_properties.clip_rect); |
| + contributes_to_drawn_surface = |
| + property_trees->effect_tree.ContributesToDrawnSurface( |
| + layer->effect_tree_index()); |
| + } else { |
| + contributes_to_drawn_surface = |
| + subtree_visible_from_ancestor && layer->opacity() != 0.f; |
| } |
| if (!layer->double_sided() && |
| @@ -2409,7 +2428,7 @@ void CalculateRenderSurfaceLayerListInternal( |
| // Even if the |layer_is_drawn|, it only contributes to a drawn surface |
| // when the |layer_is_visible|. |
| layer->render_surface()->set_contributes_to_drawn_surface( |
| - layer_is_visible); |
| + contributes_to_drawn_surface); |
| } |
| // Ignore occlusion from outside the surface when surface contents need to |
| @@ -2574,8 +2593,10 @@ void CalculateRenderSurfaceLayerListInternal( |
| void CalculateRenderTarget( |
| LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) { |
| - CalculateRenderTargetInternal(inputs->root_layer, true, |
| - inputs->can_render_to_separate_surface); |
| + CalculateRenderTargetInternal( |
| + inputs->root_layer, inputs->property_trees, true, |
| + inputs->can_render_to_separate_surface, |
| + inputs->verify_property_trees || inputs->use_property_trees); |
| } |
| void CalculateRenderSurfaceLayerList( |