package s0;

import J0.A;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.PorterDuffXfermode;
import android.os.Build;
import android.view.DisplayListCanvas;
import android.view.RenderNode;
import h1.m;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.jvm.internal.o;
import p.C2646H;
import p0.AbstractC2686D;
import p0.AbstractC2697c;
import p0.AbstractC2715v;
import p0.C2696b;
import p0.C2709o;
import p0.C2713t;
import p0.C2714u;
import p0.InterfaceC2712s;
import r0.C2862a;
import r0.C2863b;

/* JADX INFO: loaded from: classes.dex */
public final class e implements d {

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public static final AtomicBoolean f24046C = new AtomicBoolean(true);

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public boolean f24047A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public C2709o f24048B;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final C2713t f24049b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final C2863b f24050c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final RenderNode f24051d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public long f24052e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Paint f24053f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Matrix f24054g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public boolean f24055h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public long f24056i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public int f24057j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f24058k;
    public float l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public boolean f24059m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public float f24060n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public float f24061o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public float f24062p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public float f24063q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public float f24064r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public long f24065s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public long f24066t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public float f24067u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public float f24068v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public float f24069w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public float f24070x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public boolean f24071y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public boolean f24072z;

    public e(A a6, C2713t c2713t, C2863b c2863b) {
        this.f24049b = c2713t;
        this.f24050c = c2863b;
        RenderNode renderNodeCreate = RenderNode.create("Compose", a6);
        this.f24051d = renderNodeCreate;
        this.f24052e = 0L;
        this.f24056i = 0L;
        if (f24046C.getAndSet(false)) {
            renderNodeCreate.setScaleX(renderNodeCreate.getScaleX());
            renderNodeCreate.setScaleY(renderNodeCreate.getScaleY());
            renderNodeCreate.setTranslationX(renderNodeCreate.getTranslationX());
            renderNodeCreate.setTranslationY(renderNodeCreate.getTranslationY());
            renderNodeCreate.setElevation(renderNodeCreate.getElevation());
            renderNodeCreate.setRotation(renderNodeCreate.getRotation());
            renderNodeCreate.setRotationX(renderNodeCreate.getRotationX());
            renderNodeCreate.setRotationY(renderNodeCreate.getRotationY());
            renderNodeCreate.setCameraDistance(renderNodeCreate.getCameraDistance());
            renderNodeCreate.setPivotX(renderNodeCreate.getPivotX());
            renderNodeCreate.setPivotY(renderNodeCreate.getPivotY());
            renderNodeCreate.setClipToOutline(renderNodeCreate.getClipToOutline());
            renderNodeCreate.setClipToBounds(false);
            renderNodeCreate.setAlpha(renderNodeCreate.getAlpha());
            renderNodeCreate.isValid();
            renderNodeCreate.setLeftTopRightBottom(0, 0, 0, 0);
            renderNodeCreate.offsetLeftAndRight(0);
            renderNodeCreate.offsetTopAndBottom(0);
            if (Build.VERSION.SDK_INT >= 28) {
                k.c(renderNodeCreate, k.a(renderNodeCreate));
                k.d(renderNodeCreate, k.b(renderNodeCreate));
            }
            j.a(renderNodeCreate);
            renderNodeCreate.setLayerType(0);
            renderNodeCreate.setHasOverlappingRendering(renderNodeCreate.hasOverlappingRendering());
        }
        renderNodeCreate.setClipToBounds(false);
        O(0);
        this.f24057j = 0;
        this.f24058k = 3;
        this.l = 1.0f;
        this.f24060n = 1.0f;
        this.f24061o = 1.0f;
        long j4 = C2714u.f22935b;
        this.f24065s = j4;
        this.f24066t = j4;
        this.f24070x = 8.0f;
    }

    @Override // s0.d
    public final float A() {
        return this.f24062p;
    }

    @Override // s0.d
    public final void B(boolean z6) {
        this.f24071y = z6;
        N();
    }

    @Override // s0.d
    public final float C() {
        return this.f24067u;
    }

    @Override // s0.d
    public final void D(int i6) {
        this.f24057j = i6;
        P();
    }

    @Override // s0.d
    public final void E(float f6) {
        this.f24062p = f6;
        this.f24051d.setTranslationX(f6);
    }

