Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
anonomousxxx committed Dec 21, 2023
2 parents 53a744b + 3bbc390 commit 84a1e4a
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import androidx.annotation.NonNull;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Registry;
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.load.resource.bitmap.BitmapDrawableDecoder;
import com.bumptech.glide.module.LibraryGlideModule;
import java.io.InputStream;
import java.nio.ByteBuffer;
Expand All @@ -21,10 +23,21 @@ public void registerComponents(
// the integration will be preferred for Avif images.
AvifByteBufferBitmapDecoder byteBufferBitmapDecoder =
new AvifByteBufferBitmapDecoder(glide.getBitmapPool());
registry.prepend(ByteBuffer.class, Bitmap.class, byteBufferBitmapDecoder);
registry.prepend(
Registry.BUCKET_BITMAP, ByteBuffer.class, Bitmap.class, byteBufferBitmapDecoder);
registry.prepend(
Registry.BUCKET_BITMAP_DRAWABLE,
ByteBuffer.class,
BitmapDrawable.class,
new BitmapDrawableDecoder<>(context.getResources(), byteBufferBitmapDecoder));
AvifStreamBitmapDecoder streamBitmapDecoder =
new AvifStreamBitmapDecoder(
registry.getImageHeaderParsers(), byteBufferBitmapDecoder, glide.getArrayPool());
registry.prepend(InputStream.class, Bitmap.class, streamBitmapDecoder);
registry.prepend(Registry.BUCKET_BITMAP, InputStream.class, Bitmap.class, streamBitmapDecoder);
registry.prepend(
Registry.BUCKET_BITMAP_DRAWABLE,
InputStream.class,
BitmapDrawable.class,
new BitmapDrawableDecoder<>(context.getResources(), streamBitmapDecoder));
}
}

0 comments on commit 84a1e4a

Please sign in to comment.