package defpackage;

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;

/* renamed from: ʿˇᵗ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0385 {

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public static final Matrix f2220 = new Matrix();

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public Paint f2221;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public int f2222;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final C1913 f2223;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public PathMeasure f2224;

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final Matrix f2225;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public float f2226;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final Path f2227;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public Boolean f2228;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public String f2229;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final C1200 f2230;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final Path f2231;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public float f2232;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public float f2233;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public float f2234;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public Paint f2235;

    public C0385() {
        this.f2225 = new Matrix();
        this.f2234 = 0.0f;
        this.f2226 = 0.0f;
        this.f2232 = 0.0f;
        this.f2233 = 0.0f;
        this.f2222 = 255;
        this.f2229 = null;
        this.f2228 = null;
        this.f2230 = new C1200(0);
        this.f2223 = new C1913();
        this.f2227 = new Path();
        this.f2231 = new Path();
    }

    public C0385(C0385 c0385) {
        this.f2225 = new Matrix();
        this.f2234 = 0.0f;
        this.f2226 = 0.0f;
        this.f2232 = 0.0f;
        this.f2233 = 0.0f;
        this.f2222 = 255;
        this.f2229 = null;
        this.f2228 = null;
        C1200 c1200 = new C1200(0);
        this.f2230 = c1200;
        this.f2223 = new C1913(c0385.f2223, c1200);
        this.f2227 = new Path(c0385.f2227);
        this.f2231 = new Path(c0385.f2231);
        this.f2234 = c0385.f2234;
        this.f2226 = c0385.f2226;
        this.f2232 = c0385.f2232;
        this.f2233 = c0385.f2233;
        this.f2222 = c0385.f2222;
        this.f2229 = c0385.f2229;
        String str = c0385.f2229;
        if (str != null) {
            c1200.put(str, this);
        }
        this.f2228 = c0385.f2228;
    }

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

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

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

    public void setRootAlpha(int i) {
        this.f2222 = i;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m1838(C1913 c1913, Matrix matrix, Canvas canvas, int i, int i2) {
        int i3;
        float f;
        int i4;
        float f2;
        Matrix matrix2 = c1913.f7703;
        ArrayList arrayList = c1913.f7704;
        matrix2.set(matrix);
        Matrix matrix3 = c1913.f7703;
        matrix3.preConcat(c1913.f7705);
        canvas.save();
        char c = 0;
        int i5 = 0;
        while (i5 < arrayList.size()) {
            AbstractC0958 abstractC0958 = (AbstractC0958) arrayList.get(i5);
            if (abstractC0958 instanceof C1913) {
                m1838((C1913) abstractC0958, matrix3, canvas, i, i2);
            } else if (abstractC0958 instanceof AbstractC0242) {
                AbstractC0242 abstractC0242 = (AbstractC0242) abstractC0958;
                float f3 = i / this.f2232;
                float f4 = i2 / this.f2233;
                float fMin = Math.min(f3, f4);
                Matrix matrix4 = this.f2225;
                matrix4.set(matrix3);
                matrix4.postScale(f3, f4);
                float[] fArr = {0.0f, 1.0f, 1.0f, 0.0f};
                matrix3.mapVectors(fArr);
                float fHypot = (float) Math.hypot(fArr[c], fArr[1]);
                boolean z = c;
                i3 = i5;
                float fHypot2 = (float) Math.hypot(fArr[2], fArr[3]);
                float f5 = (fArr[z ? 1 : 0] * fArr[3]) - (fArr[1] * fArr[2]);
                float fMax = Math.max(fHypot, fHypot2);
                float fAbs = fMax > 0.0f ? Math.abs(f5) / fMax : 0.0f;
                if (fAbs != 0.0f) {
                    Path path = this.f2227;
                    path.reset();
                    C2327[] c2327Arr = abstractC0242.f1784;
                    if (c2327Arr != null) {
                        C2327.m6050(c2327Arr, path);
                    }
                    Path path2 = this.f2231;
                    path2.reset();
                    if (abstractC0242 instanceof C4893) {
                        path2.setFillType(abstractC0242.f1783 == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
                        path2.addPath(path, matrix4);
                        canvas.clipPath(path2);
                    } else {
                        C2455 c2455 = (C2455) abstractC0242;
                        float f6 = c2455.f9580;
                        if (f6 != 0.0f || c2455.f9583 != 1.0f) {
                            float f7 = c2455.f9584;
                            float f8 = (f6 + f7) % 1.0f;
                            float f9 = (c2455.f9583 + f7) % 1.0f;
                            if (this.f2224 == null) {
                                this.f2224 = new PathMeasure();
                            }
                            this.f2224.setPath(path, z);
                            float length = this.f2224.getLength();
                            float f10 = f8 * length;
                            float f11 = f9 * length;
                            path.reset();
                            PathMeasure pathMeasure = this.f2224;
                            if (f10 > f11) {
                                pathMeasure.getSegment(f10, length, path, true);
                                f = 0.0f;
                                this.f2224.getSegment(0.0f, f11, path, true);
                            } else {
                                f = 0.0f;
                                pathMeasure.getSegment(f10, f11, path, true);
                            }
                            path.rLineTo(f, f);
                        }
                        path2.addPath(path, matrix4);
                        C4782 c4782 = c2455.f9579;
                        if (((Shader) c4782.f17768) == null && c4782.f17765 == 0) {
                            f2 = 255.0f;
                            i4 = 16777215;
                        } else {
                            if (this.f2221 == null) {
                                i4 = 16777215;
                                Paint paint = new Paint(1);
                                this.f2221 = paint;
                                paint.setStyle(Paint.Style.FILL);
                            } else {
                                i4 = 16777215;
                            }
                            Paint paint2 = this.f2221;
                            Shader shader = (Shader) c4782.f17768;
                            if (shader != null) {
                                shader.setLocalMatrix(matrix4);
                                paint2.setShader(shader);
                                paint2.setAlpha(Math.round(c2455.f9585 * 255.0f));
                                f2 = 255.0f;
                            } else {
                                paint2.setShader(null);
                                paint2.setAlpha(255);
                                int i6 = c4782.f17765;
                                float f12 = c2455.f9585;
                                PorterDuff.Mode mode = C2217.f8709;
                                f2 = 255.0f;
                                paint2.setColor((i6 & i4) | (((int) (Color.alpha(i6) * f12)) << 24));
                            }
                            paint2.setColorFilter(null);
                            path2.setFillType(c2455.f1783 == 0 ? Path.FillType.WINDING : Path.FillType.EVEN_ODD);
                            canvas.drawPath(path2, paint2);
                        }
                        C4782 c47822 = c2455.f9586;
                        if (((Shader) c47822.f17768) != null || c47822.f17765 != 0) {
                            if (this.f2235 == null) {
                                Paint paint3 = new Paint(1);
                                this.f2235 = paint3;
                                paint3.setStyle(Paint.Style.STROKE);
                            }
                            Paint paint4 = this.f2235;
                            Paint.Join join = c2455.f9582;
                            if (join != null) {
                                paint4.setStrokeJoin(join);
                            }
                            Paint.Cap cap = c2455.f9577;
                            if (cap != null) {
                                paint4.setStrokeCap(cap);
                            }
                            paint4.setStrokeMiter(c2455.f9581);
                            Shader shader2 = (Shader) c47822.f17768;
                            if (shader2 != null) {
                                shader2.setLocalMatrix(matrix4);
                                paint4.setShader(shader2);
                                paint4.setAlpha(Math.round(c2455.f9578 * f2));
                            } else {
                                paint4.setShader(null);
                                paint4.setAlpha(255);
                                int i7 = c47822.f17765;
                                float f13 = c2455.f9578;
                                PorterDuff.Mode mode2 = C2217.f8709;
                                paint4.setColor((i7 & i4) | (((int) (Color.alpha(i7) * f13)) << 24));
                            }
                            paint4.setColorFilter(null);
                            paint4.setStrokeWidth(c2455.f9576 * fMin * fAbs);
                            canvas.drawPath(path2, paint4);
                        }
                    }
                }
                i5 = i3 + 1;
                c = 0;
            }
            i3 = i5;
            i5 = i3 + 1;
            c = 0;
        }
        canvas.restore();
    }
}
