package v1;

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 c3.r;
import c3.s;
import c3.t;
import s1.a0;
import s1.b0;
import s1.g0;
import s1.h0;
import s1.i0;
import s1.m1;
import s1.u;
import v1.b;

/* loaded from: classes.dex */
public final class f implements d {
    private boolean A;
    private int B;
    private boolean C;

    /* renamed from: b, reason: collision with root package name */
    private final long f38914b;

    /* renamed from: c, reason: collision with root package name */
    private final b0 f38915c;

    /* renamed from: d, reason: collision with root package name */
    private final u1.a f38916d;

    /* renamed from: e, reason: collision with root package name */
    private final RenderNode f38917e;

    /* renamed from: f, reason: collision with root package name */
    private long f38918f;

    /* renamed from: g, reason: collision with root package name */
    private Paint f38919g;

    /* renamed from: h, reason: collision with root package name */
    private Matrix f38920h;

    /* renamed from: i, reason: collision with root package name */
    private boolean f38921i;

    /* renamed from: j, reason: collision with root package name */
    private float f38922j;

    /* renamed from: k, reason: collision with root package name */
    private int f38923k;

    /* renamed from: l, reason: collision with root package name */
    private h0 f38924l;

    /* renamed from: m, reason: collision with root package name */
    private long f38925m;

    /* renamed from: n, reason: collision with root package name */
    private float f38926n;

    /* renamed from: o, reason: collision with root package name */
    private float f38927o;

    /* renamed from: p, reason: collision with root package name */
    private float f38928p;

    /* renamed from: q, reason: collision with root package name */
    private float f38929q;

    /* renamed from: r, reason: collision with root package name */
    private float f38930r;

    /* renamed from: s, reason: collision with root package name */
    private long f38931s;

    /* renamed from: t, reason: collision with root package name */
    private long f38932t;

    /* renamed from: u, reason: collision with root package name */
    private float f38933u;

    /* renamed from: v, reason: collision with root package name */
    private float f38934v;

    /* renamed from: w, reason: collision with root package name */
    private float f38935w;

    /* renamed from: x, reason: collision with root package name */
    private float f38936x;

    /* renamed from: y, reason: collision with root package name */
    private boolean f38937y;

    /* renamed from: z, reason: collision with root package name */
    private boolean f38938z;

    public f(long j10, b0 b0Var, u1.a aVar) {
        this.f38914b = j10;
        this.f38915c = b0Var;
        this.f38916d = aVar;
        RenderNode renderNode = new RenderNode("graphicsLayer");
        this.f38917e = renderNode;
        this.f38918f = r1.m.f34339b.b();
        renderNode.setClipToBounds(false);
        b.a aVar2 = b.f38879a;
        P(renderNode, aVar2.a());
        this.f38922j = 1.0f;
        this.f38923k = u.f35333a.B();
        this.f38925m = r1.g.f34318b.b();
        this.f38926n = 1.0f;
        this.f38927o = 1.0f;
        g0.a aVar3 = g0.f35254b;
        this.f38931s = aVar3.a();
        this.f38932t = aVar3.a();
        this.f38936x = 8.0f;
        this.B = aVar2.a();
        this.C = true;
    }

    private final void O() {
        boolean z10 = Q() && !this.f38921i;
        boolean z11 = Q() && this.f38921i;
        if (z10 != this.f38938z) {
            this.f38938z = z10;
            this.f38917e.setClipToBounds(z10);
        }
        if (z11 != this.A) {
            this.A = z11;
            this.f38917e.setClipToOutline(z11);
        }
    }

    private final void P(RenderNode renderNode, int i10) {
        b.a aVar = b.f38879a;
        if (b.e(i10, aVar.c())) {
            renderNode.setUseCompositingLayer(true, this.f38919g);
            renderNode.setHasOverlappingRendering(true);
        } else if (b.e(i10, aVar.b())) {
            renderNode.setUseCompositingLayer(false, this.f38919g);
            renderNode.setHasOverlappingRendering(false);
        } else {
            renderNode.setUseCompositingLayer(false, this.f38919g);
            renderNode.setHasOverlappingRendering(true);
        }
    }

    private final boolean R() {
        if (b.e(w(), b.f38879a.c()) || S()) {
            return true;
        }
        s();
        return false;
    }

    private final boolean S() {
        return (u.E(q(), u.f35333a.B()) && g() == null) ? false : true;
    }

    private final void T() {
        if (R()) {
            P(this.f38917e, b.f38879a.c());
        } else {
            P(this.f38917e, w());
        }
    }

    @Override // v1.d
    public void A(long j10) {
        this.f38931s = j10;
        this.f38917e.setAmbientShadowColor(i0.j(j10));
    }

    @Override // v1.d
    public void B(long j10) {
        this.f38925m = j10;
        if (r1.h.d(j10)) {
            this.f38917e.resetPivot();
        } else {
            this.f38917e.setPivotX(r1.g.m(j10));
            this.f38917e.setPivotY(r1.g.n(j10));
        }
    }

    @Override // v1.d
    public long C() {
        return this.f38931s;
    }

    @Override // v1.d
    public float D() {
        return this.f38936x;
    }

