| package com.bumptech.glide.load.resource.bitmap; |
| |
| import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; |
| import com.bumptech.glide.load.resource.drawable.DrawableResource; |
| import com.bumptech.glide.util.Util; |
| |
| /** |
| * A resource wrapper for {@link com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable}. |
| */ |
| public class GlideBitmapDrawableResource extends DrawableResource<GlideBitmapDrawable> { |
| private final BitmapPool bitmapPool; |
| |
| public GlideBitmapDrawableResource(GlideBitmapDrawable drawable, BitmapPool bitmapPool) { |
| super(drawable); |
| this.bitmapPool = bitmapPool; |
| } |
| |
| @Override |
| public int getSize() { |
| return Util.getBitmapByteSize(drawable.getBitmap()); |
| } |
| |
| @Override |
| public void recycle() { |
| bitmapPool.put(drawable.getBitmap()); |
| } |
| } |