jimu-decompiled/sources/com/bumptech/glide/load/engine/DecodeHelper.java
2025-05-13 19:24:51 +02:00

221 lines
6.0 KiB
Java

package com.bumptech.glide.load.engine;
import com.bumptech.glide.GlideContext;
import com.bumptech.glide.Priority;
import com.bumptech.glide.Registry;
import com.bumptech.glide.load.Encoder;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.load.Options;
import com.bumptech.glide.load.ResourceEncoder;
import com.bumptech.glide.load.Transformation;
import com.bumptech.glide.load.engine.DecodeJob;
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
import com.bumptech.glide.load.engine.cache.DiskCache;
import com.bumptech.glide.load.model.ModelLoader;
import com.bumptech.glide.load.resource.UnitTransformation;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
final class DecodeHelper<Transcode> {
private final List<ModelLoader.LoadData<?>> a = new ArrayList();
private final List<Key> b = new ArrayList();
private GlideContext c;
private Object d;
private int e;
private int f;
private Class<?> g;
private DecodeJob.DiskCacheProvider h;
private Options i;
private Map<Class<?>, Transformation<?>> j;
private Class<Transcode> k;
private boolean l;
private boolean m;
private Key n;
private Priority o;
private DiskCacheStrategy p;
private boolean q;
private boolean r;
DecodeHelper() {
}
/* JADX WARN: Multi-variable type inference failed */
<R> void a(GlideContext glideContext, Object obj, Key key, int i, int i2, DiskCacheStrategy diskCacheStrategy, Class<?> cls, Class<R> cls2, Priority priority, Options options, Map<Class<?>, Transformation<?>> map, boolean z, boolean z2, DecodeJob.DiskCacheProvider diskCacheProvider) {
this.c = glideContext;
this.d = obj;
this.n = key;
this.e = i;
this.f = i2;
this.p = diskCacheStrategy;
this.g = cls;
this.h = diskCacheProvider;
this.k = cls2;
this.o = priority;
this.i = options;
this.j = map;
this.q = z;
this.r = z2;
}
ArrayPool b() {
return this.c.a();
}
/* JADX WARN: Multi-variable type inference failed */
boolean c(Class<?> cls) {
return a((Class) cls) != null;
}
DiskCache d() {
return this.h.a();
}
DiskCacheStrategy e() {
return this.p;
}
int f() {
return this.f;
}
List<ModelLoader.LoadData<?>> g() {
if (!this.l) {
this.l = true;
this.a.clear();
List a = this.c.e().a((Registry) this.d);
int size = a.size();
for (int i = 0; i < size; i++) {
ModelLoader.LoadData<?> a2 = ((ModelLoader) a.get(i)).a(this.d, this.e, this.f, this.i);
if (a2 != null) {
this.a.add(a2);
}
}
}
return this.a;
}
Options h() {
return this.i;
}
Priority i() {
return this.o;
}
List<Class<?>> j() {
return this.c.e().b(this.d.getClass(), this.g, this.k);
}
Key k() {
return this.n;
}
Class<?> l() {
return this.k;
}
int m() {
return this.e;
}
boolean n() {
return this.r;
}
<Z> Transformation<Z> b(Class<Z> cls) {
Transformation<Z> transformation = (Transformation) this.j.get(cls);
if (transformation == null) {
Iterator<Map.Entry<Class<?>, Transformation<?>>> it = this.j.entrySet().iterator();
while (true) {
if (!it.hasNext()) {
break;
}
Map.Entry<Class<?>, Transformation<?>> next = it.next();
if (next.getKey().isAssignableFrom(cls)) {
transformation = (Transformation) next.getValue();
break;
}
}
}
if (transformation != null) {
return transformation;
}
if (!this.j.isEmpty() || !this.q) {
return UnitTransformation.a();
}
throw new IllegalArgumentException("Missing transformation for " + cls + ". If you wish to ignore unknown resource types, use the optional transformation methods.");
}
List<Key> c() {
if (!this.m) {
this.m = true;
this.b.clear();
List<ModelLoader.LoadData<?>> g = g();
int size = g.size();
for (int i = 0; i < size; i++) {
ModelLoader.LoadData<?> loadData = g.get(i);
if (!this.b.contains(loadData.a)) {
this.b.add(loadData.a);
}
for (int i2 = 0; i2 < loadData.b.size(); i2++) {
if (!this.b.contains(loadData.b.get(i2))) {
this.b.add(loadData.b.get(i2));
}
}
}
}
return this.b;
}
boolean b(Resource<?> resource) {
return this.c.e().b(resource);
}
void a() {
this.c = null;
this.d = null;
this.n = null;
this.g = null;
this.k = null;
this.i = null;
this.o = null;
this.j = null;
this.p = null;
this.a.clear();
this.l = false;
this.b.clear();
this.m = false;
}
<Data> LoadPath<Data, ?, Transcode> a(Class<Data> cls) {
return this.c.e().a(cls, this.g, this.k);
}
<Z> ResourceEncoder<Z> a(Resource<Z> resource) {
return this.c.e().a((Resource) resource);
}
List<ModelLoader<File, ?>> a(File file) throws Registry.NoModelLoaderAvailableException {
return this.c.e().a((Registry) file);
}
boolean a(Key key) {
List<ModelLoader.LoadData<?>> g = g();
int size = g.size();
for (int i = 0; i < size; i++) {
if (g.get(i).a.equals(key)) {
return true;
}
}
return false;
}
<X> Encoder<X> a(X x) throws Registry.NoSourceEncoderAvailableException {
return this.c.e().c(x);
}
}