public class SizeConfigStrategy
extends java.lang.Object
Bitmaps
using both
Bitmap.getAllocationByteCount()
and the
Bitmap.Config
returned from
Bitmap.getConfig()
.
Using both the config and the byte size allows us to safely re-use a greater variety of
Bitmaps
, which increases the hit rate of the pool and therefore
the performance of applications. This class works around #301 by only allowing re-use of
Bitmaps
with a matching number of bytes per pixel.
Constructor and Description |
---|
SizeConfigStrategy() |
Modifier and Type | Method and Description |
---|---|
android.graphics.Bitmap |
get(int width,
int height,
android.graphics.Bitmap.Config config) |
int |
getSize(android.graphics.Bitmap bitmap) |
java.lang.String |
logBitmap(android.graphics.Bitmap bitmap) |
java.lang.String |
logBitmap(int width,
int height,
android.graphics.Bitmap.Config config) |
void |
put(android.graphics.Bitmap bitmap) |
android.graphics.Bitmap |
removeLast() |
java.lang.String |
toString() |
public void put(android.graphics.Bitmap bitmap)
@Nullable public android.graphics.Bitmap get(int width, int height, android.graphics.Bitmap.Config config)
@Nullable public android.graphics.Bitmap removeLast()
public java.lang.String logBitmap(android.graphics.Bitmap bitmap)
public java.lang.String logBitmap(int width, int height, android.graphics.Bitmap.Config config)
public int getSize(android.graphics.Bitmap bitmap)
public java.lang.String toString()
toString
in class java.lang.Object