-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ImageFilter jerky scrolling behavior on IOS #144213
Comments
If you use BackdropFilter instead of ImageFiltered during layout, the result is the same |
Thanks for the report @snoopdoggy322. I can reproduce this on the latest Without Clipping
With Clipping
This issue is also peculiar to Screen Record
Simulator.Screen.Recording.-.iPhone.15.-.2024-02-27.at.10.38.38.mp4Additional Note from Triage: Tested this on version stable, master flutter doctor -v
|
I can reproduce this. If the blur sigma is turned down to low value like 1, then the artifacting is mostly present around the border. Maybe be an alignment issue if the expanded padding for the blur isn't a whole number? RPReplay_Final1709782752.mp4 |
I think is is actually related to an issue with the sampling mode, if I change the blur to use decal sampling the jerkiness seems to go away ( of course it looks different though) |
This renders without flickering if I remove the (see https://github.com/flutter/engine/blob/main/impeller/entity/entity_pass.cc#L620) |
The underlying problem is that our default filter modes are clamp, which can make sense when you are 8000 applying a filter to a fixed image like a photo that has a distinct edge. In a purely theoretical view, the scrolled contents do have a physical opaque edge, but they are rendered on a non-pixel boundary thereby causing their edges to be fuzzy due to antialiasing. Skia has gone to great lengths to recognize the registration of the logical bounds of the content against the pixel grid so that they can apply the clamp sampling to an estimation of what the opaque edge should have looked like, but I do not think Impeller has that same capability. The removal of the RoundOut simply allows the contents to be rendered to a "RoundIn" size instead due to the following line which does an implicit unmentioned round operation in the ISize constructor (that happens to be "truncate"), and that artificially makes the edge solid again by clipping off the slightly un-solid edges pixels of the AA sampled content. The implicit RoundIn behavior that used to happen might hide these effects, but at the cost of accuracy. In particular, that suggestion may work for a photograph that has little high frequency detail near the edge, but if the content had, say, a single pixel border that was a strikingly contrasting color then that would flash as well due to its contribution growing and shrinking as it scrolls across un-snapped pixels and getting clipped to a RoundIn operation. We shouldn't break layer clipping as a temporary solution to a lack of treatment of non-integer edge modes in the blur filters. |
I'm not sure that assessment is accurate. Why does it matter if the coverage of an entity has a fractional value? AFAIK this code is determining the size of the texture to render into and not how it composites with the parent. |
It's the tile mode of "clamp". It says that for content near the edges where you need to sample beyond the edge, what should you return as the sample. For "decal" you sample transparency, but for "clamp" you sample the edge pixel out to infinity. If the edge pixel is constantly changing in opacity as you scroll due to sub-pixel rendering then the intensity of what you sample out to infinity will be constantly changing. |
After a discussion with the Skia folks, the application of clamp tile mode to content that has sub-pixel bounds is not something that they've ever been able to reliably accomplish and the latest implementation simply has a very targeted "round-in", but only when considering content to be supplied to the input of a blur filter with clamp mode. Even that solution has its issues if there is high-frequency pixel deltas near the edge of such an image. |
This issue is missing a priority label. Please set a priority label when adding the |
This isn't exactly the right fix, but it is a straight revert to fix flutter/flutter#144213
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to reproduce
Expected results
normall scrolling
Actual results
jerky scroll
Code sample
Code sample
Screenshots or Video
without clipping
2024-02-27.11.37.28.mov
with clipping
2024-02-27.11.38.06.mov
Logs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: