1 package com.bumptech.glide.load.resource.bitmap; 2 3 import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; 4 import com.bumptech.glide.load.resource.drawable.DrawableResource; 5 import com.bumptech.glide.util.Util; 6 7 /** 8 * A resource wrapper for {@link com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable}. 9 */ 10 public class GlideBitmapDrawableResource extends DrawableResource<GlideBitmapDrawable> { 11 private final BitmapPool bitmapPool; 12 13 public GlideBitmapDrawableResource(GlideBitmapDrawable drawable, BitmapPool bitmapPool) { 14 super(drawable); 15 this.bitmapPool = bitmapPool; 16 } 17 18 @Override 19 public int getSize() { 20 return Util.getBitmapByteSize(drawable.getBitmap()); 21 } 22 23 @Override 24 public void recycle() { 25 bitmapPool.put(drawable.getBitmap()); 26 } 27 } 28