Fix blur gets lost when display list for target view is not available#263
Open
Rosemoe wants to merge 1 commit into
Open
Fix blur gets lost when display list for target view is not available#263Rosemoe wants to merge 1 commit into
Rosemoe wants to merge 1 commit into
Conversation
Owner
|
Thank for the contribution. |
Author
Sure, here is the dialog sample with |
Owner
|
@Rosemoe I think you forgot to commit the dialog's XML layout |
Author
Sorry, I uploaded the file now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Description
When using
RenderNodefor blur, the blurred content can get lost if theRenderNodeof 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
BlurViewas myDialogbackground 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
masterBranchFix 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.

Alternative Fix
Another possible fix is calling
postInvalidate()on bothblurViewandtargetViewwhen 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.