package ඓ.ῲ.K.ᕣ.ᕣ.ʬ;

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 ඓ.ῲ.K.ᕣ.ᨨ.AbstractC1027;
import ඓ.ῲ.K.ᕣ.ᨨ.ゎ.AbstractC0976;
import ඓ.ῲ.K.ᕣ.ᨨ.ゎ.C0962;

/* renamed from: ඓ.ῲ.K.ᕣ.ᕣ.ʬ.㑃  reason: contains not printable characters */
/* compiled from: DrawableToBitmapConverter */
public final class C0881 {

    /* renamed from: K  reason: contains not printable characters */
    public static final AbstractC0976 f4137 = new C0882();

    /* renamed from: ඓ.ῲ.K.ᕣ.ᕣ.ʬ.㑃$K  reason: contains not printable characters */
    /* compiled from: DrawableToBitmapConverter */
    public class C0882 extends C0962 {
        @Override // ඓ.ῲ.K.ᕣ.ᨨ.ゎ.AbstractC0976, ඓ.ῲ.K.ᕣ.ᨨ.ゎ.C0962
        /* renamed from: K  reason: contains not printable characters */
        public void m2550(Bitmap bitmap) {
        }
    }

    /* JADX INFO: finally extract failed */
    /* renamed from: K  reason: contains not printable characters */
    public static AbstractC1027<Bitmap> m2549(AbstractC0976 r7, 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 = C0868.f4110;
                    lock.lock();
                    Bitmap r3 = r7.m2769(i, i2, Bitmap.Config.ARGB_8888);
                    try {
                        Canvas canvas = new Canvas(r3);
                        current.setBounds(0, 0, i, i2);
                        current.draw(canvas);
                        canvas.setBitmap(null);
                        lock.unlock();
                        bitmap = r3;
                    } 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) {
            r7 = f4137;
        }
        return C0859.m2488(bitmap, r7);
    }
}
