FileDocCategorySizeDatePackage
ReusableBitmap.javaAPI DocAndroid 5.1 API3853Thu Mar 12 22:22:50 GMT 2015com.android.bitmap

ReusableBitmap

public class ReusableBitmap extends Object implements Poolable
A simple bitmap wrapper. Currently supports reference counting and logical width/height (which may differ from a bitmap's reported width/height due to bitmap reuse).

Fields Summary
public final android.graphics.Bitmap
bmp
private int
mWidth
private int
mHeight
private int
mOrientation
private int
mRefCount
private final boolean
mReusable
Constructors Summary
public ReusableBitmap(android.graphics.Bitmap bitmap)


        
        this(bitmap, true /* reusable */);
    
public ReusableBitmap(android.graphics.Bitmap bitmap, boolean reusable)

        bmp = bitmap;
        mReusable = reusable;
    
Methods Summary
public voidacquireReference()

        mRefCount++;
    
public intgetByteCount()

        return bmp.getByteCount();
    
public intgetLogicalHeight()

        return mHeight;
    
public intgetLogicalWidth()

        return mWidth;
    
public intgetOrientation()

        return mOrientation;
    
public intgetRefCount()

        return mRefCount;
    
public booleanisEligibleForPooling()

        return mReusable;
    
public voidreleaseReference()

        if (mRefCount == 0) {
            throw new IllegalStateException();
        }
        mRefCount--;
    
public voidsetLogicalHeight(int h)

        mHeight = h;
    
public voidsetLogicalWidth(int w)

        mWidth = w;
    
public voidsetOrientation(int orientation)

        mOrientation = orientation;
    
public java.lang.StringtoString()

        final StringBuilder sb = new StringBuilder("[");
        sb.append(super.toString());
        sb.append(" refCount=");
        sb.append(mRefCount);
        sb.append(" mReusable=");
        sb.append(mReusable);
        sb.append(" bmp=");
        sb.append(bmp);
        sb.append(" logicalW/H=");
        sb.append(mWidth);
        sb.append("/");
        sb.append(mHeight);
        if (bmp != null) {
            sb.append(" sz=");
            sb.append(bmp.getByteCount() >> 10);
            sb.append("KB");
        }
        sb.append("]");
        return sb.toString();