diff --git a/library/src/main/java/com/bumptech/glide/load/engine/DecodePath.java b/library/src/main/java/com/bumptech/glide/load/engine/DecodePath.java index 921b998fe2..e74320bf0b 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/DecodePath.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/DecodePath.java @@ -42,7 +42,7 @@ public Resource decode(DataRewinder rewinder, int width, in Options options, DecodeCallback callback) throws GlideException { Resource decoded = decodeResource(rewinder, width, height, options); Resource transformed = callback.onResourceDecoded(decoded); - return transcoder.transcode(transformed); + return transcoder.transcode(transformed, options); } private Resource decodeResource(DataRewinder rewinder, int width, diff --git a/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoder.java b/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoder.java index 5e8419a7cb..2b09adb40c 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoder.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoder.java @@ -1,6 +1,7 @@ package com.bumptech.glide.load.resource.transcode; import android.graphics.Bitmap; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.resource.bytes.BytesResource; import java.io.ByteArrayOutputStream; @@ -25,7 +26,7 @@ public BitmapBytesTranscoder(Bitmap.CompressFormat compressFormat, int quality) } @Override - public Resource transcode(Resource toTranscode) { + public Resource transcode(Resource toTranscode, Options options) { ByteArrayOutputStream os = new ByteArrayOutputStream(); toTranscode.get().compress(compressFormat, quality, os); toTranscode.recycle(); diff --git a/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoder.java b/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoder.java index 9fbbd4c053..03642bbe4b 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoder.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoder.java @@ -5,6 +5,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import com.bumptech.glide.Glide; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import com.bumptech.glide.load.resource.bitmap.LazyBitmapDrawableResource; @@ -28,7 +29,7 @@ public BitmapDrawableTranscoder(Resources resources, BitmapPool bitmapPool) { } @Override - public Resource transcode(Resource toTranscode) { + public Resource transcode(Resource toTranscode, Options options) { return LazyBitmapDrawableResource.obtain(resources, bitmapPool, toTranscode.get()); } } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoder.java b/library/src/main/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoder.java index 94ff7864df..0bc3c12b31 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoder.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoder.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load.resource.transcode; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.resource.bytes.BytesResource; import com.bumptech.glide.load.resource.gif.GifDrawable; @@ -13,7 +14,7 @@ */ public class GifDrawableBytesTranscoder implements ResourceTranscoder { @Override - public Resource transcode(Resource toTranscode) { + public Resource transcode(Resource toTranscode, Options options) { GifDrawable gifData = toTranscode.get(); ByteBuffer byteBuffer = gifData.getBuffer(); return new BytesResource(ByteBufferUtil.toBytes(byteBuffer)); diff --git a/library/src/main/java/com/bumptech/glide/load/resource/transcode/ResourceTranscoder.java b/library/src/main/java/com/bumptech/glide/load/resource/transcode/ResourceTranscoder.java index ad1c55c6e6..e84bd6b000 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/transcode/ResourceTranscoder.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/transcode/ResourceTranscoder.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load.resource.transcode; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; /** @@ -15,5 +16,5 @@ public interface ResourceTranscoder { * * @param toTranscode The resource to transcode. */ - Resource transcode(Resource toTranscode); + Resource transcode(Resource toTranscode, Options options); } diff --git a/library/src/main/java/com/bumptech/glide/load/resource/transcode/UnitTranscoder.java b/library/src/main/java/com/bumptech/glide/load/resource/transcode/UnitTranscoder.java index 966e11ecfc..0fd6d0964d 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/transcode/UnitTranscoder.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/transcode/UnitTranscoder.java @@ -1,5 +1,6 @@ package com.bumptech.glide.load.resource.transcode; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; /** @@ -16,7 +17,7 @@ public static ResourceTranscoder get() { } @Override - public Resource transcode(Resource toTranscode) { + public Resource transcode(Resource toTranscode, Options options) { return toTranscode; } } diff --git a/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoderTest.java b/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoderTest.java index 9d8e2b1b14..b4379c7503 100644 --- a/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoderTest.java +++ b/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapBytesTranscoderTest.java @@ -6,6 +6,7 @@ import static org.mockito.Mockito.when; import android.graphics.Bitmap; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import org.junit.Before; import org.junit.Test; @@ -59,6 +60,7 @@ private static class BitmapBytesTranscoderHarness { final String description = "TestDescription"; Bitmap bitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ALPHA_8); Resource bitmapResource = mockResource(); + Options options = new Options(); public BitmapBytesTranscoderHarness() { when(bitmapResource.get()).thenReturn(bitmap); @@ -67,7 +69,7 @@ public BitmapBytesTranscoderHarness() { public String getTranscodedDescription() { BitmapBytesTranscoder transcoder = new BitmapBytesTranscoder(compressFormat, quality); - Resource bytesResource = transcoder.transcode(bitmapResource); + Resource bytesResource = transcoder.transcode(bitmapResource, options); return new String(bytesResource.get()); } diff --git a/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoderTest.java b/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoderTest.java index 62689518a7..0707a342aa 100644 --- a/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoderTest.java +++ b/library/src/test/java/com/bumptech/glide/load/resource/transcode/BitmapDrawableTranscoderTest.java @@ -7,6 +7,7 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool; import org.junit.Before; @@ -33,7 +34,7 @@ public void testReturnsBitmapDrawableResourceContainingGivenBitmap() { Resource resource = mockResource(); when(resource.get()).thenReturn(expected); - Resource transcoded = transcoder.transcode(resource); + Resource transcoded = transcoder.transcode(resource, new Options()); assertEquals(expected, transcoded.get().getBitmap()); } diff --git a/library/src/test/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoderTest.java b/library/src/test/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoderTest.java index 1f6d4fd8f0..d1cd38b01b 100644 --- a/library/src/test/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoderTest.java +++ b/library/src/test/java/com/bumptech/glide/load/resource/transcode/GifDrawableBytesTranscoderTest.java @@ -5,6 +5,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.resource.gif.GifDrawable; import java.nio.ByteBuffer; @@ -33,7 +34,7 @@ public void testReturnsBytesOfGivenGifDrawable() { ByteBuffer expected = ByteBuffer.wrap(fakeData.getBytes()); when(gifDrawable.getBuffer()).thenReturn(expected); - Resource transcoded = transcoder.transcode(resource); + Resource transcoded = transcoder.transcode(resource, new Options()); assertArrayEquals(expected.array(), transcoded.get()); } diff --git a/library/src/test/java/com/bumptech/glide/load/resource/transcode/UnitTranscoderTest.java b/library/src/test/java/com/bumptech/glide/load/resource/transcode/UnitTranscoderTest.java index a1d8eb5078..0c8713cf26 100644 --- a/library/src/test/java/com/bumptech/glide/load/resource/transcode/UnitTranscoderTest.java +++ b/library/src/test/java/com/bumptech/glide/load/resource/transcode/UnitTranscoderTest.java @@ -3,6 +3,7 @@ import static com.bumptech.glide.tests.Util.mockResource; import static org.junit.Assert.assertEquals; +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,6 +17,6 @@ public void testReturnsTheGivenResource() { Resource resource = mockResource(); ResourceTranscoder unitTranscoder = UnitTranscoder.get(); - assertEquals(resource, unitTranscoder.transcode(resource)); + assertEquals(resource, unitTranscoder.transcode(resource, new Options())); } } diff --git a/samples/svg/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.java b/samples/svg/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.java index 43352acd8d..4f600fdc18 100644 --- a/samples/svg/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.java +++ b/samples/svg/src/main/java/com/bumptech/glide/samples/svg/SvgDrawableTranscoder.java @@ -2,7 +2,7 @@ import android.graphics.Picture; import android.graphics.drawable.PictureDrawable; - +import com.bumptech.glide.load.Options; import com.bumptech.glide.load.engine.Resource; import com.bumptech.glide.load.resource.SimpleResource; import com.bumptech.glide.load.resource.transcode.ResourceTranscoder; @@ -14,7 +14,7 @@ */ public class SvgDrawableTranscoder implements ResourceTranscoder { @Override - public Resource transcode(Resource toTranscode) { + public Resource transcode(Resource toTranscode, Options options) { SVG svg = toTranscode.get(); Picture picture = svg.renderToPicture(); PictureDrawable drawable = new PictureDrawable(picture);