Home | History | Annotate | Download | only in gif
      1 package com.bumptech.glide.load.resource.gif;
      2 
      3 
      4 import android.graphics.Bitmap;
      5 
      6 import com.bumptech.glide.gifdecoder.GifDecoder;
      7 import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
      8 
      9 class GifBitmapProvider implements GifDecoder.BitmapProvider {
     10     private final BitmapPool bitmapPool;
     11 
     12     public GifBitmapProvider(BitmapPool bitmapPool) {
     13         this.bitmapPool = bitmapPool;
     14     }
     15 
     16     @Override
     17     public Bitmap obtain(int width, int height, Bitmap.Config config) {
     18         return bitmapPool.getDirty(width, height, config);
     19     }
     20 
     21     @Override
     22     public void release(Bitmap bitmap) {
     23         if (!bitmapPool.put(bitmap)) {
     24             bitmap.recycle();
     25         }
     26     }
     27 }
     28