You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: