Merge "Don't mark recycled bitmaps as immutable"

This commit is contained in:
Michael Jurka
2013-02-04 17:31:17 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 6 deletions

View File

@@ -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();
}

View File

@@ -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