package t3;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathMeasure;
import android.graphics.PorterDuff;
import android.graphics.Shader;
import java.util.ArrayList;

/* JADX INFO: loaded from: classes.dex */
public final class m {

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public static final Matrix f32904p = new Matrix();

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Path f32905a;

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

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

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

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

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final j f32911g;

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final androidx.collection.f f32919o;

    public m() {
        this.f32907c = new Matrix();
        this.f32912h = 0.0f;
        this.f32913i = 0.0f;
        this.f32914j = 0.0f;
        this.f32915k = 0.0f;
        this.f32916l = 255;
        this.f32917m = null;
        this.f32918n = null;
        this.f32919o = new androidx.collection.f();
        this.f32911g = new j();
        this.f32905a = new Path();
        this.f32906b = new Path();
    }

    public final void a(j jVar, Matrix matrix, Canvas canvas, int i10, int i11) {
        int i12;
        float f10;
        jVar.f32888a.set(matrix);
        Matrix matrix2 = jVar.f32897j;
        Matrix matrix3 = jVar.f32888a;
        matrix3.preConcat(matrix2);
        canvas.save();
        char c6 = 0;
        int i13 = 0;
        while (true) {
            ArrayList arrayList = jVar.f32889b;
            if (i13 >= arrayList.size()) {
                canvas.restore();
                return;
            }
            k kVar = (k) arrayList.get(i13);
            if (kVar instanceof j) {
                a((j) kVar, matrix3, canvas, i10, i11);
            } else {
                if (kVar instanceof l) {
                    l lVar = (l) kVar;
                    float f11 = i10 / this.f32914j;
                    float f12 = i11 / this.f32915k;
                    float fMin = Math.min(f11, f12);
                    Matrix matrix4 = this.f32907c;
                    matrix4.set(matrix3);
                    matrix4.postScale(f11, f12);
                    float[] fArr = {0.0f, 1.0f, 1.0f, 0.0f};
                    matrix3.mapVectors(fArr);
                    float fHypot = (float) Math.hypot(fArr[c6], fArr[1]);
                    i12 = i13;
                    float fHypot2 = (float) Math.hypot(fArr[2], fArr[3]);
                    float f13 = (fArr[0] * fArr[3]) - (fArr[1] * fArr[2]);
                    float fMax = Math.max(fHypot, fHypot2);
                    float fAbs = fMax > 0.0f ? Math.abs(f13) / fMax : 0.0f;
                    if (fAbs != 0.0f) {
                        lVar.getClass();
                        Path path = this.f32905a;
                        path.reset();
                        j0.f[] fVarArr = lVar.f32900a;
                        if (fVarArr != null) {
                            j0.f.b(fVarArr, path);
                        }
                        Path path2 = this.f32906b;
                        path2.reset();
                        if (lVar instanceof h) {
                            path2.setFillType(lVar.f32902c == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
                            path2.addPath(path, matrix4);
                            canvas.clipPath(path2);
                        } else {
                            i iVar = (i) lVar;
                            float f14 = iVar.f32882j;
                            if (f14 != 0.0f || iVar.f32883k != 1.0f) {
                                float f15 = iVar.f32884l;
                                float f16 = (f14 + f15) % 1.0f;
                                float f17 = (iVar.f32883k + f15) % 1.0f;
                                if (this.f32910f == null) {
                                    this.f32910f = new PathMeasure();
                                }
                                this.f32910f.setPath(path, false);
                                float length = this.f32910f.getLength();
                                float f18 = f16 * length;
                                float f19 = f17 * length;
                                path.reset();
                                if (f18 > f19) {
                                    this.f32910f.getSegment(f18, length, path, true);
                                    f10 = 0.0f;
                                    this.f32910f.getSegment(0.0f, f19, path, true);
                                } else {
                                    f10 = 0.0f;
                                    this.f32910f.getSegment(f18, f19, path, true);
                                }
                                path.rLineTo(f10, f10);
                            }
                            path2.addPath(path, matrix4);
                            i0.d dVar = iVar.f32879g;
                            if ((dVar.f26487a == null && dVar.f26489c == 0) ? false : true) {
                                if (this.f32909e == null) {
                                    Paint paint = new Paint(1);
                                    this.f32909e = paint;
                                    paint.setStyle(Paint.Style.FILL);
                                }
                                Paint paint2 = this.f32909e;
                                if (dVar.f26487a != null) {
                                    Shader shader = dVar.getShader();
                                    shader.setLocalMatrix(matrix4);
                                    paint2.setShader(shader);
                                    paint2.setAlpha(Math.round(iVar.f32881i * 255.0f));
                                } else {
                                    paint2.setShader(null);
                                    paint2.setAlpha(255);
                                    int i14 = dVar.f26489c;
                                    float f20 = iVar.f32881i;
                                    PorterDuff.Mode mode = p.f32933j;
                                    paint2.setColor((i14 & 16777215) | (((int) (Color.alpha(i14) * f20)) << 24));
                                }
                                paint2.setColorFilter(null);
                                path2.setFillType(iVar.f32902c == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
                                canvas.drawPath(path2, paint2);
                            }
                            i0.d dVar2 = iVar.f32877e;
                            if (dVar2.f26487a != null || dVar2.f26489c != 0) {
                                if (this.f32908d == null) {
                                    Paint paint3 = new Paint(1);
                                    this.f32908d = paint3;
                                    paint3.setStyle(Paint.Style.STROKE);
                                }
                                Paint paint4 = this.f32908d;
                                Paint.Join join = iVar.f32886n;
                                if (join != null) {
                                    paint4.setStrokeJoin(join);
                                }
                                Paint.Cap cap = iVar.f32885m;
                                if (cap != null) {
                                    paint4.setStrokeCap(cap);
                                }
                                paint4.setStrokeMiter(iVar.f32887o);
                                if (dVar2.f26487a != null) {
                                    Shader shader2 = dVar2.getShader();
                                    shader2.setLocalMatrix(matrix4);
                                    paint4.setShader(shader2);
                                    paint4.setAlpha(Math.round(iVar.f32880h * 255.0f));
                                } else {
                                    paint4.setShader(null);
                                    paint4.setAlpha(255);
                                    int i15 = dVar2.f26489c;
                                    float f21 = iVar.f32880h;
                                    PorterDuff.Mode mode2 = p.f32933j;
                                    paint4.setColor((i15 & 16777215) | (((int) (Color.alpha(i15) * f21)) << 24));
                                }
                                paint4.setColorFilter(null);
                                paint4.setStrokeWidth(iVar.f32878f * fAbs * fMin);
                                canvas.drawPath(path2, paint4);
                            }
                        }
                    }
                }
                i13 = i12 + 1;
                c6 = 0;
            }
            i12 = i13;
            i13 = i12 + 1;
            c6 = 0;
        }
    }

    public float getAlpha() {
        return getRootAlpha() / 255.0f;
    }

    public int getRootAlpha() {
        return this.f32916l;
    }

    public void setAlpha(float f10) {
        setRootAlpha((int) (f10 * 255.0f));
    }

    public void setRootAlpha(int i10) {
        this.f32916l = i10;
    }

    public m(m mVar) {
        this.f32907c = new Matrix();
        this.f32912h = 0.0f;
        this.f32913i = 0.0f;
        this.f32914j = 0.0f;
        this.f32915k = 0.0f;
        this.f32916l = 255;
        this.f32917m = null;
        this.f32918n = null;
        androidx.collection.f fVar = new androidx.collection.f(0);
        this.f32919o = fVar;
        this.f32911g = new j(mVar.f32911g, fVar);
        this.f32905a = new Path(mVar.f32905a);
        this.f32906b = new Path(mVar.f32906b);
        this.f32912h = mVar.f32912h;
        this.f32913i = mVar.f32913i;
        this.f32914j = mVar.f32914j;
        this.f32915k = mVar.f32915k;
        this.f32916l = mVar.f32916l;
        this.f32917m = mVar.f32917m;
        String str = mVar.f32917m;
        if (str != null) {
            fVar.put(str, this);
        }
        this.f32918n = mVar.f32918n;
    }
}
