Search in sources :

Example 1 with ImageHeaderParser

use of com.bumptech.glide.load.ImageHeaderParser in project glide by bumptech.

the class ByteBufferGifDecoderTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    gifHeader = Mockito.spy(new GifHeader());
    when(parser.parseHeader()).thenReturn(gifHeader);
    when(parserPool.obtain(isA(ByteBuffer.class))).thenReturn(parser);
    when(decoderFactory.build(isA(GifDecoder.BitmapProvider.class), eq(gifHeader), isA(ByteBuffer.class), anyInt())).thenReturn(gifDecoder);
    List<ImageHeaderParser> parsers = new ArrayList<ImageHeaderParser>();
    parsers.add(new DefaultImageHeaderParser());
    options = new Options();
    decoder = new ByteBufferGifDecoder(RuntimeEnvironment.application, parsers, bitmapPool, new LruArrayPool(ARRAY_POOL_SIZE_BYTES), parserPool, decoderFactory);
}
Also used : Options(com.bumptech.glide.load.Options) LruArrayPool(com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool) DefaultImageHeaderParser(com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser) ArrayList(java.util.ArrayList) GifHeader(com.bumptech.glide.gifdecoder.GifHeader) ByteBuffer(java.nio.ByteBuffer) DefaultImageHeaderParser(com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser) ImageHeaderParser(com.bumptech.glide.load.ImageHeaderParser) Before(org.junit.Before)

Example 2 with ImageHeaderParser

use of com.bumptech.glide.load.ImageHeaderParser in project glide by bumptech.

the class DownsamplerTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    options = new Options();
    DisplayMetrics displayMetrics = RuntimeEnvironment.application.getResources().getDisplayMetrics();
    when(byteArrayPool.get(anyInt(), Matchers.eq(byte[].class))).thenReturn(new byte[ArrayPool.STANDARD_BUFFER_SIZE_BYTES]);
    List<ImageHeaderParser> parsers = new ArrayList<ImageHeaderParser>();
    parsers.add(new DefaultImageHeaderParser());
    downsampler = new Downsampler(parsers, displayMetrics, bitmapPool, byteArrayPool);
    initialSdkVersion = Build.VERSION.SDK_INT;
}
Also used : Options(com.bumptech.glide.load.Options) ArrayList(java.util.ArrayList) DisplayMetrics(android.util.DisplayMetrics) ImageHeaderParser(com.bumptech.glide.load.ImageHeaderParser) Before(org.junit.Before)

Example 3 with ImageHeaderParser

use of com.bumptech.glide.load.ImageHeaderParser in project glide by bumptech.

the class StreamGifDecoderTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    List<ImageHeaderParser> parsers = new ArrayList<ImageHeaderParser>();
    parsers.add(new DefaultImageHeaderParser());
    decoder = new StreamGifDecoder(parsers, byteBufferDecoder, new LruArrayPool());
    options = new Options();
}
Also used : LruArrayPool(com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool) Options(com.bumptech.glide.load.Options) DefaultImageHeaderParser(com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser) ArrayList(java.util.ArrayList) DefaultImageHeaderParser(com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser) ImageHeaderParser(com.bumptech.glide.load.ImageHeaderParser) Before(org.junit.Before)

Aggregations

ImageHeaderParser (com.bumptech.glide.load.ImageHeaderParser)3 Options (com.bumptech.glide.load.Options)3 ArrayList (java.util.ArrayList)3 Before (org.junit.Before)3 LruArrayPool (com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool)2 DefaultImageHeaderParser (com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser)2 DisplayMetrics (android.util.DisplayMetrics)1 GifHeader (com.bumptech.glide.gifdecoder.GifHeader)1 ByteBuffer (java.nio.ByteBuffer)1