package z1; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.drawable.Animatable; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.util.Log; import java.util.concurrent.locks.Lock; /* loaded from: classes.dex */ abstract class u { /* renamed from: a, reason: collision with root package name */ private static final t1.d f15788a = new a(); class a extends t1.e { a() { } @Override // t1.e, t1.d public void c(Bitmap bitmap) { } } static s1.v a(t1.d dVar, Drawable drawable, int i10, int i11) { Bitmap bitmap; Drawable current = drawable.getCurrent(); boolean z10 = false; if (current instanceof BitmapDrawable) { bitmap = ((BitmapDrawable) current).getBitmap(); } else if (current instanceof Animatable) { bitmap = null; } else { bitmap = b(dVar, current, i10, i11); z10 = true; } if (!z10) { dVar = f15788a; } return f.e(bitmap, dVar); } private static Bitmap b(t1.d dVar, Drawable drawable, int i10, int i11) { if (i10 == Integer.MIN_VALUE && drawable.getIntrinsicWidth() <= 0) { if (Log.isLoggable("DrawableToBitmap", 5)) { Log.w("DrawableToBitmap", "Unable to draw " + drawable + " to Bitmap with Target.SIZE_ORIGINAL because the Drawable has no intrinsic width"); } return null; } if (i11 == Integer.MIN_VALUE && drawable.getIntrinsicHeight() <= 0) { if (Log.isLoggable("DrawableToBitmap", 5)) { Log.w("DrawableToBitmap", "Unable to draw " + drawable + " to Bitmap with Target.SIZE_ORIGINAL because the Drawable has no intrinsic height"); } return null; } if (drawable.getIntrinsicWidth() > 0) { i10 = drawable.getIntrinsicWidth(); } if (drawable.getIntrinsicHeight() > 0) { i11 = drawable.getIntrinsicHeight(); } Lock f10 = g0.f(); f10.lock(); Bitmap d10 = dVar.d(i10, i11, Bitmap.Config.ARGB_8888); try { Canvas canvas = new Canvas(d10); drawable.setBounds(0, 0, i10, i11); drawable.draw(canvas); canvas.setBitmap(null); return d10; } finally { f10.unlock(); } } }