Search code examples
androidfresco

Fresco lib supporting inBitmap in Android 4.4


"Android 3.0 (API level 11) introduces the BitmapFactory.Options.inBitmap field. If this option is set, decode methods that take the Options object will attempt to reuse an existing bitmap when loading content. This means that the bitmap's memory is reused, resulting in improved performance, and removing both memory allocation and de-allocation. However, there are certain restrictions with how inBitmap can be used. In particular, before Android 4.4 (API level 19), only equal sized bitmaps are supported."

I wonder Why don't fresco use inBitmap in Android 4.4, but Android 5.0? Is managing bitmap on ashmem with the options inPurgeable more efficient than reusing bitmap with option inBitmap on Davilk heap?

Thanks.


Solution

  • Yes, inPurgeable, with the special Android NDK calls Fresco makes, is more efficient than inBitmap. Fresco's blog post has the full story (see the section on "Purgeable bitmaps" and the one after it).

    Unfortunately Google retired inPurgeable in Android 5.0, so Fresco had to fall back to inBitmap.