200 lines
7.5 KiB
Java
200 lines
7.5 KiB
Java
package o;
|
|
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Matrix;
|
|
import android.graphics.Rect;
|
|
import android.graphics.RectF;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import com.github.barteksc.pdfviewer.PDFView;
|
|
import com.github.barteksc.pdfviewer.exception.PageRenderingException;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
import com.shockwave.pdfium.PdfiumCore;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Cci extends Handler {
|
|
private Matrix a;
|
|
private Rect b;
|
|
private RectF c;
|
|
PDFView d;
|
|
public boolean e;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public Cci(Looper looper, PDFView pDFView) {
|
|
super(looper);
|
|
this.c = new RectF();
|
|
this.b = new Rect();
|
|
this.a = new Matrix();
|
|
this.e = false;
|
|
this.d = pDFView;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final void Gs_(int i, float f, float f2, RectF rectF, boolean z, int i2, boolean z2, boolean z3) {
|
|
sendMessage(obtainMessage(1, new LWm(this, f, f2, rectF, i, z, i2, false, false)));
|
|
}
|
|
|
|
@Override // android.os.Handler
|
|
public final void handleMessage(Message message) {
|
|
try {
|
|
Xsy d = d((LWm) message.obj);
|
|
if (d != null) {
|
|
if (this.e) {
|
|
this.d.post(new Runnable(this, d) { // from class: o.Cci.3
|
|
private Xsy a;
|
|
private Cci e;
|
|
|
|
{
|
|
this.e = this;
|
|
this.a = d;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
PDFView pDFView = this.e.d;
|
|
Xsy xsy = this.a;
|
|
if (pDFView.G == PDFView.IeS.LOADED) {
|
|
pDFView.G = PDFView.IeS.SHOWN;
|
|
Gyh gyh = pDFView.g;
|
|
int i = pDFView.y.f;
|
|
}
|
|
if (xsy.e) {
|
|
C13256fVZ c13256fVZ = pDFView.c;
|
|
synchronized (c13256fVZ.a) {
|
|
while (c13256fVZ.a.size() >= 8) {
|
|
c13256fVZ.a.remove(0).d.recycle();
|
|
}
|
|
List<Xsy> list = c13256fVZ.a;
|
|
Iterator<Xsy> it = list.iterator();
|
|
while (true) {
|
|
if (it.hasNext()) {
|
|
if (it.next().equals(xsy)) {
|
|
xsy.d.recycle();
|
|
break;
|
|
}
|
|
} else {
|
|
list.add(xsy);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
C13256fVZ c13256fVZ2 = pDFView.c;
|
|
synchronized (c13256fVZ2.d) {
|
|
synchronized (c13256fVZ2.d) {
|
|
while (c13256fVZ2.e.size() + c13256fVZ2.c.size() >= 120 && !c13256fVZ2.c.isEmpty()) {
|
|
c13256fVZ2.c.poll().d.recycle();
|
|
}
|
|
while (c13256fVZ2.e.size() + c13256fVZ2.c.size() >= 120 && !c13256fVZ2.e.isEmpty()) {
|
|
c13256fVZ2.e.poll().d.recycle();
|
|
}
|
|
}
|
|
c13256fVZ2.e.offer(xsy);
|
|
}
|
|
}
|
|
pDFView.invalidate();
|
|
}
|
|
});
|
|
} else {
|
|
d.d.recycle();
|
|
}
|
|
}
|
|
} catch (PageRenderingException e) {
|
|
this.d.post(new Runnable(this, e) { // from class: o.Cci.5
|
|
private PageRenderingException c;
|
|
private Cci e;
|
|
|
|
{
|
|
this.e = this;
|
|
this.c = e;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
PDFView pDFView = this.e.d;
|
|
PageRenderingException pageRenderingException = this.c;
|
|
Gyh gyh = pDFView.g;
|
|
int i = pageRenderingException.b;
|
|
pageRenderingException.getCause();
|
|
vuB vub = gyh.h;
|
|
int i2 = pageRenderingException.b;
|
|
pageRenderingException.getCause();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
private Xsy d(LWm lWm) throws PageRenderingException {
|
|
msi msiVar = this.d.y;
|
|
msiVar.e(lWm.h);
|
|
int round = Math.round(lWm.g);
|
|
int round2 = Math.round(lWm.e);
|
|
if (round == 0 || round2 == 0) {
|
|
return null;
|
|
}
|
|
if (!msiVar.a.get(msiVar.a(lWm.h), false)) {
|
|
return null;
|
|
}
|
|
try {
|
|
Bitmap createBitmap = Bitmap.createBitmap(round, round2, lWm.b ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
|
|
RectF rectF = lWm.c;
|
|
this.a.reset();
|
|
float f = round;
|
|
float f2 = round2;
|
|
this.a.postTranslate((-rectF.left) * f, (-rectF.top) * f2);
|
|
this.a.postScale(1.0f / rectF.width(), 1.0f / rectF.height());
|
|
this.c.set(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, f, f2);
|
|
this.a.mapRect(this.c);
|
|
this.c.round(this.b);
|
|
int i = lWm.h;
|
|
Rect rect = this.b;
|
|
boolean z = lWm.a;
|
|
int a = msiVar.a(i);
|
|
PdfiumCore pdfiumCore = msiVar.i;
|
|
C12960fMh c12960fMh = msiVar.h;
|
|
int i2 = rect.left;
|
|
int i3 = rect.top;
|
|
int width = rect.width();
|
|
int height = rect.height();
|
|
synchronized (PdfiumCore.e) {
|
|
try {
|
|
pdfiumCore.nativeRenderPageBitmap(c12960fMh.e.get(Integer.valueOf(a)).longValue(), createBitmap, pdfiumCore.b, i2, i3, width, height, z);
|
|
} catch (NullPointerException | Exception unused) {
|
|
}
|
|
}
|
|
return new Xsy(lWm.h, createBitmap, lWm.c, lWm.j, lWm.d);
|
|
} catch (IllegalArgumentException unused2) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes.dex */
|
|
public class LWm {
|
|
boolean a;
|
|
boolean b;
|
|
RectF c;
|
|
int d;
|
|
float e;
|
|
float g;
|
|
int h;
|
|
private Cci i;
|
|
boolean j;
|
|
|
|
LWm(Cci cci, float f, float f2, RectF rectF, int i, boolean z, int i2, boolean z2, boolean z3) {
|
|
this.i = cci;
|
|
this.h = i;
|
|
this.g = f;
|
|
this.e = f2;
|
|
this.c = rectF;
|
|
this.j = z;
|
|
this.d = i2;
|
|
this.b = z2;
|
|
this.a = z3;
|
|
}
|
|
}
|
|
}
|