java.lang.Object | |
↳ | com.facebook.imagepipeline.platform.KitKatPurgeableDecoder |
Bitmap Decoder implementation for KitKat
The MemoryFile trick used in GingerbreadPurgeableDecoder does not work in KitKat. Here, we instead use Java memory to store the encoded images, but make use of a pool to minimize allocations. We cannot decode from a stream, as that does not support purgeable decodes.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected static final byte[] | EOI |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
KitKatPurgeableDecoder(FlexByteArrayPool flexByteArrayPool) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CloseableReference<Bitmap> |
decodeFromEncodedImage(EncodedImage encodedImage, Bitmap.Config bitmapConfig, Rect regionToDecode)
Creates a bitmap from encoded bytes.
| ||||||||||
CloseableReference<Bitmap> |
decodeJPEGFromEncodedImage(EncodedImage encodedImage, Bitmap.Config bitmapConfig, Rect regionToDecode, int length)
Creates a bitmap from encoded JPEG bytes.
| ||||||||||
CloseableReference<Bitmap> |
pinBitmap(Bitmap bitmap)
Pins the bitmap
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Bitmap |
decodeByteArrayAsPurgeable(CloseableReference<PooledByteBuffer> bytesRef, BitmapFactory.Options options)
Decodes a byteArray into a purgeable bitmap
| ||||||||||
Bitmap |
decodeJPEGByteArrayAsPurgeable(CloseableReference<PooledByteBuffer> bytesRef, int length, BitmapFactory.Options options)
Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap
Adds a JFIF End-Of-Image marker if needed before decoding. | ||||||||||
static boolean | endsWithEOI(CloseableReference<PooledByteBuffer> bytesRef, int length) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Creates a bitmap from encoded bytes.
encodedImage | the encoded image with reference to the encoded bytes |
---|---|
bitmapConfig | the android.graphics.Bitmap.Config used to create the decoded Bitmap |
regionToDecode | optional image region to decode. currently not supported. |
if the pool is full | |
OutOfMemoryError | if the Bitmap cannot be allocated |
Creates a bitmap from encoded JPEG bytes. Supports a partial JPEG image.
encodedImage | the encoded image with reference to the encoded bytes |
---|---|
bitmapConfig | the android.graphics.Bitmap.Config used to create the decoded Bitmap |
regionToDecode | optional image region to decode. currently not supported. |
length | the number of encoded bytes in the buffer |
if the pool is full | |
OutOfMemoryError | if the Bitmap cannot be allocated |
Decodes a byteArray into a purgeable bitmap
bytesRef | the byte buffer that contains the encoded bytes |
---|---|
options | the options passed to the BitmapFactory |
Decodes a byteArray containing jpeg encoded bytes into a purgeable bitmap
Adds a JFIF End-Of-Image marker if needed before decoding.
bytesRef | the byte buffer that contains the encoded bytes |
---|---|
length | the number of encoded bytes in the buffer |
options | the options passed to the BitmapFactory |