package o; import android.graphics.Bitmap; import android.util.Log; import java.util.Set; /* loaded from: classes.dex */ public final class Wdn implements sqY { private static final Bitmap.Config b = Bitmap.Config.ARGB_8888; private int a; private final Set c; private long d; private int e; private long f; private int g; private final long h; private final uYg i; private int j; private final LWm l; /* loaded from: classes.dex */ interface LWm { } private Wdn(long j, uYg uyg, Set set) { this.h = j; this.f = j; this.i = uyg; this.c = set; this.l = new RVV(); } @Override // o.sqY public final void EP_(Bitmap bitmap) { synchronized (this) { if (bitmap == null) { throw new NullPointerException("Bitmap must not be null"); } if (bitmap.isRecycled()) { throw new IllegalStateException("Cannot pool recycled bitmap"); } if (bitmap.isMutable() && this.i.En_(bitmap) <= this.f && this.c.contains(bitmap.getConfig())) { int En_ = this.i.En_(bitmap); this.i.Eq_(bitmap); this.g++; this.d += En_; if (Log.isLoggable("LruBitmapPool", 2)) { this.i.Ep_(bitmap); } c(this.f); return; } if (Log.isLoggable("LruBitmapPool", 2)) { this.i.Ep_(bitmap); bitmap.isMutable(); this.c.contains(bitmap.getConfig()); } bitmap.recycle(); } } @Override // o.sqY public final Bitmap Ea_(int i, int i2, Bitmap.Config config) { Bitmap DZ_ = DZ_(i, i2, config); if (DZ_ != null) { DZ_.eraseColor(0); return DZ_; } if (config == null) { config = b; } return Bitmap.createBitmap(i, i2, config); } @Override // o.sqY public final Bitmap Eb_(int i, int i2, Bitmap.Config config) { Bitmap DZ_ = DZ_(i, i2, config); if (DZ_ != null) { return DZ_; } if (config == null) { config = b; } return Bitmap.createBitmap(i, i2, config); } @Override // o.sqY public final void e() { c(0L); } private void c(long j) { synchronized (this) { while (this.d > j) { Bitmap Er_ = this.i.Er_(); if (Er_ == null) { this.d = 0L; return; } this.d -= this.i.En_(Er_); this.a++; if (Log.isLoggable("LruBitmapPool", 3)) { this.i.Ep_(Er_); } Er_.recycle(); } } } /* loaded from: classes.dex */ static final class RVV implements LWm { RVV() { } } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public Wdn(long r4) { /* r3 = this; o.QmD r0 = new o.QmD r0.() java.util.HashSet r1 = new java.util.HashSet android.graphics.Bitmap$Config[] r2 = android.graphics.Bitmap.Config.values() java.util.List r2 = java.util.Arrays.asList(r2) r1.(r2) r2 = 0 r1.add(r2) android.graphics.Bitmap$Config r2 = android.graphics.Bitmap.Config.HARDWARE r1.remove(r2) java.util.Set r1 = java.util.Collections.unmodifiableSet(r1) r3.(r4, r0, r1) return */ throw new UnsupportedOperationException("Method not decompiled: o.Wdn.(long):void"); } private Bitmap DZ_(int i, int i2, Bitmap.Config config) { Bitmap Em_; synchronized (this) { if (config != Bitmap.Config.HARDWARE) { Em_ = this.i.Em_(i, i2, config != null ? config : b); if (Em_ == null) { if (Log.isLoggable("LruBitmapPool", 3)) { this.i.Eo_(i, i2, config); } this.j++; } else { this.e++; this.d -= this.i.En_(Em_); Em_.setHasAlpha(true); Em_.setPremultiplied(true); } if (Log.isLoggable("LruBitmapPool", 2)) { this.i.Eo_(i, i2, config); } } else { StringBuilder sb = new StringBuilder("Cannot create a mutable Bitmap with config: "); sb.append(config); sb.append(". Consider setting Downsampler#ALLOW_HARDWARE_CONFIG to false in your RequestOptions and/or in GlideBuilder.setDefaultRequestOptions"); throw new IllegalArgumentException(sb.toString()); } } return Em_; } @Override // o.sqY public final void e(int i) { if (i >= 40 || i >= 20) { c(0L); } else if (i >= 20 || i == 15) { c(this.f / 2); } } }