package androidx.core.graphics;

import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.ImageDecoder;
import android.graphics.ImageDecoder$OnHeaderDecodedListener;
import android.graphics.drawable.Drawable;
import androidx.annotation.RequiresApi;
import java.io.IOException;
import kotlin.jvm.internal.l;
import y1.q;

/* JADX INFO: loaded from: classes.dex */
@SuppressLint({"ClassVerificationFailure"})
public final class ImageDecoderKt {
    @RequiresApi(28)
    public static final Bitmap decodeBitmap(ImageDecoder.Source source, final q action) throws IOException {
        l.e(source, "<this>");
        l.e(action, "action");
        Bitmap bitmapDecodeBitmap = ImageDecoder.decodeBitmap(source, a.a(new ImageDecoder$OnHeaderDecodedListener() { // from class: androidx.core.graphics.ImageDecoderKt.decodeBitmap.1
            public final void onHeaderDecoded(ImageDecoder decoder, ImageDecoder.ImageInfo info, ImageDecoder.Source source2) {
                l.e(decoder, "decoder");
                l.e(info, "info");
                l.e(source2, "source");
                action.invoke(decoder, info, source2);
            }
        }));
        l.d(bitmapDecodeBitmap, "crossinline action: Imag…ction(info, source)\n    }");
        return bitmapDecodeBitmap;
    }

    @RequiresApi(28)
    public static final Drawable decodeDrawable(ImageDecoder.Source source, final q action) throws IOException {
        l.e(source, "<this>");
        l.e(action, "action");
        Drawable drawableDecodeDrawable = ImageDecoder.decodeDrawable(source, a.a(new ImageDecoder$OnHeaderDecodedListener() { // from class: androidx.core.graphics.ImageDecoderKt.decodeDrawable.1
            public final void onHeaderDecoded(ImageDecoder decoder, ImageDecoder.ImageInfo info, ImageDecoder.Source source2) {
                l.e(decoder, "decoder");
                l.e(info, "info");
                l.e(source2, "source");
                action.invoke(decoder, info, source2);
            }
        }));
        l.d(drawableDecodeDrawable, "crossinline action: Imag…ction(info, source)\n    }");
        return drawableDecodeDrawable;
    }
}
