discord-jadx/app/src/main/java/androidx/core/graphics/drawable/DrawableKt.java

82 lines
3.2 KiB
Java

package androidx.core.graphics.drawable;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import androidx.annotation.Px;
import d0.z.d.m;
/* compiled from: Drawable.kt */
public final class DrawableKt {
/* JADX WARNING: Code restructure failed: missing block: B:4:0x001b, code lost:
if (r0.getConfig() == r9) goto L_0x001d;
*/
public static final Bitmap toBitmap(Drawable drawable, @Px int i, @Px int i2, Bitmap.Config config) {
m.checkParameterIsNotNull(drawable, "$this$toBitmap");
if (drawable instanceof BitmapDrawable) {
if (config != null) {
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
m.checkExpressionValueIsNotNull(bitmap, "bitmap");
}
BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
if (i == bitmapDrawable.getIntrinsicWidth() && i2 == bitmapDrawable.getIntrinsicHeight()) {
Bitmap bitmap2 = bitmapDrawable.getBitmap();
m.checkExpressionValueIsNotNull(bitmap2, "bitmap");
return bitmap2;
}
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(bitmapDrawable.getBitmap(), i, i2, true);
m.checkExpressionValueIsNotNull(createScaledBitmap, "Bitmap.createScaledBitma…map, width, height, true)");
return createScaledBitmap;
}
Rect bounds = drawable.getBounds();
int i3 = bounds.left;
int i4 = bounds.top;
int i5 = bounds.right;
int i6 = bounds.bottom;
if (config == null) {
config = Bitmap.Config.ARGB_8888;
}
Bitmap createBitmap = Bitmap.createBitmap(i, i2, config);
drawable.setBounds(0, 0, i, i2);
drawable.draw(new Canvas(createBitmap));
drawable.setBounds(i3, i4, i5, i6);
m.checkExpressionValueIsNotNull(createBitmap, "bitmap");
return createBitmap;
}
public static /* synthetic */ Bitmap toBitmap$default(Drawable drawable, int i, int i2, Bitmap.Config config, int i3, Object obj) {
if ((i3 & 1) != 0) {
i = drawable.getIntrinsicWidth();
}
if ((i3 & 2) != 0) {
i2 = drawable.getIntrinsicHeight();
}
if ((i3 & 4) != 0) {
config = null;
}
return toBitmap(drawable, i, i2, config);
}
public static final void updateBounds(Drawable drawable, @Px int i, @Px int i2, @Px int i3, @Px int i4) {
m.checkParameterIsNotNull(drawable, "$this$updateBounds");
drawable.setBounds(i, i2, i3, i4);
}
public static /* synthetic */ void updateBounds$default(Drawable drawable, int i, int i2, int i3, int i4, int i5, Object obj) {
if ((i5 & 1) != 0) {
i = drawable.getBounds().left;
}
if ((i5 & 2) != 0) {
i2 = drawable.getBounds().top;
}
if ((i5 & 4) != 0) {
i3 = drawable.getBounds().right;
}
if ((i5 & 8) != 0) {
i4 = drawable.getBounds().bottom;
}
updateBounds(drawable, i, i2, i3, i4);
}
}