| Index: cc/trees/draw_property_utils.cc
|
| diff --git a/cc/trees/draw_property_utils.cc b/cc/trees/draw_property_utils.cc
|
| index 27ef742570cf0370b73c3065465b1c4e44630450..7d22b7b3b377b7ce53eaeea0ebc8f251cc05945b 100644
|
| --- a/cc/trees/draw_property_utils.cc
|
| +++ b/cc/trees/draw_property_utils.cc
|
| @@ -282,7 +282,6 @@ static inline bool TransformToScreenIsKnown(LayerImpl* layer,
|
|
|
| template <typename LayerType>
|
| static bool LayerNeedsUpdateInternal(LayerType* layer,
|
| - bool layer_is_drawn,
|
| const TransformTree& tree) {
|
| // Layers can be skipped if any of these conditions are met.
|
| // - is not drawn due to it or one of its ancestors being hidden (or having
|
| @@ -300,9 +299,6 @@ static bool LayerNeedsUpdateInternal(LayerType* layer,
|
| // Note, if the layer should not have been drawn due to being fully
|
| // transparent, we would have skipped the entire subtree and never made it
|
| // into this function, so it is safe to omit this check here.
|
| - if (!layer_is_drawn)
|
| - return false;
|
| -
|
| if (!layer->DrawsContent() || layer->bounds().IsEmpty())
|
| return false;
|
|
|
| @@ -328,15 +324,11 @@ void FindLayersThatNeedUpdates(LayerTreeImpl* layer_tree_impl,
|
| LayerImplList* update_layer_list,
|
| std::vector<LayerImpl*>* visible_layer_list) {
|
| for (auto* layer_impl : *layer_tree_impl) {
|
| - bool layer_is_drawn =
|
| - effect_tree.Node(layer_impl->effect_tree_index())->data.is_drawn;
|
| -
|
| if (!IsRootLayer(layer_impl) &&
|
| - LayerShouldBeSkipped(layer_impl, layer_is_drawn, transform_tree,
|
| - effect_tree))
|
| + LayerShouldBeSkipped(layer_impl, transform_tree, effect_tree))
|
| continue;
|
|
|
| - if (LayerNeedsUpdate(layer_impl, layer_is_drawn, transform_tree)) {
|
| + if (LayerNeedsUpdate(layer_impl, transform_tree)) {
|
| visible_layer_list->push_back(layer_impl);
|
| update_layer_list->push_back(layer_impl);
|
| }
|
| @@ -378,88 +370,36 @@ void UpdateRenderSurfacesForLayersRecursive(EffectTree* effect_tree,
|
|
|
| } // namespace
|
|
|
| -static inline bool LayerShouldBeSkipped(Layer* layer,
|
| - bool layer_is_drawn,
|
| - const TransformTree& transform_tree,
|
| - const EffectTree& effect_tree) {
|
| +template <typename LayerType>
|
| +static inline bool LayerShouldBeSkippedInternal(
|
| + LayerType* layer,
|
| + const TransformTree& transform_tree,
|
| + const EffectTree& effect_tree) {
|
| const TransformNode* transform_node =
|
| transform_tree.Node(layer->transform_tree_index());
|
| const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index());
|
|
|
| - // If the layer transform is not invertible, it should not be drawn.
|
| - if (!transform_node->data.node_and_ancestors_are_animated_or_invertible)
|
| - return true;
|
| -
|
| - // When we need to do a readback/copy of a layer's output, we can not skip
|
| - // it or any of its ancestors.
|
| - if (effect_node->data.num_copy_requests_in_subtree > 0)
|
| - return false;
|
| -
|
| - // If the layer is not drawn, then skip it and its subtree.
|
| - if (!effect_node->data.is_drawn)
|
| - return true;
|
| -
|
| - if (!transform_node->data.to_screen_is_potentially_animated &&
|
| - effect_node->data.hidden_by_backface_visibility)
|
| - return true;
|
| -
|
| - // If layer has a background filter, don't skip the layer, even it the
|
| - // opacity is 0.
|
| - if (effect_node->data.node_or_ancestor_has_background_filters)
|
| - return false;
|
| -
|
| - // If the opacity is being animated then the opacity on the main thread is
|
| - // unreliable (since the impl thread may be using a different opacity), so it
|
| - // should not be trusted.
|
| - // In particular, it should not cause the subtree to be skipped.
|
| - // Similarly, for layers that might animate opacity using an impl-only
|
| - // animation, their subtree should also not be skipped.
|
| - return !effect_node->data.screen_space_opacity &&
|
| - !effect_node->data.to_screen_opacity_is_animated;
|
| + bool layer_is_drawn = effect_tree.property_trees()->is_active
|
| + ? effect_node->data.is_drawn_on_active
|
| + : effect_node->data.is_drawn_on_main_and_pending;
|
| + // If the layer transform is not invertible, it should be skipped.
|
| + // TODO(ajuma): Correctly process subtrees with singular transform for the
|
| + // case where we may animate to a non-singular transform and wish to
|
| + // pre-raster.
|
| + return !transform_node->data.node_and_ancestors_are_animated_or_invertible ||
|
| + effect_node->data.hidden_by_backface_visibility || !layer_is_drawn;
|
| }
|
|
|
| bool LayerShouldBeSkipped(LayerImpl* layer,
|
| - bool layer_is_drawn,
|
| const TransformTree& transform_tree,
|
| const EffectTree& effect_tree) {
|
| - const TransformNode* transform_node =
|
| - transform_tree.Node(layer->transform_tree_index());
|
| - const EffectNode* effect_node = effect_tree.Node(layer->effect_tree_index());
|
| - // If the layer transform is not invertible, it should not be drawn.
|
| - // TODO(ajuma): Correctly process subtrees with singular transform for the
|
| - // case where we may animate to a non-singular transform and wish to
|
| - // pre-raster.
|
| - if (!transform_node->data.node_and_ancestors_are_animated_or_invertible)
|
| - return true;
|
| -
|
| - // When we need to do a readback/copy of a layer's output, we can not skip
|
| - // it or any of its ancestors.
|
| - if (effect_node->data.num_copy_requests_in_subtree > 0)
|
| - return false;
|
| -
|
| - // If the layer is not drawn, then skip it and its subtree.
|
| - if (!effect_node->data.is_drawn)
|
| - return true;
|
| -
|
| - if (effect_node->data.hidden_by_backface_visibility)
|
| - return true;
|
| -
|
| - // If layer is on the pending tree and opacity is being animated then
|
| - // this subtree can't be skipped as we need to create, prioritize and
|
| - // include tiles for this layer when deciding if tree can be activated.
|
| - if (!transform_tree.property_trees()->is_active &&
|
| - effect_node->data.to_screen_opacity_is_animated)
|
| - return false;
|
| -
|
| - // If layer has a background filter, don't skip the layer, even it the
|
| - // opacity is 0.
|
| - if (effect_node->data.node_or_ancestor_has_background_filters)
|
| - return false;
|
| + return LayerShouldBeSkippedInternal(layer, transform_tree, effect_tree);
|
| +}
|
|
|
| - // The opacity of a layer always applies to its children (either implicitly
|
| - // via a render surface or explicitly if the parent preserves 3D), so the
|
| - // entire subtree can be skipped if this layer is fully transparent.
|
| - return !effect_node->data.screen_space_opacity;
|
| +bool LayerShouldBeSkipped(Layer* layer,
|
| + const TransformTree& transform_tree,
|
| + const EffectTree& effect_tree) {
|
| + return LayerShouldBeSkippedInternal(layer, transform_tree, effect_tree);
|
| }
|
|
|
| void FindLayersThatNeedUpdates(LayerTreeHost* layer_tree_host,
|
| @@ -469,15 +409,11 @@ void FindLayersThatNeedUpdates(LayerTreeHost* layer_tree_host,
|
| LayerTreeHostCommon::CallFunctionForEveryLayer(
|
| layer_tree_host,
|
| [&](Layer* layer) {
|
| - bool layer_is_drawn =
|
| - effect_tree.Node(layer->effect_tree_index())->data.is_drawn;
|
| -
|
| if (!IsRootLayer(layer) &&
|
| - LayerShouldBeSkipped(layer, layer_is_drawn, transform_tree,
|
| - effect_tree))
|
| + LayerShouldBeSkipped(layer, transform_tree, effect_tree))
|
| return;
|
|
|
| - if (LayerNeedsUpdate(layer, layer_is_drawn, transform_tree)) {
|
| + if (LayerNeedsUpdate(layer, transform_tree)) {
|
| update_layer_list->push_back(layer);
|
| }
|
|
|
| @@ -776,15 +712,13 @@ void ComputeVisibleRects(LayerImpl* root_layer,
|
| }
|
|
|
| bool LayerNeedsUpdate(Layer* layer,
|
| - bool layer_is_drawn,
|
| const TransformTree& tree) {
|
| - return LayerNeedsUpdateInternal(layer, layer_is_drawn, tree);
|
| + return LayerNeedsUpdateInternal(layer, tree);
|
| }
|
|
|
| bool LayerNeedsUpdate(LayerImpl* layer,
|
| - bool layer_is_drawn,
|
| const TransformTree& tree) {
|
| - return LayerNeedsUpdateInternal(layer, layer_is_drawn, tree);
|
| + return LayerNeedsUpdateInternal(layer, tree);
|
| }
|
|
|
| gfx::Transform DrawTransform(const LayerImpl* layer,
|
|
|