package o;

import android.graphics.Canvas;
import android.graphics.RecordingCanvas;
import android.graphics.RenderNode;
import android.os.Build;
import android.widget.EdgeEffect;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class ZD extends AbstractC0561Vq implements InterfaceC1905mt {
    public final /* synthetic */ int B = 1;
    public final C1734l4 C;
    public final C0643Yu D;
    public Object E;

    public ZD(Wb0 wb0, C1734l4 c1734l4, C0643Yu c0643Yu) {
        this.C = c1734l4;
        this.D = c0643Yu;
        H0(wb0);
    }

    public static boolean K0(float f, EdgeEffect edgeEffect, Canvas canvas) {
        if (f == 0.0f) {
            return edgeEffect.draw(canvas);
        }
        int iSave = canvas.save();
        canvas.rotate(f);
        boolean zDraw = edgeEffect.draw(canvas);
        canvas.restoreToCount(iSave);
        return zDraw;
    }

    public static boolean L0(float f, long j, EdgeEffect edgeEffect, Canvas canvas) {
        int iSave = canvas.save();
        canvas.rotate(f);
        canvas.translate(Float.intBitsToFloat((int) (j >> 32)), Float.intBitsToFloat((int) (j & 4294967295L)));
        boolean zDraw = edgeEffect.draw(canvas);
        canvas.restoreToCount(iSave);
        return zDraw;
    }

    public RenderNode M0() {
        RenderNode renderNode = (RenderNode) this.E;
        if (renderNode != null) {
            return renderNode;
        }
        RenderNode renderNodeE = KH.e();
        this.E = renderNodeE;
        return renderNodeE;
    }

    @Override // o.InterfaceC1905mt
    public final void r(C2610uK c2610uK) {
        boolean zL0;
        char c;
        boolean z;
        Canvas canvas;
        boolean zK0;
        float f;
        float f2;
        int i = this.B;
        C1734l4 c1734l4 = this.C;
        C0643Yu c0643Yu = this.D;
        switch (i) {
            case 0:
                C2147pV c2147pV = (C2147pV) this.E;
                C3113zg c3113zg = c2610uK.l;
                c1734l4.i(c3113zg.f());
                if (T80.e(c3113zg.f())) {
                    c2610uK.a();
                    return;
                }
                c2610uK.a();
                c1734l4.d.getValue();
                InterfaceC2923xg interfaceC2923xgX = c3113zg.m.x();
                Canvas canvas2 = U2.a;
                Canvas canvas3 = ((T2) interfaceC2923xgX).a;
                if (C0643Yu.f(c0643Yu.f)) {
                    EdgeEffect edgeEffectC = c0643Yu.c();
                    float f3 = -Float.intBitsToFloat((int) (c3113zg.f() & 4294967295L));
                    zL0 = L0(270.0f, (Float.floatToRawIntBits(c2610uK.B(c2147pV.a(c2610uK.getLayoutDirection()))) & 4294967295L) | (Float.floatToRawIntBits(f3) << 32), edgeEffectC, canvas3);
                } else {
                    zL0 = false;
                }
                if (C0643Yu.f(c0643Yu.d)) {
                    zL0 = L0(0.0f, (((long) Float.floatToRawIntBits(c2610uK.B(c2147pV.b))) & 4294967295L) | (((long) Float.floatToRawIntBits(0.0f)) << 32), c0643Yu.e(), canvas3) || zL0;
                }
                if (C0643Yu.f(c0643Yu.g)) {
                    zL0 = L0(90.0f, (((long) Float.floatToRawIntBits(c2610uK.B(c2147pV.b(c2610uK.getLayoutDirection())) + (-((float) C2887xC.D(Float.intBitsToFloat((int) (c3113zg.f() >> 32))))))) & 4294967295L) | (((long) Float.floatToRawIntBits(0.0f)) << 32), c0643Yu.d(), canvas3) || zL0;
                }
                if (C0643Yu.f(c0643Yu.e)) {
                    EdgeEffect edgeEffectB = c0643Yu.b();
                    zL0 = L0(180.0f, (((long) Float.floatToRawIntBits(-Float.intBitsToFloat((int) (c3113zg.f() >> 32)))) << 32) | (((long) Float.floatToRawIntBits((-Float.intBitsToFloat((int) (c3113zg.f() & 4294967295L))) + c2610uK.B(c2147pV.d))) & 4294967295L), edgeEffectB, canvas3) || zL0;
                }
                if (zL0) {
                    c1734l4.d();
                    return;
                }
                return;
            default:
                C3113zg c3113zg2 = c2610uK.l;
                c1734l4.i(c3113zg2.f());
                InterfaceC2923xg interfaceC2923xgX2 = c3113zg2.m.x();
                Canvas canvas4 = U2.a;
                Canvas canvas5 = ((T2) interfaceC2923xgX2).a;
                c1734l4.d.getValue();
                if (T80.e(c3113zg2.f())) {
                    c2610uK.a();
                    return;
                }
                if (!canvas5.isHardwareAccelerated()) {
                    EdgeEffect edgeEffect = c0643Yu.d;
                    if (edgeEffect != null) {
                        edgeEffect.finish();
                    }
                    EdgeEffect edgeEffect2 = c0643Yu.e;
                    if (edgeEffect2 != null) {
                        edgeEffect2.finish();
                    }
                    EdgeEffect edgeEffect3 = c0643Yu.f;
                    if (edgeEffect3 != null) {
                        edgeEffect3.finish();
                    }
                    EdgeEffect edgeEffect4 = c0643Yu.g;
                    if (edgeEffect4 != null) {
                        edgeEffect4.finish();
                    }
                    EdgeEffect edgeEffect5 = c0643Yu.h;
                    if (edgeEffect5 != null) {
                        edgeEffect5.finish();
                    }
                    EdgeEffect edgeEffect6 = c0643Yu.i;
                    if (edgeEffect6 != null) {
                        edgeEffect6.finish();
                    }
                    EdgeEffect edgeEffect7 = c0643Yu.j;
                    if (edgeEffect7 != null) {
                        edgeEffect7.finish();
                    }
                    EdgeEffect edgeEffect8 = c0643Yu.k;
                    if (edgeEffect8 != null) {
                        edgeEffect8.finish();
                    }
                    c2610uK.a();
                    return;
                }
                float fB = c2610uK.B(AbstractC1503ii.a);
                boolean z2 = C0643Yu.f(c0643Yu.d) || C0643Yu.g(c0643Yu.h) || C0643Yu.f(c0643Yu.e) || C0643Yu.g(c0643Yu.i);
                boolean z3 = C0643Yu.f(c0643Yu.f) || C0643Yu.g(c0643Yu.j) || C0643Yu.f(c0643Yu.g) || C0643Yu.g(c0643Yu.k);
                if (z2 && z3) {
                    c = ' ';
                    M0().setPosition(0, 0, canvas5.getWidth(), canvas5.getHeight());
                } else {
                    c = ' ';
                    if (z2) {
                        M0().setPosition(0, 0, (C2887xC.D(fB) * 2) + canvas5.getWidth(), canvas5.getHeight());
                    } else {
                        if (!z3) {
                            c2610uK.a();
                            return;
                        }
                        M0().setPosition(0, 0, canvas5.getWidth(), (C2887xC.D(fB) * 2) + canvas5.getHeight());
                    }
                }
                RecordingCanvas recordingCanvasBeginRecording = M0().beginRecording();
                boolean zG = C0643Yu.g(c0643Yu.j);
                OU ou = OU.m;
                if (zG) {
                    EdgeEffect edgeEffectA = c0643Yu.j;
                    if (edgeEffectA == null) {
                        edgeEffectA = c0643Yu.a(ou);
                        c0643Yu.j = edgeEffectA;
                    }
                    K0(90.0f, edgeEffectA, recordingCanvasBeginRecording);
                    edgeEffectA.finish();
                }
                if (C0643Yu.f(c0643Yu.f)) {
                    EdgeEffect edgeEffectC2 = c0643Yu.c();
                    zK0 = K0(270.0f, edgeEffectC2, recordingCanvasBeginRecording);
                    if (C0643Yu.g(c0643Yu.f)) {
                        canvas = canvas5;
                        float fIntBitsToFloat = Float.intBitsToFloat((int) (c1734l4.c() & 4294967295L));
                        EdgeEffect edgeEffectA2 = c0643Yu.j;
                        if (edgeEffectA2 == null) {
                            edgeEffectA2 = c0643Yu.a(ou);
                            c0643Yu.j = edgeEffectA2;
                        }
                        int i2 = Build.VERSION.SDK_INT;
                        float fB2 = i2 >= 31 ? AbstractC1930n7.b(edgeEffectC2) : 0.0f;
                        z = z2;
                        float f4 = 1 - fIntBitsToFloat;
                        if (i2 >= 31) {
                            AbstractC1930n7.c(edgeEffectA2, fB2, f4);
                        } else {
                            edgeEffectA2.onPull(fB2, f4);
                        }
                    } else {
                        z = z2;
                        canvas = canvas5;
                    }
                } else {
                    z = z2;
                    canvas = canvas5;
                    zK0 = false;
                }
                boolean zG2 = C0643Yu.g(c0643Yu.h);
                OU ou2 = OU.l;
                if (zG2) {
                    EdgeEffect edgeEffectA3 = c0643Yu.h;
                    if (edgeEffectA3 == null) {
                        edgeEffectA3 = c0643Yu.a(ou2);
                        c0643Yu.h = edgeEffectA3;
                    }
                    K0(180.0f, edgeEffectA3, recordingCanvasBeginRecording);
                    edgeEffectA3.finish();
                }
                if (C0643Yu.f(c0643Yu.d)) {
                    EdgeEffect edgeEffectE = c0643Yu.e();
                    zK0 = K0(0.0f, edgeEffectE, recordingCanvasBeginRecording) || zK0;
                    if (C0643Yu.g(c0643Yu.d)) {
                        float fIntBitsToFloat2 = Float.intBitsToFloat((int) (c1734l4.c() >> c));
                        EdgeEffect edgeEffectA4 = c0643Yu.h;
                        if (edgeEffectA4 == null) {
                            edgeEffectA4 = c0643Yu.a(ou2);
                            c0643Yu.h = edgeEffectA4;
                        }
                        int i3 = Build.VERSION.SDK_INT;
                        float fB3 = i3 >= 31 ? AbstractC1930n7.b(edgeEffectE) : 0.0f;
                        if (i3 >= 31) {
                            AbstractC1930n7.c(edgeEffectA4, fB3, fIntBitsToFloat2);
                        } else {
                            edgeEffectA4.onPull(fB3, fIntBitsToFloat2);
                        }
                    }
                }
                if (C0643Yu.g(c0643Yu.k)) {
                    EdgeEffect edgeEffectA5 = c0643Yu.k;
                    if (edgeEffectA5 == null) {
                        edgeEffectA5 = c0643Yu.a(ou);
                        c0643Yu.k = edgeEffectA5;
                    }
                    K0(270.0f, edgeEffectA5, recordingCanvasBeginRecording);
                    edgeEffectA5.finish();
                }
                if (C0643Yu.f(c0643Yu.g)) {
                    EdgeEffect edgeEffectD = c0643Yu.d();
                    zK0 = K0(90.0f, edgeEffectD, recordingCanvasBeginRecording) || zK0;
                    if (C0643Yu.g(c0643Yu.g)) {
                        float fIntBitsToFloat3 = Float.intBitsToFloat((int) (c1734l4.c() & 4294967295L));
                        EdgeEffect edgeEffectA6 = c0643Yu.k;
                        if (edgeEffectA6 == null) {
                            edgeEffectA6 = c0643Yu.a(ou);
                            c0643Yu.k = edgeEffectA6;
                        }
                        int i4 = Build.VERSION.SDK_INT;
                        float fB4 = i4 >= 31 ? AbstractC1930n7.b(edgeEffectD) : 0.0f;
                        if (i4 >= 31) {
                            AbstractC1930n7.c(edgeEffectA6, fB4, fIntBitsToFloat3);
                        } else {
                            edgeEffectA6.onPull(fB4, fIntBitsToFloat3);
                        }
                    }
                }
                if (C0643Yu.g(c0643Yu.i)) {
                    EdgeEffect edgeEffectA7 = c0643Yu.i;
                    if (edgeEffectA7 == null) {
                        edgeEffectA7 = c0643Yu.a(ou2);
                        c0643Yu.i = edgeEffectA7;
                    }
                    K0(0.0f, edgeEffectA7, recordingCanvasBeginRecording);
                    edgeEffectA7.finish();
                }
                if (C0643Yu.f(c0643Yu.e)) {
                    EdgeEffect edgeEffectB2 = c0643Yu.b();
                    boolean z4 = K0(180.0f, edgeEffectB2, recordingCanvasBeginRecording) || zK0;
                    if (C0643Yu.g(c0643Yu.e)) {
                        float fIntBitsToFloat4 = Float.intBitsToFloat((int) (c1734l4.c() >> c));
                        EdgeEffect edgeEffectA8 = c0643Yu.i;
                        if (edgeEffectA8 == null) {
                            edgeEffectA8 = c0643Yu.a(ou2);
                            c0643Yu.i = edgeEffectA8;
                        }
                        int i5 = Build.VERSION.SDK_INT;
                        float fB5 = i5 >= 31 ? AbstractC1930n7.b(edgeEffectB2) : 0.0f;
                        float f5 = 1 - fIntBitsToFloat4;
                        if (i5 >= 31) {
                            AbstractC1930n7.c(edgeEffectA8, fB5, f5);
                        } else {
                            edgeEffectA8.onPull(fB5, f5);
                        }
                    }
                    zK0 = z4;
                }
                if (zK0) {
                    c1734l4.d();
                }
                float f6 = z3 ? 0.0f : fB;
                if (z) {
                    fB = 0.0f;
                }
                EnumC1280gK layoutDirection = c2610uK.getLayoutDirection();
                T2 t2 = new T2();
                t2.a = recordingCanvasBeginRecording;
                long jF = c3113zg2.f();
                C3126zm0 c3126zm0 = c3113zg2.m;
                C3018yg c3018yg = ((C3113zg) c3126zm0.f831o).l;
                InterfaceC2281qr interfaceC2281qr = c3018yg.a;
                EnumC1280gK enumC1280gK = c3018yg.b;
                InterfaceC2923xg interfaceC2923xgX3 = c3126zm0.x();
                long jD = c3113zg2.m.D();
                C3126zm0 c3126zm02 = c3113zg2.m;
                C1082eE c1082eE = (C1082eE) c3126zm02.n;
                c3126zm02.R(c2610uK);
                c3126zm02.S(layoutDirection);
                c3126zm02.Q(t2);
                c3126zm02.T(jF);
                c3126zm02.n = null;
                t2.n();
                try {
                    ((OD) c3113zg2.m.m).I(f6, fB);
                    try {
                        c2610uK.a();
                        t2.k();
                        C3126zm0 c3126zm03 = c3113zg2.m;
                        c3126zm03.R(interfaceC2281qr);
                        c3126zm03.S(enumC1280gK);
                        c3126zm03.Q(interfaceC2923xgX3);
                        c3126zm03.T(jD);
                        c3126zm03.n = c1082eE;
                        M0().endRecording();
                        int iSave = canvas.save();
                        Canvas canvas6 = canvas;
                        canvas6.translate(f, f2);
                        canvas6.drawRenderNode(M0());
                        canvas6.restoreToCount(iSave);
                        return;
                    } finally {
                        ((OD) c3113zg2.m.m).I(-f6, -fB);
                    }
                } catch (Throwable th) {
                    t2.k();
                    C3126zm0 c3126zm04 = c3113zg2.m;
                    c3126zm04.R(interfaceC2281qr);
                    c3126zm04.S(enumC1280gK);
                    c3126zm04.Q(interfaceC2923xgX3);
                    c3126zm04.T(jD);
                    c3126zm04.n = c1082eE;
                    throw th;
                }
        }
    }

    public ZD(Wb0 wb0, C1734l4 c1734l4, C0643Yu c0643Yu, C2147pV c2147pV) {
        this.C = c1734l4;
        this.D = c0643Yu;
        this.E = c2147pV;
        H0(wb0);
    }
}
