86 lines
2.7 KiB
Java
86 lines
2.7 KiB
Java
|
package o;
|
||
|
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import java.io.File;
|
||
|
import java.io.FileOutputStream;
|
||
|
import java.io.OutputStream;
|
||
|
import java.util.concurrent.ExecutorService;
|
||
|
import java.util.concurrent.Executors;
|
||
|
import java.util.concurrent.Future;
|
||
|
|
||
|
/* renamed from: o.GaN, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public final class C0413GaN {
|
||
|
private static final ExecutorService e = Executors.newCachedThreadPool();
|
||
|
|
||
|
public static void e() {
|
||
|
}
|
||
|
|
||
|
C0413GaN() {
|
||
|
}
|
||
|
|
||
|
public static void b(Object obj, String str) {
|
||
|
if (obj == null) {
|
||
|
throw new NullPointerException(str);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public static Bitmap OJ_(Drawable drawable, int i, int i2) {
|
||
|
Rect rect = new Rect();
|
||
|
drawable.copyBounds(rect);
|
||
|
if (rect.isEmpty()) {
|
||
|
rect.set(0, 0, Math.max(i, drawable.getIntrinsicWidth()), Math.max(i2, drawable.getIntrinsicHeight()));
|
||
|
drawable.setBounds(rect);
|
||
|
}
|
||
|
Bitmap createBitmap = Bitmap.createBitmap(rect.width(), rect.height(), Bitmap.Config.ARGB_8888);
|
||
|
drawable.draw(new Canvas(createBitmap));
|
||
|
return createBitmap;
|
||
|
}
|
||
|
|
||
|
public static Future<Void> OK_(Bitmap bitmap, Bitmap.CompressFormat compressFormat, int i, File file) {
|
||
|
return e.submit(new Runnable(file, bitmap, compressFormat, i) { // from class: o.GaN.3
|
||
|
private Bitmap.CompressFormat a;
|
||
|
private Bitmap b;
|
||
|
private int c;
|
||
|
private File d;
|
||
|
|
||
|
{
|
||
|
this.d = file;
|
||
|
this.b = bitmap;
|
||
|
this.a = compressFormat;
|
||
|
this.c = i;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
FileOutputStream fileOutputStream;
|
||
|
try {
|
||
|
this.d.getParentFile().mkdirs();
|
||
|
fileOutputStream = new FileOutputStream(this.d);
|
||
|
} catch (Throwable unused) {
|
||
|
fileOutputStream = null;
|
||
|
}
|
||
|
try {
|
||
|
this.b.compress(this.a, this.c, fileOutputStream);
|
||
|
fileOutputStream.flush();
|
||
|
C0413GaN.d(fileOutputStream);
|
||
|
} catch (Throwable unused2) {
|
||
|
C0413GaN.d(fileOutputStream);
|
||
|
}
|
||
|
}
|
||
|
}, null);
|
||
|
}
|
||
|
|
||
|
static /* synthetic */ void d(OutputStream outputStream) {
|
||
|
if (outputStream != null) {
|
||
|
try {
|
||
|
outputStream.close();
|
||
|
} catch (Exception unused) {
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|