From 7eb59f7f217adc7b0e017d586ea0814bf75c53d0 Mon Sep 17 00:00:00 2001 From: judds Date: Wed, 30 May 2018 09:09:31 -0700 Subject: [PATCH] Remove deprecated DISALLOW_HARDWARE DecodeFormat. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=198569187 --- .../java/com/bumptech/glide/load/DecodeFormat.java | 13 +------------ .../glide/load/engine/prefill/BitmapPreFiller.java | 1 - .../glide/load/resource/bitmap/Downsampler.java | 4 ---- .../load/resource/bitmap/HardwareConfigState.java | 1 - .../load/engine/prefill/BitmapPreFillerTest.java | 4 ++-- 5 files changed, 3 insertions(+), 20 deletions(-) diff --git a/library/src/main/java/com/bumptech/glide/load/DecodeFormat.java b/library/src/main/java/com/bumptech/glide/load/DecodeFormat.java index 8cf2058f58..3fac0791c5 100644 --- a/library/src/main/java/com/bumptech/glide/load/DecodeFormat.java +++ b/library/src/main/java/com/bumptech/glide/load/DecodeFormat.java @@ -27,17 +27,6 @@ public enum DecodeFormat { */ PREFER_ARGB_8888, - /** - * Identical to {@link #PREFER_ARGB_8888} but prevents Glide from using {@link - * android.graphics.Bitmap.Config#HARDWARE} on Android O+. - * - * @deprecated If you must disable hardware bitmaps, set - * {@link com.bumptech.glide.load.resource.bitmap.Downsampler#ALLOW_HARDWARE_CONFIG} to false - * instead. - */ - @Deprecated - PREFER_ARGB_8888_DISALLOW_HARDWARE, - /** * Bitmaps decoded from image formats that support and/or use alpha (some types of PNGs, GIFs etc) * should return {@link android.graphics.Bitmap.Config#ARGB_8888} for @@ -53,5 +42,5 @@ public enum DecodeFormat { /** * The default value for DecodeFormat. */ - public static final DecodeFormat DEFAULT = PREFER_ARGB_8888_DISALLOW_HARDWARE; + public static final DecodeFormat DEFAULT = PREFER_ARGB_8888; } diff --git a/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFiller.java b/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFiller.java index 9ddc221edf..09d00876db 100644 --- a/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFiller.java +++ b/library/src/main/java/com/bumptech/glide/load/engine/prefill/BitmapPreFiller.java @@ -43,7 +43,6 @@ public void preFill(PreFillType.Builder... bitmapAttributeBuilders) { if (builder.getConfig() == null) { builder.setConfig( defaultFormat == DecodeFormat.PREFER_ARGB_8888 - || defaultFormat == DecodeFormat.PREFER_ARGB_8888_DISALLOW_HARDWARE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565); } bitmapAttributes[i] = builder.build(); diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/Downsampler.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/Downsampler.java index 8fdb968598..140b83decc 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/Downsampler.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/Downsampler.java @@ -201,9 +201,6 @@ public Resource decode(InputStream is, int requestedWidth, int requested boolean fixBitmapToRequestedDimensions = options.get(FIX_BITMAP_SIZE_TO_REQUESTED_DIMENSIONS); boolean isHardwareConfigAllowed = options.get(ALLOW_HARDWARE_CONFIG) != null && options.get(ALLOW_HARDWARE_CONFIG); - if (decodeFormat == DecodeFormat.PREFER_ARGB_8888_DISALLOW_HARDWARE) { - isHardwareConfigAllowed = false; - } try { Bitmap result = decodeFromWrappedStreams(is, bitmapFactoryOptions, @@ -525,7 +522,6 @@ private void calculateConfig( // Changing configs can cause skewing on 4.1, see issue #128. if (format == DecodeFormat.PREFER_ARGB_8888 - || format == DecodeFormat.PREFER_ARGB_8888_DISALLOW_HARDWARE || Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN) { optionsWithScaling.inPreferredConfig = Bitmap.Config.ARGB_8888; return; diff --git a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/HardwareConfigState.java b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/HardwareConfigState.java index fe7c0357d2..1991d205ff 100644 --- a/library/src/main/java/com/bumptech/glide/load/resource/bitmap/HardwareConfigState.java +++ b/library/src/main/java/com/bumptech/glide/load/resource/bitmap/HardwareConfigState.java @@ -82,7 +82,6 @@ boolean setHardwareConfigIfAllowed( boolean isExifOrientationRequired) { if (!isHardwareConfigAllowed || Build.VERSION.SDK_INT < Build.VERSION_CODES.O - || decodeFormat == DecodeFormat.PREFER_ARGB_8888_DISALLOW_HARDWARE || isExifOrientationRequired) { return false; } diff --git a/library/test/src/test/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillerTest.java b/library/test/src/test/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillerTest.java index 15bf84671f..d5a777f697 100644 --- a/library/test/src/test/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillerTest.java +++ b/library/test/src/test/java/com/bumptech/glide/load/engine/prefill/BitmapPreFillerTest.java @@ -269,8 +269,8 @@ public void testSetsConfigOnBuildersToDefaultIfNotSet() { bitmapPreFiller.preFill(builder); InOrder order = inOrder(builder); - order.verify(builder).setConfig(DecodeFormat.DEFAULT == DecodeFormat.PREFER_ARGB_8888 - || DecodeFormat.DEFAULT == DecodeFormat.PREFER_ARGB_8888_DISALLOW_HARDWARE + order.verify(builder).setConfig( + DecodeFormat.DEFAULT == DecodeFormat.PREFER_ARGB_8888 ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565); order.verify(builder).build(); }