com.bumptech.glide.load.engine.bitmap_recycle
Class SizeConfigStrategy

java.lang.Object
  extended by com.bumptech.glide.load.engine.bitmap_recycle.SizeConfigStrategy

public class SizeConfigStrategy
extends Object

Keys 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 Summary
SizeConfigStrategy()
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SizeConfigStrategy

public SizeConfigStrategy()
Method Detail

put

public void put(Bitmap bitmap)

get

public Bitmap get(int width,
                  int height,
                  Bitmap.Config config)

removeLast

public Bitmap removeLast()

logBitmap

public String logBitmap(Bitmap bitmap)

logBitmap

public String logBitmap(int width,
                        int height,
                        Bitmap.Config config)

getSize

public int getSize(Bitmap bitmap)

toString

public String toString()
Overrides:
toString in class Object