package o; /* renamed from: o.hpa, reason: case insensitive filesystem */ /* loaded from: classes2.dex */ public final class C15699hpa extends AbstractC13394fZQ { private final int b; private final int d; private final int e; private final byte[] g; private final int h; public C15699hpa(byte[] bArr, int i, int i2, int i3, int i4) { super(i3, i4); if (i3 > i || i4 > i2) { throw new IllegalArgumentException("Crop rectangle does not fit within image data."); } this.g = bArr; this.e = i; this.d = i2; this.b = 0; this.h = 0; } @Override // o.AbstractC13394fZQ public final byte[] c() { int i = this.a; int i2 = this.c; int i3 = this.e; if (i == i3 && i2 == this.d) { return this.g; } int i4 = i * i2; byte[] bArr = new byte[i4]; int i5 = (this.h * i3) + this.b; if (i == i3) { System.arraycopy(this.g, i5, bArr, 0, i4); return bArr; } for (int i6 = 0; i6 < i2; i6++) { System.arraycopy(this.g, i5, bArr, i6 * i, i); i5 += this.e; } return bArr; } @Override // o.AbstractC13394fZQ public final byte[] a(int i, byte[] bArr) { if (i < 0 || i >= this.c) { throw new IllegalArgumentException("Requested row is outside the image: ".concat(String.valueOf(i))); } int i2 = this.a; if (bArr == null || bArr.length < i2) { bArr = new byte[i2]; } System.arraycopy(this.g, i * this.e, bArr, 0, i2); return bArr; } }