Consider potential filter animation for LCDTextDisallowedReason::kPixelOrColorEffect
In this CL, has_potential_filter_animation, has_potential_backdrop_filter_animation are considered while calculating node_or_ancestor_has_filters, affected_by_backdrop_filter to avoid rerasterization during the animation.
Bug: 1115564
Change-Id: If58e1e71477758fc0c56e46f5dfd5ad6687cd43e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2412028
Commit-Queue: jongdeok.kim <jongdeok.kim@navercorp.com>
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807344}
This commit is contained in:
@ -6219,6 +6219,22 @@ TEST_P(LCDTextTest, Filter) {
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kNone, "no filter");
|
||||
}
|
||||
|
||||
TEST_P(LCDTextTest, FilterAnimation) {
|
||||
FilterOperations blur_filter;
|
||||
blur_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
||||
SetFilter(layer_, blur_filter);
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kPixelOrColorEffect, "filter");
|
||||
|
||||
GetEffectNode(layer_)->has_potential_filter_animation = true;
|
||||
SetFilter(layer_, FilterOperations());
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kPixelOrColorEffect,
|
||||
"filter animation");
|
||||
|
||||
GetEffectNode(layer_)->has_potential_filter_animation = false;
|
||||
SetFilter(layer_, FilterOperations());
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kNone, "no filter");
|
||||
}
|
||||
|
||||
TEST_P(LCDTextTest, BackdropFilter) {
|
||||
FilterOperations backdrop_filter;
|
||||
backdrop_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
||||
@ -6235,6 +6251,28 @@ TEST_P(LCDTextTest, BackdropFilter) {
|
||||
layer_);
|
||||
}
|
||||
|
||||
TEST_P(LCDTextTest, BackdropFilterAnimation) {
|
||||
FilterOperations backdrop_filter;
|
||||
backdrop_filter.Append(FilterOperation::CreateBlurFilter(4.0f));
|
||||
SetBackdropFilter(descendant_, backdrop_filter);
|
||||
UpdateDrawProperties(host_impl()->active_tree());
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kPixelOrColorEffect,
|
||||
"backdrop-filter", layer_);
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kNone, "backdrop-filter",
|
||||
descendant_);
|
||||
|
||||
GetEffectNode(descendant_)->has_potential_backdrop_filter_animation = true;
|
||||
SetBackdropFilter(descendant_, FilterOperations());
|
||||
UpdateDrawProperties(host_impl()->active_tree());
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kPixelOrColorEffect,
|
||||
"backdrop-filter animation", layer_);
|
||||
|
||||
GetEffectNode(descendant_)->has_potential_backdrop_filter_animation = false;
|
||||
UpdateDrawProperties(host_impl()->active_tree());
|
||||
CheckCanUseLCDText(LCDTextDisallowedReason::kNone, "no backdrop-filter",
|
||||
layer_);
|
||||
}
|
||||
|
||||
TEST_P(LCDTextTest, ContentsOpaqueForText) {
|
||||
layer_->SetContentsOpaque(false);
|
||||
layer_->SetBackgroundColor(SK_ColorGREEN);
|
||||
|
@ -777,7 +777,8 @@ void UpdateRenderTarget(EffectTree* effect_tree) {
|
||||
} else {
|
||||
node->target_id = effect_tree->parent(node)->target_id;
|
||||
}
|
||||
if (!node->backdrop_filters.IsEmpty())
|
||||
if (!node->backdrop_filters.IsEmpty() ||
|
||||
node->has_potential_backdrop_filter_animation)
|
||||
last_backdrop_filter = node->id;
|
||||
node->affected_by_backdrop_filter = false;
|
||||
}
|
||||
@ -795,7 +796,8 @@ void UpdateRenderTarget(EffectTree* effect_tree) {
|
||||
current_target_id = kInvalidNodeId;
|
||||
// While down to kContentsRootNodeId, move |current_target_id| forward if
|
||||
// |node| has backdrop filter.
|
||||
if (!node->backdrop_filters.IsEmpty() &&
|
||||
if ((!node->backdrop_filters.IsEmpty() ||
|
||||
node->has_potential_backdrop_filter_animation) &&
|
||||
current_target_id == kInvalidNodeId)
|
||||
current_target_id = node->target_id;
|
||||
}
|
||||
|
@ -743,7 +743,8 @@ void EffectTree::UpdateEffectChanged(EffectNode* node,
|
||||
}
|
||||
|
||||
void EffectTree::UpdateHasFilters(EffectNode* node, EffectNode* parent_node) {
|
||||
node->node_or_ancestor_has_filters = !node->filters.IsEmpty();
|
||||
node->node_or_ancestor_has_filters =
|
||||
!node->filters.IsEmpty() || node->has_potential_filter_animation;
|
||||
if (parent_node) {
|
||||
node->node_or_ancestor_has_filters |=
|
||||
parent_node->node_or_ancestor_has_filters;
|
||||
|
Reference in New Issue
Block a user