what-the-bank/sources/o/msi.java

266 lines
7.2 KiB
Java

package o;
import android.util.SparseBooleanArray;
import com.github.barteksc.pdfviewer.exception.PageRenderingException;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.shockwave.pdfium.PdfiumCore;
import com.shockwave.pdfium.util.Size;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/* loaded from: classes.dex */
public final class msi {
private static final Object m = new Object();
public boolean c;
public int f;
C12960fMh h;
PdfiumCore i;
private Size k;
private boolean l;
private final boolean n;
/* renamed from: o, reason: collision with root package name */
private Size f9218o;
private final IUh p;
private int[] q;
private int r;
private int u;
private int w;
private int x;
private List<Size> s = new ArrayList();
public List<C12957fMe> g = new ArrayList();
SparseBooleanArray a = new SparseBooleanArray();
public C12957fMe e = new C12957fMe(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
public C12957fMe d = new C12957fMe(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
public List<Float> j = new ArrayList();
private List<Float> t = new ArrayList();
public float b = BitmapDescriptorFactory.HUE_RED;
/* JADX INFO: Access modifiers changed from: package-private */
public msi(PdfiumCore pdfiumCore, C12960fMh c12960fMh, IUh iUh, Size size, int[] iArr, boolean z, int i, int i2, int i3, int i4, boolean z2, boolean z3) {
this.f = 0;
this.f9218o = new Size(0, 0);
this.k = new Size(0, 0);
this.i = pdfiumCore;
this.h = c12960fMh;
this.p = iUh;
this.q = iArr;
this.c = z;
this.w = i;
this.x = i2;
this.u = i3;
this.r = i4;
this.l = z2;
this.n = z3;
if (iArr != null) {
this.f = iArr.length;
} else {
this.f = pdfiumCore.c(c12960fMh);
}
for (int i5 = 0; i5 < this.f; i5++) {
Size c = this.i.c(this.h, a(i5));
if (c.e > this.f9218o.e) {
this.f9218o = c;
}
if (c.a > this.k.a) {
this.k = c;
}
this.s.add(c);
}
c(size);
}
public final void c(Size size) {
this.g.clear();
Sfj sfj = new Sfj(this.p, this.f9218o, this.k, size, this.n, this.r);
this.d = sfj.e;
this.e = sfj.a;
Iterator<Size> it = this.s.iterator();
while (it.hasNext()) {
this.g.add(sfj.c(it.next()));
}
if (this.l) {
e(size);
}
a();
d();
}
private void e(Size size) {
float f;
float f2;
this.t.clear();
for (int i = 0; i < this.f; i++) {
C12957fMe c12957fMe = this.g.get(i);
if (this.c) {
f = size.a;
f2 = c12957fMe.b;
} else {
f = size.e;
f2 = c12957fMe.a;
}
float max = Math.max(BitmapDescriptorFactory.HUE_RED, f - f2);
if (i < this.f - 1) {
max += this.w;
}
this.t.add(Float.valueOf(max));
}
}
private void d() {
float f;
float f2;
this.j.clear();
float f3 = this.x;
for (int i = 0; i < this.f; i++) {
C12957fMe c12957fMe = this.g.get(i);
if (this.c) {
f = c12957fMe.b;
} else {
f = c12957fMe.a;
}
if (this.l) {
f3 += this.t.get(i).floatValue() / 2.0f;
if (i == 0) {
f3 -= this.w / 2.0f;
} else if (i == this.f - 1) {
f3 += this.w / 2.0f;
}
this.j.add(Float.valueOf(f3));
f2 = this.t.get(i).floatValue() / 2.0f;
} else {
this.j.add(Float.valueOf(f3));
f2 = this.w;
}
f3 += f + f2;
}
}
private float a(int i, float f) {
return (this.l ? this.t.get(i).floatValue() : this.w) * f;
}
public final boolean e(int i) throws PageRenderingException {
int a = a(i);
if (a < 0) {
return false;
}
synchronized (m) {
if (this.a.indexOfKey(a) >= 0) {
return false;
}
try {
this.i.d(this.h, a);
this.a.put(a, true);
return true;
} catch (Exception e) {
this.a.put(a, false);
throw new PageRenderingException(i, e);
}
}
}
public final void c() {
C12960fMh c12960fMh;
PdfiumCore pdfiumCore = this.i;
if (pdfiumCore != null && (c12960fMh = this.h) != null) {
pdfiumCore.a(c12960fMh);
}
this.h = null;
this.q = null;
}
public final int d(int i) {
int i2;
if (i <= 0) {
return 0;
}
int[] iArr = this.q;
if (iArr != null) {
if (i < iArr.length) {
return i;
}
i2 = iArr.length;
} else {
int i3 = this.f;
if (i < i3) {
return i;
}
i2 = i3;
}
return i2 - 1;
}
public final int a(int i) {
int i2;
int[] iArr = this.q;
if (iArr == null) {
i2 = i;
} else {
if (i < 0 || i >= iArr.length) {
return -1;
}
i2 = iArr[i];
}
if (i2 < 0 || i >= this.f) {
return -1;
}
return i2;
}
private void a() {
float f;
float f2;
float f3 = BitmapDescriptorFactory.HUE_RED;
for (int i = 0; i < this.f; i++) {
C12957fMe c12957fMe = this.g.get(i);
if (this.c) {
f = c12957fMe.b;
} else {
f = c12957fMe.a;
}
f3 += f;
if (this.l) {
f2 = this.t.get(i).floatValue();
} else if (i < this.f - 1) {
f2 = this.w;
}
f3 += f2;
}
this.b = f3 + this.x + this.u;
}
public final int b(float f, float f2) {
int i = 0;
for (int i2 = 0; i2 < this.f && (this.j.get(i2).floatValue() * f2) - (a(i2, f2) / 2.0f) < f; i2++) {
i++;
}
int i3 = i - 1;
if (i3 >= 0) {
return i3;
}
return 0;
}
public final float b(int i, float f) {
C12957fMe c12957fMe;
float f2;
float f3;
if (a(i) < 0) {
c12957fMe = new C12957fMe(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
} else {
c12957fMe = this.g.get(i);
}
boolean z = this.c;
if (z) {
f2 = (z ? this.d : this.e).a;
f3 = c12957fMe.a;
} else {
f2 = (z ? this.d : this.e).b;
f3 = c12957fMe.b;
}
return (f * (f2 - f3)) / 2.0f;
}
}