@Override public Resource<GifBitmapWrapper> transform(Resource<GifBitmapWrapper> resource, int outWidth, int outHeight) { Resource<Bitmap> bitmapResource = resource.get().getBitmapResource(); if (bitmapResource != null) { Resource<Bitmap> transformed = wrapped.transform(bitmapResource, outWidth, outHeight); if (transformed != bitmapResource) { GifBitmapWrapper gifBitmap = new GifBitmapWrapper(transformed, null); return new GifBitmapWrapperResource(gifBitmap); } } else { //TODO: this should be pushed down into a GifData transformation? Resource<GifData> gifResource = resource.get().getGifResource(); GifData gifData = gifResource.get(); Transformation<Bitmap> newTransformation = new MultiTransformation<Bitmap>(gifData.getFrameTransformation(), wrapped); gifData.setFrameTransformation(newTransformation); return new GifBitmapWrapperResource(new GifBitmapWrapper(null, new GifDataResource(gifData))); } return resource; }