Home | History | Annotate | Download | only in gif
      1 package com.bumptech.glide.load.resource.gif;
      2 
      3 import android.graphics.Bitmap;
      4 
      5 import com.bumptech.glide.gifdecoder.GifDecoder;
      6 import com.bumptech.glide.load.ResourceDecoder;
      7 import com.bumptech.glide.load.engine.Resource;
      8 import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
      9 import com.bumptech.glide.load.resource.bitmap.BitmapResource;
     10 
     11 class GifFrameResourceDecoder implements ResourceDecoder<GifDecoder, Bitmap> {
     12     private final BitmapPool bitmapPool;
     13 
     14     public GifFrameResourceDecoder(BitmapPool bitmapPool) {
     15         this.bitmapPool = bitmapPool;
     16     }
     17 
     18     @Override
     19     public Resource<Bitmap> decode(GifDecoder source, int width, int height) {
     20         Bitmap bitmap = source.getNextFrame();
     21         return BitmapResource.obtain(bitmap, bitmapPool);
     22     }
     23 
     24     @Override
     25     public String getId() {
     26         return "GifFrameResourceDecoder.com.bumptech.glide.load.resource.gif";
     27     }
     28 }
     29