1ea01ddd754126290fc18c3dc8f6095ce0216768aSam Juddpackage com.bumptech.glide.load.resource.gif;
2ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd
3ea01ddd754126290fc18c3dc8f6095ce0216768aSam Juddimport android.graphics.Bitmap;
4b7c7c2b2505f996dbda219faeb0d08dc1c9982d7Sam Juddimport com.bumptech.glide.load.engine.Resource;
50f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Juddimport com.bumptech.glide.gifdecoder.GifDecoder;
6ea01ddd754126290fc18c3dc8f6095ce0216768aSam Juddimport com.bumptech.glide.load.ResourceDecoder;
70f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Juddimport com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
80f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Juddimport com.bumptech.glide.load.resource.bitmap.BitmapResource;
9ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd
10ea01ddd754126290fc18c3dc8f6095ce0216768aSam Juddimport java.io.IOException;
11ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd
12ea01ddd754126290fc18c3dc8f6095ce0216768aSam Juddclass GifFrameResourceDecoder implements ResourceDecoder<GifDecoder, Bitmap> {
130f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd    private BitmapPool bitmapPool;
140f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd
150f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd    public GifFrameResourceDecoder(BitmapPool bitmapPool) {
160f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd        this.bitmapPool = bitmapPool;
170f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd    }
18ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd
19ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd    @Override
20ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd    public Resource<Bitmap> decode(GifDecoder source, int width, int height) throws IOException {
210f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd        Bitmap bitmap = source.getNextFrame();
220f49c87b2f26f3e086f021461b7e5409a7d42be0Sam Judd        return new BitmapResource(bitmap ,bitmapPool);
23ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd    }
24ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd
25ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd    @Override
26ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd    public String getId() {
27ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd        return "GifFrameResourceDecoder.com.bumptech.glide.load.resource.gif";
28ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd    }
29ea01ddd754126290fc18c3dc8f6095ce0216768aSam Judd}
30