package o; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.shockwave.pdfium.util.Size; /* loaded from: classes.dex */ public final class Sfj { public C12957fMe a; private boolean b; private IUh c; private float d; public C12957fMe e; private final Size f; private final Size g; private float h; private final Size i; private int j; public Sfj(IUh iUh, Size size, Size size2, Size size3, boolean z, int i) { this.c = iUh; this.g = size; this.f = size2; this.i = size3; this.b = z; this.j = i; int i2 = AnonymousClass2.e[this.c.ordinal()]; if (i2 == 1) { C12957fMe c12957fMe = new C12957fMe((float) Math.floor(r1 / (size2.a / size2.e)), size3.a); this.a = c12957fMe; this.d = c12957fMe.b / size2.a; this.e = new C12957fMe((float) Math.floor(r1 / (size.a / size.e)), size.a * this.d); return; } if (i2 != 2) { C12957fMe c12957fMe2 = new C12957fMe(size3.e, (float) Math.floor(r1 / (size.e / size.a))); this.e = c12957fMe2; this.h = c12957fMe2.a / size.e; this.a = new C12957fMe(size2.e * this.h, (float) Math.floor(r1 / (size2.e / size2.a))); return; } C12957fMe a = a(size2, size2.e * (a(size, size3.e, size3.a).a / size.e), size3.a); this.a = a; this.d = a.b / size2.a; C12957fMe a2 = a(size, size3.e, size.a * this.d); this.e = a2; this.h = a2.a / size.e; } /* renamed from: o.Sfj$2, reason: invalid class name */ /* loaded from: classes.dex */ static /* synthetic */ class AnonymousClass2 { static final int[] e; static { int[] iArr = new int[IUh.values().length]; e = iArr; try { iArr[IUh.HEIGHT.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { e[IUh.BOTH.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } } } private static C12957fMe a(Size size, float f, float f2) { float f3 = size.e / size.a; float floor = (float) Math.floor(f / f3); if (floor > f2) { f = (float) Math.floor(f3 * f2); } else { f2 = floor; } return new C12957fMe(f, f2); } public final C12957fMe c(Size size) { float f; float f2; if (size.e > 0 && size.a > 0) { if (!this.b) { f = (size.e * this.h) - (this.j << 1); } else { f = this.i.e; } int i = size.e; if (!this.b) { f2 = size.a * this.d; } else { f2 = this.i.a; } int i2 = AnonymousClass2.e[this.c.ordinal()]; if (i2 == 1) { return new C12957fMe((float) Math.floor(f2 / (size.a / size.e)), f2); } if (i2 == 2) { return a(size, f, f2); } return new C12957fMe(f, (float) Math.floor(f / (size.e / size.a))); } return new C12957fMe(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); } }