public class SizeConfigStrategy extends 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 |
---|---|
Bitmap |
get(int width,
int height,
Bitmap.Config config) |
int |
getSize(Bitmap bitmap) |
String |
logBitmap(Bitmap bitmap) |
String |
logBitmap(int width,
int height,
Bitmap.Config config) |
void |
put(Bitmap bitmap) |
Bitmap |
removeLast() |
String |
toString() |
public void put(Bitmap bitmap)
@Nullable public Bitmap get(int width, int height, Bitmap.Config config)
public String logBitmap(int width, int height, Bitmap.Config config)
public int getSize(Bitmap bitmap)