    @Override // s0.d
    public final void F(long j4) {
        if (Build.VERSION.SDK_INT >= 28) {
            this.f24066t = j4;
            k.d(this.f24051d, AbstractC2686D.I(j4));
        }
    }

    @Override // s0.d
    public final Matrix G() {
        Matrix matrix = this.f24054g;
        if (matrix == null) {
            matrix = new Matrix();
            this.f24054g = matrix;
        }
        this.f24051d.getMatrix(matrix);
        return matrix;
    }

    @Override // s0.d
    public final void H(C2709o c2709o) {
        this.f24048B = c2709o;
    }

    @Override // s0.d
    public final void I(float f6) {
        this.f24070x = f6;
        this.f24051d.setCameraDistance(-f6);
    }

    @Override // s0.d
    public final float J() {
        return this.f24064r;
    }

    @Override // s0.d
    public final float K() {
        return this.f24061o;
    }

    @Override // s0.d
    public final void L(float f6) {
        this.f24067u = f6;
        this.f24051d.setRotationX(f6);
    }

    @Override // s0.d
    public final int M() {
        return this.f24058k;
    }

    public final void N() {
        boolean z6 = this.f24071y;
        boolean z7 = false;
        boolean z8 = z6 && !this.f24055h;
        if (z6 && this.f24055h) {
            z7 = true;
        }
        if (z8 != this.f24072z) {
            this.f24072z = z8;
            this.f24051d.setClipToBounds(z8);
        }
        if (z7 != this.f24047A) {
            this.f24047A = z7;
            this.f24051d.setClipToOutline(z7);
        }
    }

    public final void O(int i6) {
        RenderNode renderNode = this.f24051d;
        if (i6 == 1) {
            renderNode.setLayerType(2);
            renderNode.setLayerPaint(this.f24053f);
            renderNode.setHasOverlappingRendering(true);
        } else if (i6 == 2) {
            renderNode.setLayerType(0);
            renderNode.setLayerPaint(this.f24053f);
            renderNode.setHasOverlappingRendering(false);
        } else {
            renderNode.setLayerType(0);
            renderNode.setLayerPaint(this.f24053f);
            renderNode.setHasOverlappingRendering(true);
        }
    }

    public final void P() {
        int i6 = this.f24057j;
        if (i6 != 1 && this.f24058k == 3) {
            O(i6);
        } else {
            O(1);
        }
    }

    @Override // s0.d
    public final void a(float f6) {
        this.f24068v = f6;
        this.f24051d.setRotationY(f6);
    }

    @Override // s0.d
    public final float b() {
        return this.f24060n;
    }

    @Override // s0.d
    public final void c(float f6) {
        this.f24064r = f6;
        this.f24051d.setElevation(f6);
    }

    @Override // s0.d
    public final C2709o d() {
        return this.f24048B;
    }

    @Override // s0.d
    public final void e(float f6) {
        this.f24069w = f6;
        this.f24051d.setRotation(f6);
    }

    @Override // s0.d
    public final void f(float f6) {
        this.f24063q = f6;
        this.f24051d.setTranslationY(f6);
    }

    @Override // s0.d
    public final void g(Outline outline, long j4) {
        this.f24056i = j4;
        this.f24051d.setOutline(outline);
        this.f24055h = outline != null;
        N();
    }

    @Override // s0.d
    public final float getAlpha() {
        return this.l;
    }

    @Override // s0.d
    public final AbstractC2715v getColorFilter() {
        return null;
    }

    @Override // s0.d
    public final void h(InterfaceC2712s interfaceC2712s) {
        DisplayListCanvas displayListCanvasA = AbstractC2697c.a(interfaceC2712s);
        o.f(displayListCanvasA, "null cannot be cast to non-null type android.view.DisplayListCanvas");
        displayListCanvasA.drawRenderNode(this.f24051d);
    }

    @Override // s0.d
    public final void i(int i6) {
        if (this.f24058k == i6) {
            return;
        }
        this.f24058k = i6;
        Paint paint = this.f24053f;
        if (paint == null) {
            paint = new Paint();
            this.f24053f = paint;
        }
        paint.setXfermode(new PorterDuffXfermode(AbstractC2686D.M(i6)));
        P();
    }

    @Override // s0.d
    public final void j() {
        j.a(this.f24051d);
    }

    @Override // s0.d
    public final int k() {
        return this.f24057j;
    }

