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..7d78b4deee0f09ea05cd36b4f0fceeaec13d104e 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. |
| @@ -2283,10 +2283,15 @@ enum PropertyTreeOption { |
| void CalculateRenderTargetInternal(LayerImpl* layer, |
| 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) { |
| + layer_is_drawn = layer->IsDrawnFromPropertyTrees(); |
| + } 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 +2324,7 @@ 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); |
| + layer_is_drawn, can_render_to_separate_surface, use_property_trees); |
| } |
| } |
| @@ -2350,14 +2355,13 @@ 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; |
| + if (use_property_trees) { |
| + layer_is_drawn = layer->IsDrawnFromPropertyTrees(); |
| + } 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 +2378,7 @@ void CalculateRenderSurfaceLayerListInternal( |
| if (render_to_separate_surface) { |
| DCHECK(layer->render_surface()); |
| + bool contributes_to_drawn_surface; |
| if (use_property_trees) { |
| RenderSurfaceDrawProperties draw_properties; |
| ComputeSurfaceDrawPropertiesUsingPropertyTrees( |
| @@ -2391,6 +2396,14 @@ void CalculateRenderSurfaceLayerListInternal( |
| layer->render_surface()->SetReplicaScreenSpaceTransform( |
| draw_properties.replica_screen_space_transform); |
| layer->render_surface()->SetClipRect(draw_properties.clip_rect); |
| + // All drawn layers contribute to drawn surface. |
| + // Exception : Layers that are hidden and are drawn only for the sake of |
| + // copy requests. |
| + contributes_to_drawn_surface = |
| + layer_is_drawn && !(layer->IsHidden() && layer->HasCopyRequest()); |
|
ajuma
2016/01/15 15:02:46
This seems almost equivalent to:
layer_is_drawn &&
jaydasika
2016/01/15 18:23:05
Is we have R->R1->R2, render surfaces R1 and R2 ar
ajuma
2016/01/15 18:48:16
Hmm, true. layer_is_drawn (roughly, ignoring backg
|
| + } else { |
| + contributes_to_drawn_surface = |
| + subtree_visible_from_ancestor && layer->opacity() != 0.f; |
| } |
| if (!layer->double_sided() && |
| @@ -2409,7 +2422,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 +2587,9 @@ void CalculateRenderSurfaceLayerListInternal( |
| void CalculateRenderTarget( |
| LayerTreeHostCommon::CalcDrawPropsImplInputs* inputs) { |
| - CalculateRenderTargetInternal(inputs->root_layer, true, |
| - inputs->can_render_to_separate_surface); |
| + CalculateRenderTargetInternal( |
| + inputs->root_layer, true, inputs->can_render_to_separate_surface, |
| + inputs->verify_property_trees || inputs->use_property_trees); |
| } |
| void CalculateRenderSurfaceLayerList( |