mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
[Impeller] Made the clear optimization handle backdrop filters. (flutter/engine#44192)
fixes https://github.com/flutter/flutter/issues/131576 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
1b4f573c46
commit
dbf0e3eead
@ -2179,6 +2179,23 @@ TEST_P(AiksTest, CollapsedDrawPaintInSubpass) {
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
TEST_P(AiksTest, CollapsedDrawPaintInSubpassBackdropFilter) {
|
||||
// Bug: https://github.com/flutter/flutter/issues/131576
|
||||
Canvas canvas;
|
||||
canvas.DrawPaint(
|
||||
{.color = Color::Yellow(), .blend_mode = BlendMode::kSource});
|
||||
canvas.SaveLayer({}, {},
|
||||
[](const FilterInput::Ref& input,
|
||||
const Matrix& effect_transform, bool is_subpass) {
|
||||
return FilterContents::MakeGaussianBlur(input, Sigma(20.0),
|
||||
Sigma(20.0));
|
||||
});
|
||||
canvas.DrawPaint(
|
||||
{.color = Color::CornflowerBlue(), .blend_mode = BlendMode::kSourceOver});
|
||||
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
TEST_P(AiksTest, ForegroundBlendSubpassCollapseOptimization) {
|
||||
Canvas canvas;
|
||||
|
||||
|
||||
@ -748,18 +748,19 @@ bool EntityPass::OnRender(
|
||||
render_element(backdrop_entity);
|
||||
}
|
||||
|
||||
bool is_collapsing_clear_colors = true;
|
||||
bool is_collapsing_clear_colors = !collapsed_parent_pass &&
|
||||
// Backdrop filters act as a entity before
|
||||
// everything and disrupt the optimization.
|
||||
!backdrop_filter_proc_;
|
||||
for (const auto& element : elements_) {
|
||||
// Skip elements that are incorporated into the clear color.
|
||||
if (!collapsed_parent_pass) {
|
||||
if (is_collapsing_clear_colors) {
|
||||
auto [entity_color, _] =
|
||||
ElementAsBackgroundColor(element, root_pass_size);
|
||||
if (entity_color.has_value()) {
|
||||
continue;
|
||||
}
|
||||
is_collapsing_clear_colors = false;
|
||||
if (is_collapsing_clear_colors) {
|
||||
auto [entity_color, _] =
|
||||
ElementAsBackgroundColor(element, root_pass_size);
|
||||
if (entity_color.has_value()) {
|
||||
continue;
|
||||
}
|
||||
is_collapsing_clear_colors = false;
|
||||
}
|
||||
|
||||
EntityResult result =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user