diff options
| -rw-r--r-- | graphics/java/android/graphics/BitmapFactory.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java index 3b272c8ddec7..ffb39e339119 100644 --- a/graphics/java/android/graphics/BitmapFactory.java +++ b/graphics/java/android/graphics/BitmapFactory.java @@ -433,10 +433,15 @@ public class BitmapFactory { static void validate(Options opts) { if (opts == null) return; - if (opts.inMutable && opts.inPreferredConfig == Bitmap.Config.HARDWARE) { + if (opts.inBitmap != null && opts.inBitmap.getConfig() == Bitmap.Config.HARDWARE) { throw new IllegalArgumentException("Bitmaps with Config.HARWARE are always immutable"); } + if (opts.inMutable && opts.inPreferredConfig == Bitmap.Config.HARDWARE) { + throw new IllegalArgumentException("Bitmaps with Config.HARDWARE cannot be " + + "decoded into - they are immutable"); + } + if (opts.inPreferredColorSpace != null) { if (!(opts.inPreferredColorSpace instanceof ColorSpace.Rgb)) { throw new IllegalArgumentException("The destination color space must use the " + |