package o; import android.graphics.Canvas; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Path; import android.graphics.RadialGradient; import android.graphics.RectF; import android.graphics.Region; import android.graphics.Shader; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /* loaded from: classes2.dex */ public final class LbZ { boolean a; @Deprecated public float b; @Deprecated public float c; @Deprecated public float d; @Deprecated public float e; @Deprecated private float f; @Deprecated private float h; private final List i = new ArrayList(); private final List j = new ArrayList(); /* loaded from: classes2.dex */ public static abstract class RVV { protected final Matrix h = new Matrix(); public abstract void Lz_(Matrix matrix, Path path); } public LbZ() { c(BitmapDescriptorFactory.HUE_RED, 270.0f, BitmapDescriptorFactory.HUE_RED); } public final void e(float f, float f2) { IeS ieS = new IeS(); ieS.e = f; ieS.b = f2; this.i.add(ieS); LWm lWm = new LWm(ieS, this.d, this.c); float a = lWm.a(); float a2 = lWm.a() + 270.0f; c(a + 270.0f); this.j.add(lWm); this.h = a2; this.d = f; this.c = f2; } public final void c(float f, float f2, float f3, float f4, float f5, float f6) { Sts sts = new Sts(f, f2, f3, f4); sts.b = f5; sts.a = f6; this.i.add(sts); HBt hBt = new HBt(sts); float f7 = f5 + f6; boolean z = f6 < BitmapDescriptorFactory.HUE_RED; if (z) { f5 = (f5 + 180.0f) % 360.0f; } float f8 = z ? (180.0f + f7) % 360.0f : f7; c(f5); this.j.add(hBt); this.h = f8; double d = f7; this.d = ((f + f3) * 0.5f) + (((f3 - f) / 2.0f) * ((float) Math.cos(Math.toRadians(d)))); this.c = ((f2 + f4) * 0.5f) + (((f4 - f2) / 2.0f) * ((float) Math.sin(Math.toRadians(d)))); } public final void Ls_(Matrix matrix, Path path) { int size = this.i.size(); for (int i = 0; i < size; i++) { this.i.get(i).Lz_(matrix, path); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static abstract class ZqN { static final Matrix a = new Matrix(); final Matrix c = new Matrix(); public abstract void LA_(Matrix matrix, MFB mfb, int i, Canvas canvas); ZqN() { } } /* loaded from: classes2.dex */ static class LWm extends ZqN { private final IeS b; private final float d; private final float e; public LWm(IeS ieS, float f, float f2) { this.b = ieS; this.d = f; this.e = f2; } @Override // o.LbZ.ZqN public final void LA_(Matrix matrix, MFB mfb, int i, Canvas canvas) { RectF rectF = new RectF(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, (float) Math.hypot(this.b.b - this.e, this.b.e - this.d), BitmapDescriptorFactory.HUE_RED); this.c.set(matrix); this.c.preTranslate(this.d, this.e); this.c.preRotate(a()); Matrix matrix2 = this.c; rectF.bottom += i; rectF.offset(BitmapDescriptorFactory.HUE_RED, -i); int[] iArr = MFB.b; iArr[0] = mfb.i; iArr[1] = mfb.j; iArr[2] = mfb.n; mfb.g.setShader(new LinearGradient(rectF.left, rectF.top, rectF.left, rectF.bottom, iArr, MFB.d, Shader.TileMode.CLAMP)); canvas.save(); canvas.concat(matrix2); canvas.drawRect(rectF, mfb.g); canvas.restore(); } final float a() { return (float) Math.toDegrees(Math.atan((this.b.b - this.e) / (this.b.e - this.d))); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static class HBt extends ZqN { private final Sts d; public HBt(Sts sts) { this.d = sts; } @Override // o.LbZ.ZqN public final void LA_(Matrix matrix, MFB mfb, int i, Canvas canvas) { float f = this.d.b; float f2 = this.d.a; RectF rectF = new RectF(this.d.e, this.d.f, this.d.d, this.d.c); boolean z = f2 < BitmapDescriptorFactory.HUE_RED; Path path = mfb.h; if (z) { int[] iArr = MFB.c; iArr[0] = 0; iArr[1] = mfb.i; iArr[2] = mfb.j; iArr[3] = mfb.n; } else { path.rewind(); path.moveTo(rectF.centerX(), rectF.centerY()); path.arcTo(rectF, f, f2); path.close(); float f3 = -i; rectF.inset(f3, f3); int[] iArr2 = MFB.c; iArr2[0] = 0; iArr2[1] = mfb.n; iArr2[2] = mfb.j; iArr2[3] = mfb.i; } float width = rectF.width() / 2.0f; if (width > BitmapDescriptorFactory.HUE_RED) { float f4 = 1.0f - (i / width); float[] fArr = MFB.a; fArr[1] = f4; fArr[2] = ((1.0f - f4) / 2.0f) + f4; mfb.e.setShader(new RadialGradient(rectF.centerX(), rectF.centerY(), width, MFB.c, fArr, Shader.TileMode.CLAMP)); canvas.save(); canvas.concat(matrix); canvas.scale(1.0f, rectF.height() / rectF.width()); if (!z) { canvas.clipPath(path, Region.Op.DIFFERENCE); canvas.drawPath(path, mfb.k); } canvas.drawArc(rectF, f, f2, true, mfb.e); canvas.restore(); } } } /* loaded from: classes2.dex */ public static class IeS extends RVV { float b; float e; @Override // o.LbZ.RVV public final void Lz_(Matrix matrix, Path path) { Matrix matrix2 = this.h; matrix.invert(matrix2); path.transform(matrix2); path.lineTo(this.e, this.b); path.transform(matrix); } } /* loaded from: classes2.dex */ public static class Sts extends RVV { private static final RectF j = new RectF(); @Deprecated public float a; @Deprecated public float b; @Deprecated public float c; @Deprecated public float d; @Deprecated public float e; @Deprecated public float f; public Sts(float f, float f2, float f3, float f4) { this.e = f; this.f = f2; this.d = f3; this.c = f4; } @Override // o.LbZ.RVV public final void Lz_(Matrix matrix, Path path) { Matrix matrix2 = this.h; matrix.invert(matrix2); path.transform(matrix2); RectF rectF = j; rectF.set(this.e, this.f, this.d, this.c); path.arcTo(rectF, this.b, this.a, false); path.transform(matrix); } } private void c(float f) { float f2 = this.h; if (f2 == f) { return; } float f3 = ((f - f2) + 360.0f) % 360.0f; if (f3 > 180.0f) { return; } float f4 = this.d; float f5 = this.c; Sts sts = new Sts(f4, f5, f4, f5); sts.b = this.h; sts.a = f3; this.j.add(new HBt(sts)); this.h = f; } /* JADX INFO: Access modifiers changed from: package-private */ public final ZqN Lt_(Matrix matrix) { c(this.f); return new ZqN(this, new ArrayList(this.j), new Matrix(matrix)) { // from class: o.LbZ.4 private Matrix b; private List d; private LbZ e; { this.e = this; this.d = r2; this.b = r3; } @Override // o.LbZ.ZqN public final void LA_(Matrix matrix2, MFB mfb, int i, Canvas canvas) { Iterator it = this.d.iterator(); while (it.hasNext()) { ((ZqN) it.next()).LA_(this.b, mfb, i, canvas); } } }; } public final void c(float f, float f2, float f3) { this.e = BitmapDescriptorFactory.HUE_RED; this.b = f; this.d = BitmapDescriptorFactory.HUE_RED; this.c = f; this.h = f2; this.f = (f2 + f3) % 360.0f; this.i.clear(); this.j.clear(); this.a = false; } }