Skip to content
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

Glide forces a full screen redraw when using a placeholder #5464

Open
domutadarius opened this issue Nov 15, 2024 · 0 comments
Open

Glide forces a full screen redraw when using a placeholder #5464

domutadarius opened this issue Nov 15, 2024 · 0 comments

Comments

@domutadarius
Copy link

domutadarius commented Nov 15, 2024

Issue:
I am using the advanced developer option that flashes the view that is drawn with a red overlay. This option is different from the one that flashes the whole screen when a view updates, so no mistake was made.

My issue is that that the whole screen gets redrawn when the image updates, creating high green bars when using the "Profile HWUI" option. This only happens when a placeholder is used such that the images switch pretty fast. If I disable the placeholder and the image clearing and I apply a custom loader that only sets the image view drawable, then only the image view gets redrawn.

My context is that I am trying to improve the performance of a really old and slow Android device that is drastically affected by image loading. Profiling it with the HWUI tool showed huge improvements when the placeholder is disabled such that only the image is redrawn, as the green lines stay down.

Implementation notes:

  1. Using Glide's standard loader ".into(imageView)" always triggers a full screen redraw.
  2. Using a custom loader that only sets the image drawable like in the attached gist fixes this issue, but only under the condition that no placeholders and no image clearing is being used.

Glide Version: com.github.bumptech.glide:glide:4.16.0

Code Gist: https://gist.github.com/domutadarius/98021d5e44b9ef02dddd2e796e60bc5b

With Placeholder and target clearing:

Screen.Recording.2024-11-15.at.09.18.08.mov

With NO placeholder and NO target clearing + custom view loader:

Screen.Recording.2024-11-15.at.09.23.33.mov

Performance comparison (Watch the green bars):

Whole screen redraw:
whole-screen-redraw-proof

Single image redraw:
Single-image-redraw-proof

UPDATE:

I commented out the placeholders both in the glide load request and in the custom loader. To achieve the placeholder effect I did two loads: One with a transparent drawable and one with an actual image and I achieved limited image view redraw. So, it seems like there's an issue with the Glide placeholder:

Screen.Recording.2024-11-15.at.09.52.58.mov
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

No branches or pull requests

1 participant