package s0;

import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.RecordingCanvas;
import android.graphics.RenderNode;
import android.os.Build;
import h1.m;
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.C2863b;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public g() {
        C2713t c2713t = new C2713t();
        C2863b c2863b = new C2863b();
        this.f24073b = c2713t;
        this.f24074c = c2863b;
        RenderNode renderNodeB = f.b();
        this.f24075d = renderNodeB;
        this.f24076e = 0L;
        renderNodeB.setClipToBounds(false);
        O(renderNodeB, 0);
        this.f24080i = 1.0f;
        this.f24081j = 3;
        this.f24082k = 1.0f;
        this.l = 1.0f;
        long j4 = C2714u.f22935b;
        this.f24086p = j4;
        this.f24087q = j4;
        this.f24091u = 8.0f;
        this.f24096z = 0;
    }

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

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

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

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

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

    @Override // s0.d
    public final void F(long j4) {
        this.f24087q = j4;
        this.f24075d.setSpotShadowColor(AbstractC2686D.I(j4));
    }

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

    @Override // s0.d
    public final void H(C2709o c2709o) {
        this.f24095y = c2709o;
        if (Build.VERSION.SDK_INT >= 31) {
            this.f24075d.setRenderEffect(c2709o != null ? c2709o.a() : null);
        }
    }

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

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

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

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

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

    public final void N() {
        boolean z6 = this.f24092v;
        boolean z7 = false;
        boolean z8 = z6 && !this.f24079h;
        if (z6 && this.f24079h) {
            z7 = true;
        }
        if (z8 != this.f24093w) {
            this.f24093w = z8;
            this.f24075d.setClipToBounds(z8);
        }
        if (z7 != this.f24094x) {
            this.f24094x = z7;
            this.f24075d.setClipToOutline(z7);
        }
    }

    public final void O(RenderNode renderNode, int i6) {
        if (i6 == 1) {
            renderNode.setUseCompositingLayer(true, this.f24077f);
            renderNode.setHasOverlappingRendering(true);
        } else if (i6 == 2) {
            renderNode.setUseCompositingLayer(false, this.f24077f);
            renderNode.setHasOverlappingRendering(false);
        } else {
            renderNode.setUseCompositingLayer(false, this.f24077f);
            renderNode.setHasOverlappingRendering(true);
        }
    }

    public final void P() {
        int i6 = this.f24096z;
        if (i6 != 1 && this.f24081j == 3 && this.f24095y == null) {
            O(this.f24075d, i6);
        } else {
            O(this.f24075d, 1);
        }
    }

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

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

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

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

    @Override // s0.d
    public final void e(float f6) {
        this.f24090t = f6;
        this.f24075d.setRotationZ(f6);
    }

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

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

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

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

    @Override // s0.d
    public final void h(InterfaceC2712s interfaceC2712s) {
        AbstractC2697c.a(interfaceC2712s).drawRenderNode(this.f24075d);
    }

    @Override // s0.d
    public final void i(int i6) {
        this.f24081j = i6;
        Paint paint = this.f24077f;
        if (paint == null) {
            paint = new Paint();
            this.f24077f = paint;
        }
        paint.setBlendMode(AbstractC2686D.E(i6));
        P();
    }

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

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

    @Override // s0.d
    public final void l(h1.c cVar, m mVar, b bVar, C2646H c2646h) {
        C2863b c2863b = this.f24074c;
        RecordingCanvas recordingCanvasBeginRecording = this.f24075d.beginRecording();
        try {
            C2713t c2713t = this.f24073b;
            C2696b c2696b = c2713t.f22934a;
            Canvas canvas = c2696b.f22900a;
            c2696b.f22900a = recordingCanvasBeginRecording;
            o4.f fVar = c2863b.f23803b;
            fVar.m(cVar);
            fVar.n(mVar);
            fVar.f21849b = bVar;
            fVar.o(this.f24076e);
            fVar.l(c2696b);
            c2646h.invoke(c2863b);
            c2713t.f22934a.f22900a = canvas;
        } finally {
            this.f24075d.endRecording();
        }
    }

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

    @Override // s0.d
    public final void n(int i6, int i7, long j4) {
        this.f24075d.setPosition(i6, i7, ((int) (j4 >> 32)) + i6, ((int) (4294967295L & j4)) + i7);
        this.f24076e = W0.e.K(j4);
    }

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

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

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

    @Override // s0.d
    public final void r(long j4) {
        if ((9223372034707292159L & j4) == 9205357640488583168L) {
            this.f24075d.resetPivot();
        } else {
            this.f24075d.setPivotX(Float.intBitsToFloat((int) (j4 >> 32)));
            this.f24075d.setPivotY(Float.intBitsToFloat((int) (j4 & 4294967295L)));
        }
    }

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

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

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

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

    @Override // s0.d
    public final void w(long j4) {
        this.f24086p = j4;
        this.f24075d.setAmbientShadowColor(AbstractC2686D.I(j4));
    }

    @Override // s0.d
    public final void x() {
        Paint paint = this.f24077f;
        if (paint == null) {
            paint = new Paint();
            this.f24077f = paint;
        }
        paint.setColorFilter(null);
        P();
    }

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

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