279 lines
8.6 KiB
Java
279 lines
8.6 KiB
Java
package o;
|
|
|
|
import android.graphics.Bitmap;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.NavigableMap;
|
|
import java.util.TreeMap;
|
|
|
|
/* renamed from: o.QmD, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public final class C0874QmD implements uYg {
|
|
private static final Bitmap.Config[] a;
|
|
private static final Bitmap.Config[] b;
|
|
private static final Bitmap.Config[] c;
|
|
private static final Bitmap.Config[] d;
|
|
private static final Bitmap.Config[] e;
|
|
private final RVV f = new RVV();
|
|
private final C17583xwV<HBt, Bitmap> g = new C17583xwV<>();
|
|
private final Map<Bitmap.Config, NavigableMap<Integer, Integer>> h = new HashMap();
|
|
|
|
static {
|
|
Bitmap.Config[] configArr = (Bitmap.Config[]) Arrays.copyOf(new Bitmap.Config[]{Bitmap.Config.ARGB_8888, null}, 3);
|
|
configArr[configArr.length - 1] = Bitmap.Config.RGBA_F16;
|
|
c = configArr;
|
|
b = configArr;
|
|
a = new Bitmap.Config[]{Bitmap.Config.RGB_565};
|
|
e = new Bitmap.Config[]{Bitmap.Config.ARGB_4444};
|
|
d = new Bitmap.Config[]{Bitmap.Config.ALPHA_8};
|
|
}
|
|
|
|
@Override // o.uYg
|
|
public final void Eq_(Bitmap bitmap) {
|
|
int FX_ = FKd.FX_(bitmap);
|
|
RVV rvv = this.f;
|
|
Bitmap.Config config = bitmap.getConfig();
|
|
Object obj = (ETY) rvv.d.poll();
|
|
if (obj == null) {
|
|
obj = rvv.d();
|
|
}
|
|
HBt hBt = (HBt) obj;
|
|
hBt.d = FX_;
|
|
hBt.c = config;
|
|
this.g.a(hBt, bitmap);
|
|
NavigableMap<Integer, Integer> El_ = El_(bitmap.getConfig());
|
|
Integer num = (Integer) El_.get(Integer.valueOf(hBt.d));
|
|
El_.put(Integer.valueOf(hBt.d), Integer.valueOf(num != null ? 1 + num.intValue() : 1));
|
|
}
|
|
|
|
@Override // o.uYg
|
|
public final Bitmap Em_(int i, int i2, Bitmap.Config config) {
|
|
Bitmap.Config[] configArr;
|
|
int FW_ = FKd.FW_(i, i2, config);
|
|
RVV rvv = this.f;
|
|
Object obj = (ETY) rvv.d.poll();
|
|
if (obj == null) {
|
|
obj = rvv.d();
|
|
}
|
|
HBt hBt = (HBt) obj;
|
|
hBt.d = FW_;
|
|
hBt.c = config;
|
|
if (Bitmap.Config.RGBA_F16.equals(config)) {
|
|
configArr = b;
|
|
} else {
|
|
int i3 = AnonymousClass4.c[config.ordinal()];
|
|
configArr = i3 != 1 ? i3 != 2 ? i3 != 3 ? i3 != 4 ? new Bitmap.Config[]{config} : d : e : a : c;
|
|
}
|
|
int length = configArr.length;
|
|
int i4 = 0;
|
|
while (true) {
|
|
if (i4 >= length) {
|
|
break;
|
|
}
|
|
Bitmap.Config config2 = configArr[i4];
|
|
Integer ceilingKey = El_(config2).ceilingKey(Integer.valueOf(FW_));
|
|
if (ceilingKey == null || ceilingKey.intValue() > (FW_ << 3)) {
|
|
i4++;
|
|
} else if (ceilingKey.intValue() != FW_ || (config2 != null ? !config2.equals(config) : config != null)) {
|
|
RVV rvv2 = this.f;
|
|
if (rvv2.d.size() < 20) {
|
|
rvv2.d.offer(hBt);
|
|
}
|
|
RVV rvv3 = this.f;
|
|
int intValue = ceilingKey.intValue();
|
|
Object obj2 = (ETY) rvv3.d.poll();
|
|
if (obj2 == null) {
|
|
obj2 = rvv3.d();
|
|
}
|
|
hBt = (HBt) obj2;
|
|
hBt.d = intValue;
|
|
hBt.c = config2;
|
|
}
|
|
}
|
|
Bitmap a2 = this.g.a(hBt);
|
|
if (a2 != null) {
|
|
Ej_(Integer.valueOf(hBt.d), a2);
|
|
a2.reconfigure(i, i2, config);
|
|
}
|
|
return a2;
|
|
}
|
|
|
|
@Override // o.uYg
|
|
public final Bitmap Er_() {
|
|
Bitmap d2 = this.g.d();
|
|
if (d2 != null) {
|
|
Ej_(Integer.valueOf(FKd.FX_(d2)), d2);
|
|
}
|
|
return d2;
|
|
}
|
|
|
|
private void Ej_(Integer num, Bitmap bitmap) {
|
|
NavigableMap<Integer, Integer> El_ = El_(bitmap.getConfig());
|
|
Integer num2 = (Integer) El_.get(num);
|
|
if (num2 == null) {
|
|
StringBuilder sb = new StringBuilder("Tried to decrement empty size, size: ");
|
|
sb.append(num);
|
|
sb.append(", removed: ");
|
|
int FX_ = FKd.FX_(bitmap);
|
|
Bitmap.Config config = bitmap.getConfig();
|
|
StringBuilder sb2 = new StringBuilder("[");
|
|
sb2.append(FX_);
|
|
sb2.append("](");
|
|
sb2.append(config);
|
|
sb2.append(")");
|
|
sb.append(sb2.toString());
|
|
sb.append(", this: ");
|
|
sb.append(this);
|
|
throw new NullPointerException(sb.toString());
|
|
}
|
|
if (num2.intValue() == 1) {
|
|
El_.remove(num);
|
|
} else {
|
|
El_.put(num, Integer.valueOf(num2.intValue() - 1));
|
|
}
|
|
}
|
|
|
|
private NavigableMap<Integer, Integer> El_(Bitmap.Config config) {
|
|
NavigableMap<Integer, Integer> navigableMap = this.h.get(config);
|
|
if (navigableMap != null) {
|
|
return navigableMap;
|
|
}
|
|
TreeMap treeMap = new TreeMap();
|
|
this.h.put(config, treeMap);
|
|
return treeMap;
|
|
}
|
|
|
|
@Override // o.uYg
|
|
public final String Ep_(Bitmap bitmap) {
|
|
int FX_ = FKd.FX_(bitmap);
|
|
Bitmap.Config config = bitmap.getConfig();
|
|
StringBuilder sb = new StringBuilder("[");
|
|
sb.append(FX_);
|
|
sb.append("](");
|
|
sb.append(config);
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
|
|
@Override // o.uYg
|
|
public final String Eo_(int i, int i2, Bitmap.Config config) {
|
|
int FW_ = FKd.FW_(i, i2, config);
|
|
StringBuilder sb = new StringBuilder("[");
|
|
sb.append(FW_);
|
|
sb.append("](");
|
|
sb.append(config);
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
|
|
@Override // o.uYg
|
|
public final int En_(Bitmap bitmap) {
|
|
return FKd.FX_(bitmap);
|
|
}
|
|
|
|
public final String toString() {
|
|
StringBuilder sb = new StringBuilder("SizeConfigStrategy{groupedMap=");
|
|
sb.append(this.g);
|
|
sb.append(", sortedSizes=(");
|
|
for (Map.Entry<Bitmap.Config, NavigableMap<Integer, Integer>> entry : this.h.entrySet()) {
|
|
sb.append(entry.getKey());
|
|
sb.append('[');
|
|
sb.append(entry.getValue());
|
|
sb.append("], ");
|
|
}
|
|
if (!this.h.isEmpty()) {
|
|
sb.replace(sb.length() - 2, sb.length(), "");
|
|
}
|
|
sb.append(")}");
|
|
return sb.toString();
|
|
}
|
|
|
|
/* renamed from: o.QmD$RVV */
|
|
/* loaded from: classes.dex */
|
|
static class RVV extends Acs<HBt> {
|
|
RVV() {
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // o.Acs
|
|
public final /* synthetic */ HBt d() {
|
|
return new HBt(this);
|
|
}
|
|
}
|
|
|
|
/* renamed from: o.QmD$HBt */
|
|
/* loaded from: classes.dex */
|
|
static final class HBt implements ETY {
|
|
Bitmap.Config c;
|
|
int d;
|
|
private final RVV e;
|
|
|
|
public HBt(RVV rvv) {
|
|
this.e = rvv;
|
|
}
|
|
|
|
@Override // o.ETY
|
|
public final void e() {
|
|
RVV rvv = this.e;
|
|
if (rvv.d.size() < 20) {
|
|
rvv.d.offer(this);
|
|
}
|
|
}
|
|
|
|
public final String toString() {
|
|
return C0874QmD.Ek_(this.d, this.c);
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (!(obj instanceof HBt)) {
|
|
return false;
|
|
}
|
|
HBt hBt = (HBt) obj;
|
|
return this.d == hBt.d && FKd.c(this.c, hBt.c);
|
|
}
|
|
|
|
public final int hashCode() {
|
|
int i = this.d;
|
|
Bitmap.Config config = this.c;
|
|
return (i * 31) + (config != null ? config.hashCode() : 0);
|
|
}
|
|
}
|
|
|
|
static String Ek_(int i, Bitmap.Config config) {
|
|
StringBuilder sb = new StringBuilder("[");
|
|
sb.append(i);
|
|
sb.append("](");
|
|
sb.append(config);
|
|
sb.append(")");
|
|
return sb.toString();
|
|
}
|
|
|
|
/* renamed from: o.QmD$4, reason: invalid class name */
|
|
/* loaded from: classes.dex */
|
|
static /* synthetic */ class AnonymousClass4 {
|
|
static final int[] c;
|
|
|
|
static {
|
|
int[] iArr = new int[Bitmap.Config.values().length];
|
|
c = iArr;
|
|
try {
|
|
iArr[Bitmap.Config.ARGB_8888.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
c[Bitmap.Config.RGB_565.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
c[Bitmap.Config.ARGB_4444.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
try {
|
|
c[Bitmap.Config.ALPHA_8.ordinal()] = 4;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
}
|
|
}
|
|
}
|