    @Override // v1.d
    public float E() {
        return this.f38928p;
    }

    @Override // v1.d
    public void F(boolean z10) {
        this.f38937y = z10;
        O();
    }

    @Override // v1.d
    public float G() {
        return this.f38933u;
    }

    @Override // v1.d
    public void H(long j10) {
        this.f38932t = j10;
        this.f38917e.setSpotShadowColor(i0.j(j10));
    }

    @Override // v1.d
    public void I(a0 a0Var) {
        s1.c.d(a0Var).drawRenderNode(this.f38917e);
    }

    @Override // v1.d
    public float J() {
        return this.f38927o;
    }

    @Override // v1.d
    public long K() {
        return this.f38932t;
    }

    @Override // v1.d
    public void L(int i10) {
        this.B = i10;
        T();
    }

    @Override // v1.d
    public Matrix M() {
        Matrix matrix = this.f38920h;
        if (matrix == null) {
            matrix = new Matrix();
            this.f38920h = matrix;
        }
        this.f38917e.getMatrix(matrix);
        return matrix;
    }

    @Override // v1.d
    public float N() {
        return this.f38930r;
    }

    public boolean Q() {
        return this.f38937y;
    }

    @Override // v1.d
    public void a(float f10) {
        this.f38922j = f10;
        this.f38917e.setAlpha(f10);
    }

    @Override // v1.d
    public float b() {
        return this.f38922j;
    }

    @Override // v1.d
    public void c(float f10) {
        this.f38934v = f10;
        this.f38917e.setRotationY(f10);
    }

    @Override // v1.d
    public void d(float f10) {
        this.f38935w = f10;
        this.f38917e.setRotationZ(f10);
    }

    @Override // v1.d
    public void e(float f10) {
        this.f38929q = f10;
        this.f38917e.setTranslationY(f10);
    }

    @Override // v1.d
    public void f(float f10) {
        this.f38927o = f10;
        this.f38917e.setScaleY(f10);
    }

    @Override // v1.d
    public h0 g() {
        return this.f38924l;
    }

    @Override // v1.d
    public void h() {
        this.f38917e.discardDisplayList();
    }

    @Override // v1.d
    public void i(float f10) {
        this.f38926n = f10;
        this.f38917e.setScaleX(f10);
    }

    @Override // v1.d
    public void j(float f10) {
        this.f38928p = f10;
        this.f38917e.setTranslationX(f10);
    }

    @Override // v1.d
    public void k(m1 m1Var) {
        if (Build.VERSION.SDK_INT >= 31) {
            m.f38944a.a(this.f38917e, m1Var);
        }
    }

    @Override // v1.d
    public void l(float f10) {
        this.f38936x = f10;
        this.f38917e.setCameraDistance(f10);
    }

    @Override // v1.d
    public void m(float f10) {
        this.f38933u = f10;
        this.f38917e.setRotationX(f10);
    }

    @Override // v1.d
    public float n() {
        return this.f38926n;
    }

    @Override // v1.d
    public void o(float f10) {
        this.f38930r = f10;
        this.f38917e.setElevation(f10);
    }

    @Override // v1.d
    public boolean p() {
        return this.f38917e.hasDisplayList();
    }

    @Override // v1.d
    public int q() {
        return this.f38923k;
    }

    @Override // v1.d
    public void r(boolean z10) {
        this.C = z10;
    }

    @Override // v1.d
    public m1 s() {
        return null;
    }

    @Override // v1.d
    public void t(Outline outline, long j10) {
        this.f38917e.setOutline(outline);
        this.f38921i = outline != null;
        O();
    }

    @Override // v1.d
    public float u() {
        return this.f38934v;
    }

    @Override // v1.d
    public float v() {
        return this.f38935w;
    }

    @Override // v1.d
    public int w() {
        return this.B;
    }

    @Override // v1.d
    public void x(c3.d dVar, t tVar, c cVar, dn.l lVar) {
        RecordingCanvas beginRecording = this.f38917e.beginRecording();
        try {
            b0 b0Var = this.f38915c;
            Canvas b10 = b0Var.a().b();
            b0Var.a().z(beginRecording);
            s1.b a10 = b0Var.a();
            u1.d Q0 = this.f38916d.Q0();
            Q0.a(dVar);
            Q0.c(tVar);
            Q0.e(cVar);
            Q0.g(this.f38918f);
            Q0.d(a10);
            lVar.invoke(this.f38916d);
            b0Var.a().z(b10);
            this.f38917e.endRecording();
            r(false);
        } catch (Throwable th2) {
            this.f38917e.endRecording();
            throw th2;
        }
    }

    @Override // v1.d
    public float y() {
        return this.f38929q;
    }

    @Override // v1.d
    public void z(int i10, int i11, long j10) {
        this.f38917e.setPosition(i10, i11, r.g(j10) + i10, r.f(j10) + i11);
        this.f38918f = s.d(j10);
    }

    public /* synthetic */ f(long j10, b0 b0Var, u1.a aVar, int i10, kotlin.jvm.internal.k kVar) {
        this(j10, (i10 & 2) != 0 ? new b0() : b0Var, (i10 & 4) != 0 ? new u1.a() : aVar);
    }
}
