Throw if BitmapFactory.Options.inBitmap is HARDWARE
Test: BitmapRegionDecoderTest#testHardwareBitmapIn bug:34415265 Change-Id: I58061504dd42ba918f89e1e5daf668f7601ca8d3
This commit is contained in:
committed by
Sergey Vasilinets
parent
5dab2f297c
commit
08beea71c9
@@ -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 " +
|
||||
|
||||
Reference in New Issue
Block a user