    @Override // s0.d
    public final void l(h1.c cVar, m mVar, b bVar, C2646H c2646h) {
        Canvas canvasStart = this.f24051d.start(Math.max((int) (this.f24052e >> 32), (int) (this.f24056i >> 32)), Math.max((int) (this.f24052e & 4294967295L), (int) (this.f24056i & 4294967295L)));
        try {
            C2696b c2696b = this.f24049b.f22934a;
            Canvas canvas = c2696b.f22900a;
            c2696b.f22900a = canvasStart;
            C2863b c2863b = this.f24050c;
            o4.f fVar = c2863b.f23803b;
            long jK = W0.e.K(this.f24052e);
            C2862a c2862a = ((C2863b) fVar.f21851d).f23802a;
            h1.c cVar2 = c2862a.f23798a;
            m mVar2 = c2862a.f23799b;
            InterfaceC2712s interfaceC2712sC = fVar.c();
            long jF = fVar.f();
            b bVar2 = (b) fVar.f21849b;
            fVar.m(cVar);
            fVar.n(mVar);
            fVar.l(c2696b);
            fVar.o(jK);
            fVar.f21849b = bVar;
            c2696b.f();
            try {
                c2646h.invoke(c2863b);
                c2696b.r();
                fVar.m(cVar2);
                fVar.n(mVar2);
                fVar.l(interfaceC2712sC);
                fVar.o(jF);
                fVar.f21849b = bVar2;
                c2696b.f22900a = canvas;
                this.f24051d.end(canvasStart);
            } catch (Throwable th) {
                c2696b.r();
                fVar.m(cVar2);
                fVar.n(mVar2);
                fVar.l(interfaceC2712sC);
                fVar.o(jF);
                fVar.f21849b = bVar2;
                throw th;
            }
        } catch (Throwable th2) {
            this.f24051d.end(canvasStart);
            throw th2;
        }
    }

    @Override // s0.d
    public final void m(float f6) {
        this.f24061o = f6;
        this.f24051d.setScaleY(f6);
    }

    @Override // s0.d
    public final void n(int i6, int i7, long j4) {
        int i8 = (int) (j4 >> 32);
        int i9 = (int) (4294967295L & j4);
        this.f24051d.setLeftTopRightBottom(i6, i7, i6 + i8, i7 + i9);
        if (h1.l.a(this.f24052e, j4)) {
            return;
        }
        if (this.f24059m) {
            this.f24051d.setPivotX(i8 / 2.0f);
            this.f24051d.setPivotY(i9 / 2.0f);
        }
        this.f24052e = j4;
    }

    @Override // s0.d
    public final float o() {
        return this.f24068v;
    }

    @Override // s0.d
    public final boolean p() {
        return this.f24051d.isValid();
    }

    @Override // s0.d
    public final float q() {
        return this.f24069w;
    }

    @Override // s0.d
    public final void r(long j4) {
        if ((9223372034707292159L & j4) == 9205357640488583168L) {
            this.f24059m = true;
            this.f24051d.setPivotX(((int) (this.f24052e >> 32)) / 2.0f);
            this.f24051d.setPivotY(((int) (4294967295L & this.f24052e)) / 2.0f);
        } else {
            this.f24059m = false;
            this.f24051d.setPivotX(Float.intBitsToFloat((int) (j4 >> 32)));
            this.f24051d.setPivotY(Float.intBitsToFloat((int) (j4 & 4294967295L)));
        }
    }

    @Override // s0.d
    public final long s() {
        return this.f24065s;
    }

    @Override // s0.d
    public final void t(float f6) {
        this.l = f6;
        this.f24051d.setAlpha(f6);
    }

    @Override // s0.d
    public final float u() {
        return this.f24063q;
    }

    @Override // s0.d
    public final long v() {
        return this.f24066t;
    }

    @Override // s0.d
    public final void w(long j4) {
        if (Build.VERSION.SDK_INT >= 28) {
            this.f24065s = j4;
            k.c(this.f24051d, AbstractC2686D.I(j4));
        }
    }

    @Override // s0.d
    public final void x() {
        P();
    }

    @Override // s0.d
    public final void y(float f6) {
        this.f24060n = f6;
        this.f24051d.setScaleX(f6);
    }

    @Override // s0.d
    public final float z() {
        return this.f24070x;
    }
}
