package o; import android.graphics.Matrix; import android.graphics.Path; import android.graphics.PointF; import android.graphics.RectF; import com.google.android.gms.maps.model.BitmapDescriptorFactory; /* loaded from: classes2.dex */ public final class EgE { private final LbZ[] b = new LbZ[4]; private final Matrix[] a = new Matrix[4]; private final Matrix[] j = new Matrix[4]; private final PointF g = new PointF(); private final Path i = new Path(); private final Path c = new Path(); private final LbZ m = new LbZ(); private final float[] f = new float[2]; private final float[] l = new float[2]; private final Path h = new Path(); private final Path e = new Path(); private boolean d = true; /* loaded from: classes2.dex */ public interface HBt { void Lq_(LbZ lbZ, Matrix matrix, int i); void Lr_(LbZ lbZ, Matrix matrix, int i); } /* loaded from: classes2.dex */ public static class Sts { public static final EgE a = new EgE(); } public EgE() { for (int i = 0; i < 4; i++) { this.b[i] = new LbZ(); this.a[i] = new Matrix(); this.j[i] = new Matrix(); } } public final void Lp_(FLD fld, float f, RectF rectF, HBt hBt, Path path) { path.rewind(); this.i.rewind(); this.c.rewind(); this.c.addRect(rectF, Path.Direction.CW); IeS ieS = new IeS(fld, f, rectF, hBt, path); for (int i = 0; i < 4; i++) { c(ieS, i); d(i); } for (int i2 = 0; i2 < 4; i2++) { d(ieS, i2); b(ieS, i2); } path.close(); this.i.close(); if (this.i.isEmpty()) { return; } path.op(this.i, Path.Op.UNION); } private void c(IeS ieS, int i) { kdE kde; Spl spl; FLD fld = ieS.b; if (i == 1) { kde = fld.j; } else if (i == 2) { kde = fld.b; } else if (i != 3) { kde = fld.k; } else { kde = fld.n; } FLD fld2 = ieS.b; if (i == 1) { spl = fld2.d; } else if (i == 2) { spl = fld2.a; } else if (i != 3) { spl = fld2.m; } else { spl = fld2.g; } spl.d(this.b[i], ieS.a, kde.Lk_(ieS.e)); float f = ((i + 1) % 4) * 90; this.a[i].reset(); RectF rectF = ieS.e; PointF pointF = this.g; if (i == 1) { pointF.set(rectF.right, rectF.bottom); } else if (i == 2) { pointF.set(rectF.left, rectF.bottom); } else if (i == 3) { pointF.set(rectF.left, rectF.top); } else { pointF.set(rectF.right, rectF.top); } this.a[i].setTranslate(this.g.x, this.g.y); this.a[i].preRotate(f); } private void d(int i) { this.f[0] = this.b[i].d; this.f[1] = this.b[i].c; this.a[i].mapPoints(this.f); this.j[i].reset(); Matrix matrix = this.j[i]; float[] fArr = this.f; matrix.setTranslate(fArr[0], fArr[1]); this.j[i].preRotate(((i + 1) % 4) * 90); } private void d(IeS ieS, int i) { this.f[0] = this.b[i].e; this.f[1] = this.b[i].b; this.a[i].mapPoints(this.f); if (i == 0) { Path path = ieS.c; float[] fArr = this.f; path.moveTo(fArr[0], fArr[1]); } else { Path path2 = ieS.c; float[] fArr2 = this.f; path2.lineTo(fArr2[0], fArr2[1]); } this.b[i].Ls_(this.a[i], ieS.c); if (ieS.d != null) { ieS.d.Lq_(this.b[i], this.a[i], i); } } private void b(IeS ieS, int i) { float abs; C10853eQp c10853eQp; int i2 = (i + 1) % 4; this.f[0] = this.b[i].d; this.f[1] = this.b[i].c; this.a[i].mapPoints(this.f); this.l[0] = this.b[i2].e; this.l[1] = this.b[i2].b; this.a[i2].mapPoints(this.l); float f = this.f[0]; float[] fArr = this.l; float max = Math.max(((float) Math.hypot(f - fArr[0], r1[1] - fArr[1])) - 0.001f, BitmapDescriptorFactory.HUE_RED); RectF rectF = ieS.e; this.f[0] = this.b[i].d; this.f[1] = this.b[i].c; this.a[i].mapPoints(this.f); if (i == 1 || i == 3) { abs = Math.abs(rectF.centerX() - this.f[0]); } else { abs = Math.abs(rectF.centerY() - this.f[1]); } this.m.c(BitmapDescriptorFactory.HUE_RED, 270.0f, BitmapDescriptorFactory.HUE_RED); FLD fld = ieS.b; if (i == 1) { c10853eQp = fld.e; } else if (i == 2) { c10853eQp = fld.f; } else if (i != 3) { c10853eQp = fld.i; } else { c10853eQp = fld.h; } c10853eQp.c(max, abs, ieS.a, this.m); this.h.reset(); this.m.Ls_(this.j[i], this.h); if (this.d && (Lo_(this.h, i) || Lo_(this.h, i2))) { Path path = this.h; path.op(path, this.c, Path.Op.DIFFERENCE); this.f[0] = this.m.e; this.f[1] = this.m.b; this.j[i].mapPoints(this.f); Path path2 = this.i; float[] fArr2 = this.f; path2.moveTo(fArr2[0], fArr2[1]); this.m.Ls_(this.j[i], this.i); } else { this.m.Ls_(this.j[i], ieS.c); } if (ieS.d != null) { ieS.d.Lr_(this.m, this.j[i], i); } } private boolean Lo_(Path path, int i) { this.e.reset(); this.b[i].Ls_(this.a[i], this.e); RectF rectF = new RectF(); path.computeBounds(rectF, true); this.e.computeBounds(rectF, true); path.op(this.e, Path.Op.INTERSECT); path.computeBounds(rectF, true); if (rectF.isEmpty()) { return rectF.width() > 1.0f && rectF.height() > 1.0f; } return true; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class IeS { public final float a; public final FLD b; public final Path c; public final HBt d; public final RectF e; IeS(FLD fld, float f, RectF rectF, HBt hBt, Path path) { this.d = hBt; this.b = fld; this.a = f; this.e = rectF; this.c = path; } } }