summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/jni/android/graphics/BitmapFactory.cpp2
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java12
2 files changed, 8 insertions, 6 deletions
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 1fb8c91feacb..b7fdecf9b7b4 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -384,7 +384,7 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
return nullObjectReturn("Got null SkPixelRef");
}
- if (!isMutable) {
+ if (!isMutable && !useExistingBitmap) {
// promise we will never change our pixels (great for sharing and pictures)
pr->setImmutable();
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 381e65bfc7d9..905dc8ef1ac4 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -49,12 +49,14 @@ public class BitmapFactory {
* If set, decode methods that take the Options object will attempt to
* reuse this bitmap when loading content. If the decode operation cannot
* use this bitmap, the decode method will return <code>null</code> and
- * will throw an IllegalArgumentException. The
- * current implementation necessitates that the reused bitmap be of the
- * same size as the source content and in jpeg or png format (whether as a
- * resource or as a stream). The {@link android.graphics.Bitmap.Config
+ * will throw an IllegalArgumentException. The current implementation
+ * necessitates that the reused bitmap be mutable and of the same size as the
+ * source content. The source content must be in jpeg or png format (whether as
+ * a resource or as a stream). The {@link android.graphics.Bitmap.Config
* configuration} of the reused bitmap will override the setting of
- * {@link #inPreferredConfig}, if set.
+ * {@link #inPreferredConfig}, if set. The reused bitmap will continue to
+ * remain mutable even when decoding a resource which would normally result
+ * in an immutable bitmap.
*
* <p>You should still always use the returned Bitmap of the decode
* method and not assume that reusing the bitmap worked, due to the