Skip to content

Fix blur gets lost when display list for target view is not available#263

Open
Rosemoe wants to merge 1 commit into
Dimezis:masterfrom
Rosemoe:fix/no-display-list-fallback
Open

Fix blur gets lost when display list for target view is not available#263
Rosemoe wants to merge 1 commit into
Dimezis:masterfrom
Rosemoe:fix/no-display-list-fallback

Conversation

@Rosemoe
Copy link
Copy Markdown

@Rosemoe Rosemoe commented Jun 6, 2026

Bug Description

When using RenderNode for blur, the blurred content can get lost if the RenderNode of target view has no valid display list. This typically happens when the display list is recycled by the framework.

Here is a sample case of the bug:
When using BlurView as my Dialog background view, after switching the app background and foreground, the blurred background is lost and becomes white.

WhiteBgAfterTaskSwitching_Compressed.mp4

Test Device: Redmi K50 (Android 14)
Library Version: Latest master Branch

Fix Description

This PR fixes the issue by fallback to software path when display list is unavailable.

Limitations

There can be slight difference between hardware and software blurred content, as the images shown below. The first is hardware path while the second is fallback software path.
Hardware Blur Software Blur

Alternative Fix

Another possible fix is calling postInvalidate() on both blurView and targetView when the display list is unavailable. In this case, we can get valid display list next time the view draws and continue with hardware path. On my test device, I didn't get visual latency (not seeing white background).
However, this violates the library principle to not invalidate the target view.

@Dimezis
Copy link
Copy Markdown
Owner

Dimezis commented Jun 6, 2026

Thank for the contribution.
Can you also please share a branch with the dialog example?
I'm tempted to try the postInvalidate fix since I don't want the BlurView to get stuck in the software path in this scenario

@Rosemoe
Copy link
Copy Markdown
Author

Rosemoe commented Jun 6, 2026

Can you also please share a branch with the dialog example?

Sure, here is the dialog sample with postInvalidate fix: https://github.com/Rosemoe/BlurView/tree/repro/dialog-bg

@Dimezis
Copy link
Copy Markdown
Owner

Dimezis commented Jun 6, 2026

@Rosemoe I think you forgot to commit the dialog's XML layout

@Rosemoe
Copy link
Copy Markdown
Author

Rosemoe commented Jun 6, 2026

@Rosemoe I think you forgot to commit the dialog's XML layout

Sorry, I uploaded the file now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants