126 lines
4.1 KiB
Java
126 lines
4.1 KiB
Java
package com.bumptech.glide.load.resource.bitmap;
|
|
|
|
import com.bumptech.glide.load.Option;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class DownsampleStrategy {
|
|
public static final DownsampleStrategy a = new FitCenter();
|
|
public static final DownsampleStrategy b = new CenterOutside();
|
|
public static final DownsampleStrategy c;
|
|
public static final DownsampleStrategy d;
|
|
public static final DownsampleStrategy e;
|
|
public static final Option<DownsampleStrategy> f;
|
|
|
|
private static class AtLeast extends DownsampleStrategy {
|
|
AtLeast() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public SampleSizeRounding a(int i, int i2, int i3, int i4) {
|
|
return SampleSizeRounding.QUALITY;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public float b(int i, int i2, int i3, int i4) {
|
|
if (Math.min(i2 / i4, i / i3) == 0) {
|
|
return 1.0f;
|
|
}
|
|
return 1.0f / Integer.highestOneBit(r1);
|
|
}
|
|
}
|
|
|
|
private static class AtMost extends DownsampleStrategy {
|
|
AtMost() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public SampleSizeRounding a(int i, int i2, int i3, int i4) {
|
|
return SampleSizeRounding.MEMORY;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public float b(int i, int i2, int i3, int i4) {
|
|
int ceil = (int) Math.ceil(Math.max(i2 / i4, i / i3));
|
|
return 1.0f / (r2 << (Math.max(1, Integer.highestOneBit(ceil)) >= ceil ? 0 : 1));
|
|
}
|
|
}
|
|
|
|
private static class CenterInside extends DownsampleStrategy {
|
|
CenterInside() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public SampleSizeRounding a(int i, int i2, int i3, int i4) {
|
|
return SampleSizeRounding.QUALITY;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public float b(int i, int i2, int i3, int i4) {
|
|
return Math.min(1.0f, DownsampleStrategy.a.b(i, i2, i3, i4));
|
|
}
|
|
}
|
|
|
|
private static class CenterOutside extends DownsampleStrategy {
|
|
CenterOutside() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public SampleSizeRounding a(int i, int i2, int i3, int i4) {
|
|
return SampleSizeRounding.QUALITY;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public float b(int i, int i2, int i3, int i4) {
|
|
return Math.max(i3 / i, i4 / i2);
|
|
}
|
|
}
|
|
|
|
private static class FitCenter extends DownsampleStrategy {
|
|
FitCenter() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public SampleSizeRounding a(int i, int i2, int i3, int i4) {
|
|
return SampleSizeRounding.QUALITY;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public float b(int i, int i2, int i3, int i4) {
|
|
return Math.min(i3 / i, i4 / i2);
|
|
}
|
|
}
|
|
|
|
private static class None extends DownsampleStrategy {
|
|
None() {
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public SampleSizeRounding a(int i, int i2, int i3, int i4) {
|
|
return SampleSizeRounding.QUALITY;
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.resource.bitmap.DownsampleStrategy
|
|
public float b(int i, int i2, int i3, int i4) {
|
|
return 1.0f;
|
|
}
|
|
}
|
|
|
|
public enum SampleSizeRounding {
|
|
MEMORY,
|
|
QUALITY
|
|
}
|
|
|
|
static {
|
|
new AtLeast();
|
|
new AtMost();
|
|
c = new CenterInside();
|
|
d = new None();
|
|
e = b;
|
|
f = Option.a("com.bumptech.glide.load.resource.bitmap.Downsampler.DownsampleStrategy", e);
|
|
}
|
|
|
|
public abstract SampleSizeRounding a(int i, int i2, int i3, int i4);
|
|
|
|
public abstract float b(int i, int i2, int i3, int i4);
|
|
}
|