package p138.p145.p146.p151.p160.p161;

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;
import p138.p145.p146.p151.p154.InterfaceC2932;
import p138.p145.p146.p151.p154.p155.C2943;
import p138.p145.p146.p151.p154.p155.InterfaceC2942;

/* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ތ.ހ.ފ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3098 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final InterfaceC2942 f9315 = new C3099();

    /* JADX INFO: renamed from: ދ.ؠ.֏.ތ.ތ.ހ.ފ$֏, reason: contains not printable characters */
    public class C3099 extends C2943 {
        @Override // p138.p145.p146.p151.p154.p155.C2943, p138.p145.p146.p151.p154.p155.InterfaceC2942
        /* JADX INFO: renamed from: ֏ */
        public void mo5088(Bitmap bitmap) {
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static InterfaceC2932<Bitmap> m5184(InterfaceC2942 interfaceC2942, Drawable drawable, int i, int i2) {
        Drawable current = drawable.getCurrent();
        boolean z = false;
        Bitmap bitmap = null;
        if (current instanceof BitmapDrawable) {
            bitmap = ((BitmapDrawable) current).getBitmap();
        } else if (!(current instanceof Animatable)) {
            if (i != Integer.MIN_VALUE || current.getIntrinsicWidth() > 0) {
                if (i2 != Integer.MIN_VALUE || current.getIntrinsicHeight() > 0) {
                    if (current.getIntrinsicWidth() > 0) {
                        i = current.getIntrinsicWidth();
                    }
                    if (current.getIntrinsicHeight() > 0) {
                        i2 = current.getIntrinsicHeight();
                    }
                    Lock lock = C3115.f9351;
                    lock.lock();
                    Bitmap bitmapMo5085 = interfaceC2942.mo5085(i, i2, Bitmap.Config.ARGB_8888);
                    try {
                        Canvas canvas = new Canvas(bitmapMo5085);
                        current.setBounds(0, 0, i, i2);
                        current.draw(canvas);
                        canvas.setBitmap(null);
                        lock.unlock();
                        bitmap = bitmapMo5085;
                    } catch (Throwable th) {
                        lock.unlock();
                        throw th;
                    }
                } else if (Log.isLoggable("DrawableToBitmap", 5)) {
                    Log.w("DrawableToBitmap", "Unable to draw " + current + " to Bitmap with Target.SIZE_ORIGINAL because the Drawable has no intrinsic height");
                }
            } else if (Log.isLoggable("DrawableToBitmap", 5)) {
                Log.w("DrawableToBitmap", "Unable to draw " + current + " to Bitmap with Target.SIZE_ORIGINAL because the Drawable has no intrinsic width");
            }
            z = true;
        }
        if (!z) {
            interfaceC2942 = f9315;
        }
        return C3083.m5166(bitmap, interfaceC2942);
    }
}
