Skip to content

Commit

Permalink
Remove deprecated DISALLOW_HARDWARE DecodeFormat.
Browse files Browse the repository at this point in the history
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198569187
  • Loading branch information
sjudd committed Jun 22, 2018
1 parent c3328fe commit 7eb59f7
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 20 deletions.
13 changes: 1 addition & 12 deletions library/src/main/java/com/bumptech/glide/load/DecodeFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ public Resource<Bitmap> 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,
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 7eb59f7

Please sign in to comment.