207 lines
6.4 KiB
Java
207 lines
6.4 KiB
Java
package o;
|
|
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import com.google.zxing.NotFoundException;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public final class RHW {
|
|
private final int a;
|
|
private final int b;
|
|
private final int c;
|
|
private final C8902dZc d;
|
|
private final int e;
|
|
private final int h;
|
|
private final int i;
|
|
|
|
public RHW(C8902dZc c8902dZc, int i, int i2, int i3) throws NotFoundException {
|
|
this.d = c8902dZc;
|
|
int i4 = c8902dZc.c;
|
|
this.b = i4;
|
|
int i5 = c8902dZc.e;
|
|
this.h = i5;
|
|
int i6 = i / 2;
|
|
int i7 = i2 - i6;
|
|
this.e = i7;
|
|
int i8 = i2 + i6;
|
|
this.c = i8;
|
|
int i9 = i3 - i6;
|
|
this.i = i9;
|
|
int i10 = i3 + i6;
|
|
this.a = i10;
|
|
if (i9 < 0 || i7 < 0 || i10 >= i4 || i8 >= i5) {
|
|
throw NotFoundException.b();
|
|
}
|
|
}
|
|
|
|
public final qCz[] a() throws NotFoundException {
|
|
int i = this.e;
|
|
int i2 = this.c;
|
|
int i3 = this.i;
|
|
int i4 = this.a;
|
|
boolean z = false;
|
|
boolean z2 = false;
|
|
boolean z3 = false;
|
|
boolean z4 = false;
|
|
boolean z5 = false;
|
|
boolean z6 = true;
|
|
while (z6) {
|
|
boolean z7 = false;
|
|
boolean z8 = true;
|
|
while (true) {
|
|
if ((z8 || !z2) && i2 < this.h) {
|
|
z8 = e(i3, i4, i2, false);
|
|
if (z8) {
|
|
i2++;
|
|
z2 = true;
|
|
z7 = true;
|
|
} else if (!z2) {
|
|
i2++;
|
|
}
|
|
}
|
|
}
|
|
if (i2 < this.h) {
|
|
boolean z9 = true;
|
|
while (true) {
|
|
if ((z9 || !z3) && i4 < this.b) {
|
|
z9 = e(i, i2, i4, true);
|
|
if (z9) {
|
|
i4++;
|
|
z3 = true;
|
|
z7 = true;
|
|
} else if (!z3) {
|
|
i4++;
|
|
}
|
|
}
|
|
}
|
|
if (i4 < this.b) {
|
|
boolean z10 = true;
|
|
while (true) {
|
|
if ((z10 || !z5) && i >= 0) {
|
|
z10 = e(i3, i4, i, false);
|
|
if (z10) {
|
|
i--;
|
|
z5 = true;
|
|
z7 = true;
|
|
} else if (!z5) {
|
|
i--;
|
|
}
|
|
}
|
|
}
|
|
if (i >= 0) {
|
|
z6 = z7;
|
|
boolean z11 = true;
|
|
while (true) {
|
|
if ((z11 || !z4) && i3 >= 0) {
|
|
z11 = e(i, i2, i3, true);
|
|
if (z11) {
|
|
i3--;
|
|
z6 = true;
|
|
z4 = true;
|
|
} else if (!z4) {
|
|
i3--;
|
|
}
|
|
}
|
|
}
|
|
if (i3 < 0) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
z = true;
|
|
break;
|
|
}
|
|
if (z) {
|
|
throw NotFoundException.b();
|
|
}
|
|
int i5 = i2 - i;
|
|
qCz qcz = null;
|
|
qCz qcz2 = null;
|
|
for (int i6 = 1; qcz2 == null && i6 < i5; i6++) {
|
|
qcz2 = e(i, i4 - i6, i + i6, i4);
|
|
}
|
|
if (qcz2 == null) {
|
|
throw NotFoundException.b();
|
|
}
|
|
qCz qcz3 = null;
|
|
for (int i7 = 1; qcz3 == null && i7 < i5; i7++) {
|
|
qcz3 = e(i, i3 + i7, i + i7, i3);
|
|
}
|
|
if (qcz3 == null) {
|
|
throw NotFoundException.b();
|
|
}
|
|
qCz qcz4 = null;
|
|
for (int i8 = 1; qcz4 == null && i8 < i5; i8++) {
|
|
qcz4 = e(i2, i3 + i8, i2 - i8, i3);
|
|
}
|
|
if (qcz4 == null) {
|
|
throw NotFoundException.b();
|
|
}
|
|
for (int i9 = 1; qcz == null && i9 < i5; i9++) {
|
|
qcz = e(i2, i4 - i9, i2 - i9, i4);
|
|
}
|
|
if (qcz == null) {
|
|
throw NotFoundException.b();
|
|
}
|
|
return d(qcz, qcz2, qcz4, qcz3);
|
|
}
|
|
|
|
private boolean e(int i, int i2, int i3, boolean z) {
|
|
if (z) {
|
|
while (i <= i2) {
|
|
if (this.d.b(i, i3)) {
|
|
return true;
|
|
}
|
|
i++;
|
|
}
|
|
return false;
|
|
}
|
|
while (i <= i2) {
|
|
if (this.d.b(i3, i)) {
|
|
return true;
|
|
}
|
|
i++;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public RHW(C8902dZc c8902dZc) throws NotFoundException {
|
|
this(c8902dZc, 10, c8902dZc.e / 2, c8902dZc.c / 2);
|
|
}
|
|
|
|
private qCz[] d(qCz qcz, qCz qcz2, qCz qcz3, qCz qcz4) {
|
|
float f = qcz.a;
|
|
float f2 = qcz.e;
|
|
float f3 = qcz2.a;
|
|
float f4 = qcz2.e;
|
|
float f5 = qcz3.a;
|
|
float f6 = qcz3.e;
|
|
float f7 = qcz4.a;
|
|
float f8 = qcz4.e;
|
|
if (f < this.h / 2.0f) {
|
|
return new qCz[]{new qCz(f7 - 1.0f, f8 + 1.0f), new qCz(f3 + 1.0f, f4 + 1.0f), new qCz(f5 - 1.0f, f6 - 1.0f), new qCz(f + 1.0f, f2 - 1.0f)};
|
|
}
|
|
return new qCz[]{new qCz(f7 + 1.0f, f8 + 1.0f), new qCz(f3 + 1.0f, f4 - 1.0f), new qCz(f5 - 1.0f, f6 + 1.0f), new qCz(f - 1.0f, f2 - 1.0f)};
|
|
}
|
|
|
|
private qCz e(float f, float f2, float f3, float f4) {
|
|
double d = f - f3;
|
|
double d2 = f2 - f4;
|
|
float sqrt = (float) Math.sqrt((d * d) + (d2 * d2));
|
|
int i = (int) (sqrt + (sqrt < BitmapDescriptorFactory.HUE_RED ? -0.5f : 0.5f));
|
|
float f5 = i;
|
|
float f6 = (f3 - f) / f5;
|
|
float f7 = (f4 - f2) / f5;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
float f8 = i2;
|
|
float f9 = (f8 * f6) + f;
|
|
int i3 = (int) (f9 + (f9 < BitmapDescriptorFactory.HUE_RED ? -0.5f : 0.5f));
|
|
float f10 = (f8 * f7) + f2;
|
|
int i4 = (int) (f10 + (f10 < BitmapDescriptorFactory.HUE_RED ? -0.5f : 0.5f));
|
|
if (this.d.b(i3, i4)) {
|
|
return new qCz(i3, i4);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|