Search in sources :

Example 11 with Options

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

the class DecodeJob method runLoadPath.

private <Data, ResourceType> Resource<R> runLoadPath(Data data, DataSource dataSource, LoadPath<Data, ResourceType, R> path) throws GlideException {
    Options options = getOptionsWithHardwareConfig(dataSource);
    DataRewinder<Data> rewinder = glideContext.getRegistry().getRewinder(data);
    try {
        // ResourceType in DecodeCallback below is required for compilation to work with gradle.
        return path.load(rewinder, options, width, height, new DecodeCallback<ResourceType>(dataSource));
    } finally {
        rewinder.cleanup();
    }
}
Also used : Options(com.bumptech.glide.load.Options)

Example 12 with Options

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

the class VideoDecoderTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    when(factory.build()).thenReturn(retriever);
    decoder = new VideoDecoder<>(bitmapPool, initializer, factory);
    options = new Options();
    initialSdkVersion = Build.VERSION.SDK_INT;
}
Also used : Options(com.bumptech.glide.load.Options) Before(org.junit.Before)

Example 13 with Options

use of com.bumptech.glide.load.Options 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<>();
    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 14 with Options

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

the class GifFrameResourceDecoderTest method setUp.

@Before
public void setUp() {
    gifDecoder = mock(GifDecoder.class);
    resourceDecoder = new GifFrameResourceDecoder(mock(BitmapPool.class));
    options = new Options();
}
Also used : GifDecoder(com.bumptech.glide.gifdecoder.GifDecoder) Options(com.bumptech.glide.load.Options) Before(org.junit.Before)

Example 15 with Options

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

the class BitmapDrawableTranscoderTest method testReturnsBitmapDrawableResourceContainingGivenBitmap.

@Test
public void testReturnsBitmapDrawableResourceContainingGivenBitmap() {
    Bitmap expected = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
    Resource<Bitmap> resource = mockResource();
    when(resource.get()).thenReturn(expected);
    Resource<BitmapDrawable> transcoded = transcoder.transcode(resource, new Options());
    assertEquals(expected, transcoded.get().getBitmap());
}
Also used : Options(com.bumptech.glide.load.Options) Bitmap(android.graphics.Bitmap) BitmapDrawable(android.graphics.drawable.BitmapDrawable) Test(org.junit.Test)

Aggregations

Options (com.bumptech.glide.load.Options)33 Before (org.junit.Before)14 Test (org.junit.Test)10 Bitmap (android.graphics.Bitmap)4 Uri (android.net.Uri)3 NonNull (android.support.annotation.NonNull)3 ImageHeaderParser (com.bumptech.glide.load.ImageHeaderParser)3 ObjectKey (com.bumptech.glide.signature.ObjectKey)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 CheckResult (android.support.annotation.CheckResult)2 CacheKeyUpdater (com.bumptech.glide.load.Option.CacheKeyUpdater)2 LruArrayPool (com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool)2 DefaultImageHeaderParser (com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser)2 ByteBuffer (java.nio.ByteBuffer)2 MessageDigest (java.security.MessageDigest)2 Application (android.app.Application)1 AssetManager (android.content.res.AssetManager)1 BitmapFactory (android.graphics.BitmapFactory)1