package defpackage;

import android.graphics.ColorSpace;
import android.graphics.ImageDecoder;
import android.graphics.ImageDecoder$OnHeaderDecodedListener;
import android.os.Build;
import android.util.Log;
import android.util.Size;

/* JADX INFO: renamed from: ˏʗᵶ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C1809 implements ImageDecoder$OnHeaderDecodedListener {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final int f7211;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final int f7212;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final C2005 f7213;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final C0381 f7214 = C0381.m1702();

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final EnumC1261 f7215;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final EnumC3397 f7216;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final boolean f7217;

    public C1809(int i, int i2, C2220 c2220) {
        this.f7211 = i;
        this.f7212 = i2;
        this.f7216 = (EnumC3397) c2220.m5809(C3297.f12685);
        this.f7213 = (C2005) c2220.m5809(C2005.f7932);
        C1305 c1305 = C3297.f12684;
        this.f7217 = c2220.m5809(c1305) != null && ((Boolean) c2220.m5809(c1305)).booleanValue();
        this.f7215 = (EnumC1261) c2220.m5809(C3297.f12682);
    }

    public final void onHeaderDecoded(ImageDecoder imageDecoder, ImageDecoder.ImageInfo imageInfo, ImageDecoder.Source source) {
        C0381 c0381 = this.f7214;
        int width = this.f7211;
        int height = this.f7212;
        if (c0381.m1704(width, height, this.f7217, false)) {
            imageDecoder.setAllocator(3);
        } else {
            imageDecoder.setAllocator(1);
        }
        if (this.f7216 == EnumC3397.f13090) {
            imageDecoder.setMemorySizePolicy(0);
        }
        imageDecoder.setOnPartialImageListener(new C4071());
        Size size = imageInfo.getSize();
        if (width == Integer.MIN_VALUE) {
            width = size.getWidth();
        }
        if (height == Integer.MIN_VALUE) {
            height = size.getHeight();
        }
        float fM5388 = this.f7213.m5388(size.getWidth(), size.getHeight(), width, height);
        int iRound = Math.round(size.getWidth() * fM5388);
        int iRound2 = Math.round(fM5388 * size.getHeight());
        if (Log.isLoggable("ImageDecoder", 2)) {
            size.getWidth();
            size.getHeight();
        }
        imageDecoder.setTargetSize(iRound, iRound2);
        EnumC1261 enumC1261 = this.f7215;
        if (enumC1261 != null) {
            int i = Build.VERSION.SDK_INT;
            if (i >= 28) {
                imageDecoder.setTargetColorSpace(ColorSpace.get((enumC1261 == EnumC1261.f5309 && imageInfo.getColorSpace() != null && imageInfo.getColorSpace().isWideGamut()) ? ColorSpace.Named.DISPLAY_P3 : ColorSpace.Named.SRGB));
            } else if (i >= 26) {
                imageDecoder.setTargetColorSpace(ColorSpace.get(ColorSpace.Named.SRGB));
            }
        }
    }
}
