[android-developers] Tiny stutter when displaying a large bitmap for the first time
I'm creating an application with large bitmaps in a scrolling list.
-- I'm on a 1080p screen and the bitmaps are about 1080x1080 pixels each. All drawing is done directly to canvas in a custom View, and all of the bitmaps are loaded from resources into memory before doing any scrolling (well, at least in my test case). I noticed that each time a new bitmap enters the screen, a frame of drawing is dropped, leading to a small stutter. But when I scroll back to the bitmaps already shown before there is no frame drop, but smooth 60 fps.
This leads me to believe that the HW acceleration in Android uploads a texture to GPU the first time a Bitmap is shown on screen. And if the Bitmap is large enough, it eats a frame of time (when small bitmaps are scrolled in, there's no stuttering).
I'm trying to avoid this behavior by ensuring that all textures are loaded into GPU memory before scrolling starts. I'm thinking I could draw all bitmaps to canvas on the first onDraw() call, either with alpha 0 or scaled down to 0 x 0 or similar.
Am I right in mu assumption that its the texture uploading that takes time?
Should I be drawing the bitmap to Canvas to ensure that texture is uploaded or is there any other, better way?
Will the texture be uploaded if I draw the bitmap with alpha 0 or scaled down to 0 x 0?
Thanks
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home