Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
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;
/* loaded from: classes.dex */
public class BitmapBytesTranscoder implements ResourceTranscoder<Bitmap, byte[]> {
private final Bitmap.CompressFormat a;
private final int b;
public BitmapBytesTranscoder() {
this(Bitmap.CompressFormat.JPEG, 100);
}
@Override // com.bumptech.glide.load.resource.transcode.ResourceTranscoder
public Resource<byte[]> a(Resource<Bitmap> resource, Options options) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
resource.get().compress(this.a, this.b, byteArrayOutputStream);
resource.a();
return new BytesResource(byteArrayOutputStream.toByteArray());
}
public BitmapBytesTranscoder(Bitmap.CompressFormat compressFormat, int i) {
this.a = compressFormat;
this.b = i;
}
}

View File

@@ -0,0 +1,24 @@
package com.bumptech.glide.load.resource.transcode;
import android.content.res.Resources;
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.resource.bitmap.LazyBitmapDrawableResource;
import com.bumptech.glide.util.Preconditions;
/* loaded from: classes.dex */
public class BitmapDrawableTranscoder implements ResourceTranscoder<Bitmap, BitmapDrawable> {
private final Resources a;
public BitmapDrawableTranscoder(Resources resources) {
Preconditions.a(resources);
this.a = resources;
}
@Override // com.bumptech.glide.load.resource.transcode.ResourceTranscoder
public Resource<BitmapDrawable> a(Resource<Bitmap> resource, Options options) {
return LazyBitmapDrawableResource.a(this.a, resource);
}
}

View File

@@ -0,0 +1,42 @@
package com.bumptech.glide.load.resource.transcode;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
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.BitmapResource;
import com.bumptech.glide.load.resource.gif.GifDrawable;
/* loaded from: classes.dex */
public final class DrawableBytesTranscoder implements ResourceTranscoder<Drawable, byte[]> {
private final BitmapPool a;
private final ResourceTranscoder<Bitmap, byte[]> b;
private final ResourceTranscoder<GifDrawable, byte[]> c;
public DrawableBytesTranscoder(BitmapPool bitmapPool, ResourceTranscoder<Bitmap, byte[]> resourceTranscoder, ResourceTranscoder<GifDrawable, byte[]> resourceTranscoder2) {
this.a = bitmapPool;
this.b = resourceTranscoder;
this.c = resourceTranscoder2;
}
/* JADX WARN: Multi-variable type inference failed */
private static Resource<GifDrawable> a(Resource<Drawable> resource) {
return resource;
}
@Override // com.bumptech.glide.load.resource.transcode.ResourceTranscoder
public Resource<byte[]> a(Resource<Drawable> resource, Options options) {
Drawable drawable = resource.get();
if (drawable instanceof BitmapDrawable) {
return this.b.a(BitmapResource.a(((BitmapDrawable) drawable).getBitmap(), this.a), options);
}
if (!(drawable instanceof GifDrawable)) {
return null;
}
ResourceTranscoder<GifDrawable, byte[]> resourceTranscoder = this.c;
a(resource);
return resourceTranscoder.a(resource, options);
}
}

View File

@@ -0,0 +1,15 @@
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;
import com.bumptech.glide.util.ByteBufferUtil;
/* loaded from: classes.dex */
public class GifDrawableBytesTranscoder implements ResourceTranscoder<GifDrawable, byte[]> {
@Override // com.bumptech.glide.load.resource.transcode.ResourceTranscoder
public Resource<byte[]> a(Resource<GifDrawable> resource, Options options) {
return new BytesResource(ByteBufferUtil.b(resource.get().b()));
}
}

View File

@@ -0,0 +1,9 @@
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.engine.Resource;
/* loaded from: classes.dex */
public interface ResourceTranscoder<Z, R> {
Resource<R> a(Resource<Z> resource, Options options);
}

View File

@@ -0,0 +1,57 @@
package com.bumptech.glide.load.resource.transcode;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public class TranscoderRegistry {
private final List<Entry<?, ?>> a = new ArrayList();
private static final class Entry<Z, R> {
private final Class<Z> a;
private final Class<R> b;
final ResourceTranscoder<Z, R> c;
Entry(Class<Z> cls, Class<R> cls2, ResourceTranscoder<Z, R> resourceTranscoder) {
this.a = cls;
this.b = cls2;
this.c = resourceTranscoder;
}
public boolean a(Class<?> cls, Class<?> cls2) {
return this.a.isAssignableFrom(cls) && cls2.isAssignableFrom(this.b);
}
}
public synchronized <Z, R> void a(Class<Z> cls, Class<R> cls2, ResourceTranscoder<Z, R> resourceTranscoder) {
this.a.add(new Entry<>(cls, cls2, resourceTranscoder));
}
public synchronized <Z, R> List<Class<R>> b(Class<Z> cls, Class<R> cls2) {
ArrayList arrayList = new ArrayList();
if (cls2.isAssignableFrom(cls)) {
arrayList.add(cls2);
return arrayList;
}
Iterator<Entry<?, ?>> it = this.a.iterator();
while (it.hasNext()) {
if (it.next().a(cls, cls2)) {
arrayList.add(cls2);
}
}
return arrayList;
}
public synchronized <Z, R> ResourceTranscoder<Z, R> a(Class<Z> cls, Class<R> cls2) {
if (cls2.isAssignableFrom(cls)) {
return UnitTranscoder.a();
}
for (Entry<?, ?> entry : this.a) {
if (entry.a(cls, cls2)) {
return (ResourceTranscoder<Z, R>) entry.c;
}
}
throw new IllegalArgumentException("No transcoder registered to transcode from " + cls + " to " + cls2);
}
}

View File

@@ -0,0 +1,18 @@
package com.bumptech.glide.load.resource.transcode;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.engine.Resource;
/* loaded from: classes.dex */
public class UnitTranscoder<Z> implements ResourceTranscoder<Z, Z> {
private static final UnitTranscoder<?> a = new UnitTranscoder<>();
public static <Z> ResourceTranscoder<Z, Z> a() {
return a;
}
@Override // com.bumptech.glide.load.resource.transcode.ResourceTranscoder
public Resource<Z> a(Resource<Z> resource, Options options) {
return resource;
}
}