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

Bitmap transformations should set alpha on pooled bitmaps appropriately #156

Closed
sjudd opened this issue Sep 25, 2014 · 0 comments
Closed
Labels
Milestone

Comments

@sjudd
Copy link
Collaborator

sjudd commented Sep 25, 2014

Currently when we retrieve Bitmaps from the pool we always call setAlpha(true) to avoid drawing issues when those Bitmaps are re-used to display transparent images. We rely on BitmapFactory to override hasAlpha when decoding images.

However, if we use a Bitmap from the pool to transform an image that is not transparent, hasAlpha will be false before the transformation and true after the transformation. To avoid this, for transformations that don't introduce transparency, we should call setHasAlpha with the hasAlpha() value from the original Bitmap.

The consequence of claiming certain images have alpha when they don't is that they are unnecessarily written out to disk as PNGs rather than JPEGs which is 4-5x slower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant