Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@bdero
Copy link
Member

@bdero bdero commented Jul 24, 2023

Resolves flutter/flutter#130355.

When drawing a backdrop filter, we offset the backdrop entity with -local_pass_position in order to align the backdrop texture with the position of the pass it's being drawn to. When rendering the filter, this transform propagates to the filter snapshot. Prior to this change, that offset was being applied within the space of the backdrop filter's matrix, which is wrong! It needs to be applied in screen space.

We didn't notice this prior to the coverage hint optimization because we were previously forcing subpass sizes to match the parent whenever a backdrop filter was present.

This one was very difficult to reason through at first, and so I added a detailed comment to explain the rationale behind the behavioral differences between the backdrop filter and non-backdrop filter cases of the matrix filter.

I also updated the golden to more clearly show the coverage leak I was getting at when I filed flutter/flutter#130355. It's not causing known issues with real widgets, however, and so I'm going to set it to the side for now.

Before:

before.mp4

After:

after.mp4

@flutter-dashboard
Copy link

Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change).

If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review.

Changes reported for pull request #43943 at sha 183e3e4

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

We should consider cherry picking this into 3.13, if you feel confident in it.

@bdero bdero merged commit 33a24ff into flutter:main Jul 24, 2023
bdero added a commit that referenced this pull request Jul 24, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 24, 2023
auto-submit bot pushed a commit that referenced this pull request Jul 24, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 25, 2023
bdero added a commit that referenced this pull request Jul 25, 2023
Follow-up/reland of #43943.

Issue flutter/flutter#130355.

I've updated the golden to better reproduce the problem at hand; the
second circle is a scaled down copy of the backdrop. If the matrix
filter is handling the transform correctly, the circle is centered over
the bottom-right-most edge (4:30) of the circle:

![image](https://github.com/flutter/engine/assets/919017/3f2e099d-9d43-4ee6-8efe-3203edad47ad)
bdero added a commit to bdero/flutter-engine that referenced this pull request Jul 25, 2023
)

Follow-up/reland of flutter#43943.

Issue flutter/flutter#130355.

I've updated the golden to better reproduce the problem at hand; the
second circle is a scaled down copy of the backdrop. If the matrix
filter is handling the transform correctly, the circle is centered over
the bottom-right-most edge (4:30) of the circle:

![image](https://github.com/flutter/engine/assets/919017/3f2e099d-9d43-4ee6-8efe-3203edad47ad)

(cherry picked from commit 3e5ae6a)
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
vashworth pushed a commit to vashworth/flutter that referenced this pull request Aug 2, 2023
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request Aug 30, 2023
)

Follow-up/reland of flutter#43943.

Issue flutter/flutter#130355.

I've updated the golden to better reproduce the problem at hand; the
second circle is a scaled down copy of the backdrop. If the matrix
filter is handling the transform correctly, the circle is centered over
the bottom-right-most edge (4:30) of the circle:

![image](https://github.com/flutter/engine/assets/919017/3f2e099d-9d43-4ee6-8efe-3203edad47ad)
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request May 16, 2024
…lutter#43943)

Resolves flutter/flutter#130355.

When drawing a backdrop filter, we offset the backdrop entity with
`-local_pass_position` in order to align the backdrop texture with the
position of the pass it's being drawn to. When rendering the filter,
this transform propagates to the filter snapshot. Prior to this change,
that offset was being applied within the space of the backdrop filter's
matrix, which is wrong! It needs to be applied in screen space.

We didn't notice this prior to the coverage hint optimization because we
were previously forcing subpass sizes to match the parent whenever a
backdrop filter was present.

This one was very difficult to reason through at first, and so I added a
detailed comment to explain the rationale behind the behavioral
differences between the backdrop filter and non-backdrop filter cases of
the matrix filter.
gaaclarke pushed a commit to gaaclarke/engine that referenced this pull request May 16, 2024
…lutter#43943)

Resolves flutter/flutter#130355.

When drawing a backdrop filter, we offset the backdrop entity with
`-local_pass_position` in order to align the backdrop texture with the
position of the pass it's being drawn to. When rendering the filter,
this transform propagates to the filter snapshot. Prior to this change,
that offset was being applied within the space of the backdrop filter's
matrix, which is wrong! It needs to be applied in screen space.

We didn't notice this prior to the coverage hint optimization because we
were previously forcing subpass sizes to match the parent whenever a
backdrop filter was present.

This one was very difficult to reason through at first, and so I added a
detailed comment to explain the rationale behind the behavioral
differences between the backdrop filter and non-backdrop filter cases of
the matrix filter.
auto-submit bot pushed a commit that referenced this pull request May 18, 2024
auto-submit bot added a commit that referenced this pull request May 18, 2024
)

Reverts: #52880
Initiated by: jonahwilliams
Reason for reverting: unexpected framework golden change
Original PR Author: gaaclarke

Reviewed By: {bdero}

This change reverts the following previous change:
fixes: flutter/flutter#147807
relands #43943 (with fixes that hopefully avoid it being reverted again)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
gaaclarke added a commit to gaaclarke/engine that referenced this pull request May 20, 2024
auto-submit bot pushed a commit that referenced this pull request May 21, 2024
fixes flutter/flutter#147807
relands #52880
relands #43943

This was previously reverted because of the golden test failure `widgets.widgets.magnifier.styled`.  This fixes that problem by instead of focusing on ImageFilter and BackdropFilter subpasses, instead focuses on wether a subpass is clipped or not and by extension how the math should be handled.

`widgets.widgets.magnifier.styled` after diff:

![widgets widgets magnifier styled](https://github.com/flutter/engine/assets/30870216/d4611586-90f7-4d3e-90d8-018dd678d028)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

[Impeller] Android text magnifier not offsetting correctly with coverage hint optimization.

2 participants