package p3; import android.graphics.Matrix; import android.graphics.Path; import android.graphics.PointF; import android.graphics.RectF; /* loaded from: classes2.dex */ public class l { /* renamed from: a, reason: collision with root package name */ private final m[] f13195a = new m[4]; /* renamed from: b, reason: collision with root package name */ private final Matrix[] f13196b = new Matrix[4]; /* renamed from: c, reason: collision with root package name */ private final Matrix[] f13197c = new Matrix[4]; /* renamed from: d, reason: collision with root package name */ private final PointF f13198d = new PointF(); /* renamed from: e, reason: collision with root package name */ private final m f13199e = new m(); /* renamed from: f, reason: collision with root package name */ private final float[] f13200f = new float[2]; /* renamed from: g, reason: collision with root package name */ private final float[] f13201g = new float[2]; public interface a { void a(m mVar, Matrix matrix, int i10); void b(m mVar, Matrix matrix, int i10); } static final class b { /* renamed from: a, reason: collision with root package name */ public final k f13202a; /* renamed from: b, reason: collision with root package name */ public final Path f13203b; /* renamed from: c, reason: collision with root package name */ public final RectF f13204c; /* renamed from: d, reason: collision with root package name */ public final a f13205d; /* renamed from: e, reason: collision with root package name */ public final float f13206e; b(k kVar, float f10, RectF rectF, a aVar, Path path) { this.f13205d = aVar; this.f13202a = kVar; this.f13206e = f10; this.f13204c = rectF; this.f13203b = path; } } public l() { for (int i10 = 0; i10 < 4; i10++) { this.f13195a[i10] = new m(); this.f13196b[i10] = new Matrix(); this.f13197c[i10] = new Matrix(); } } private float a(int i10) { return (i10 + 1) * 90; } private void b(b bVar, int i10) { this.f13200f[0] = this.f13195a[i10].j(); this.f13200f[1] = this.f13195a[i10].k(); this.f13196b[i10].mapPoints(this.f13200f); if (i10 == 0) { Path path = bVar.f13203b; float[] fArr = this.f13200f; path.moveTo(fArr[0], fArr[1]); } else { Path path2 = bVar.f13203b; float[] fArr2 = this.f13200f; path2.lineTo(fArr2[0], fArr2[1]); } this.f13195a[i10].d(this.f13196b[i10], bVar.f13203b); a aVar = bVar.f13205d; if (aVar != null) { aVar.b(this.f13195a[i10], this.f13196b[i10], i10); } } private void c(b bVar, int i10) { int i11 = (i10 + 1) % 4; this.f13200f[0] = this.f13195a[i10].h(); this.f13200f[1] = this.f13195a[i10].i(); this.f13196b[i10].mapPoints(this.f13200f); this.f13201g[0] = this.f13195a[i11].j(); this.f13201g[1] = this.f13195a[i11].k(); this.f13196b[i11].mapPoints(this.f13201g); float f10 = this.f13200f[0]; float[] fArr = this.f13201g; float max = Math.max(((float) Math.hypot(f10 - fArr[0], r0[1] - fArr[1])) - 0.001f, 0.0f); float i12 = i(bVar.f13204c, i10); this.f13199e.m(0.0f, 0.0f); j(i10, bVar.f13202a).a(max, i12, bVar.f13206e, this.f13199e); this.f13199e.d(this.f13197c[i10], bVar.f13203b); a aVar = bVar.f13205d; if (aVar != null) { aVar.a(this.f13199e, this.f13197c[i10], i10); } } private void f(int i10, RectF rectF, PointF pointF) { if (i10 == 1) { pointF.set(rectF.right, rectF.bottom); return; } if (i10 == 2) { pointF.set(rectF.left, rectF.bottom); } else if (i10 != 3) { pointF.set(rectF.right, rectF.top); } else { pointF.set(rectF.left, rectF.top); } } private c g(int i10, k kVar) { return i10 != 1 ? i10 != 2 ? i10 != 3 ? kVar.t() : kVar.r() : kVar.j() : kVar.l(); } private d h(int i10, k kVar) { return i10 != 1 ? i10 != 2 ? i10 != 3 ? kVar.s() : kVar.q() : kVar.i() : kVar.k(); } private float i(RectF rectF, int i10) { float[] fArr = this.f13200f; m mVar = this.f13195a[i10]; fArr[0] = mVar.f13209c; fArr[1] = mVar.f13210d; this.f13196b[i10].mapPoints(fArr); return (i10 == 1 || i10 == 3) ? Math.abs(rectF.centerX() - this.f13200f[0]) : Math.abs(rectF.centerY() - this.f13200f[1]); } private f j(int i10, k kVar) { return i10 != 1 ? i10 != 2 ? i10 != 3 ? kVar.o() : kVar.p() : kVar.n() : kVar.h(); } private void k(b bVar, int i10) { h(i10, bVar.f13202a).b(this.f13195a[i10], 90.0f, bVar.f13206e, bVar.f13204c, g(i10, bVar.f13202a)); float a10 = a(i10); this.f13196b[i10].reset(); f(i10, bVar.f13204c, this.f13198d); Matrix matrix = this.f13196b[i10]; PointF pointF = this.f13198d; matrix.setTranslate(pointF.x, pointF.y); this.f13196b[i10].preRotate(a10); } private void l(int i10) { this.f13200f[0] = this.f13195a[i10].h(); this.f13200f[1] = this.f13195a[i10].i(); this.f13196b[i10].mapPoints(this.f13200f); float a10 = a(i10); this.f13197c[i10].reset(); Matrix matrix = this.f13197c[i10]; float[] fArr = this.f13200f; matrix.setTranslate(fArr[0], fArr[1]); this.f13197c[i10].preRotate(a10); } public void d(k kVar, float f10, RectF rectF, Path path) { e(kVar, f10, rectF, null, path); } public void e(k kVar, float f10, RectF rectF, a aVar, Path path) { path.rewind(); b bVar = new b(kVar, f10, rectF, aVar, path); for (int i10 = 0; i10 < 4; i10++) { k(bVar, i10); l(i10); } for (int i11 = 0; i11 < 4; i11++) { b(bVar, i11); c(bVar, i11); } path.close(); } }