Skip to content

Commit 2cd953c

Browse files
committed
Add an in config set for RGBA_F16 in SizeConfigStrategy.
1 parent 73277df commit 2cd953c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

library/src/main/java/com/bumptech/glide/load/engine/bitmap_recycle/SizeConfigStrategy.java

+19
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@
2626
@RequiresApi(Build.VERSION_CODES.KITKAT)
2727
public class SizeConfigStrategy implements LruPoolStrategy {
2828
private static final int MAX_SIZE_MULTIPLE = 8;
29+
30+
// TODO: This can probably be combined with ARGB_8888, it's separate only because we haven't
31+
// yet tested ARGB_8888/RGBA_F16 re-use thoroughly yet.
32+
private static final Bitmap.Config[] RGBA_F16_IN_CONFIGS;
33+
static {
34+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
35+
RGBA_F16_IN_CONFIGS = new Bitmap.Config[] { Bitmap.Config.RGBA_F16 };
36+
} else {
37+
// THis will never be used pre O.
38+
RGBA_F16_IN_CONFIGS = new Bitmap.Config[0];
39+
}
40+
}
41+
2942
private static final Bitmap.Config[] ARGB_8888_IN_CONFIGS =
3043
new Bitmap.Config[] {
3144
Bitmap.Config.ARGB_8888,
@@ -232,6 +245,12 @@ static String getBitmapString(int size, Bitmap.Config config) {
232245
}
233246

234247
private static Bitmap.Config[] getInConfigs(Bitmap.Config requested) {
248+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
249+
if (Bitmap.Config.RGBA_F16.equals(requested)) { // NOPMD - Avoid short circuiting sdk checks.
250+
return RGBA_F16_IN_CONFIGS;
251+
}
252+
}
253+
235254
switch (requested) {
236255
case ARGB_8888:
237256
return ARGB_8888_IN_CONFIGS;

0 commit comments

Comments
 (0)