summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2010-12-08 17:56:36 -0800
committerChet Haase <chet@google.com>2010-12-09 15:07:39 -0800
commit37f74cad46c6f1799aec3c52e8f47598237f43d4 (patch)
tree3730bc3cde3e7fc2eaca6a83b9dd19596379de2f /graphics
parent792be60c8675f40ddc1f25d90ffd43692d6eaf44 (diff)
downloadframeworks_base-37f74cad46c6f1799aec3c52e8f47598237f43d4.zip
frameworks_base-37f74cad46c6f1799aec3c52e8f47598237f43d4.tar.gz
frameworks_base-37f74cad46c6f1799aec3c52e8f47598237f43d4.tar.bz2
Add ability to reuse bitmaps when loading new content
Change-Id: Ic5f5f40ee39787403977fb372b335dc21cf07243
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 66f8f70..f6a9c63 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -43,6 +43,26 @@ public class BitmapFactory {
}
/**
+ * If set, decode methods that take the Options object will attempt to
+ * reuse this bitmap when loading content. This is a hint to the decoder
+ * only, and the decoder may choose to create a new Bitmap instead. The
+ * current implementation necessitates that the reused bitmap be of the
+ * same size as the source content and in jpeg 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.
+ *
+ * <p>You should still always use the returned Bitmap of the decode
+ * method and not assume that reusing the bitmap worked, due to the
+ * constraints outlined above and failure situations that can occur.
+ * Checking whether the return value matches the value of the inBitmap
+ * set in the Options structure is a way to see if the bitmap was reused,
+ * but in all cases you should use the returned Bitmap to make sure
+ * that you are using the bitmap that was used as the decode destination.</p>
+ */
+ public Bitmap inBitmap;
+
+ /**
* If set to true, the decoder will return null (no bitmap), but
* the out... fields will still be set, allowing the caller to query
* the bitmap without having to allocate the memory for its pixels.