OSDN Git Service

Doc fix: add more detail to BitmapFactory.Options.inPurgeable flag.
authorAdam Koch <akoch@google.com>
Tue, 5 Nov 2013 15:42:48 +0000 (10:42 -0500)
committerAdam Koch <akoch@google.com>
Wed, 6 Nov 2013 01:18:05 +0000 (01:18 +0000)
Bug: 6064760

Change-Id: I3fd833a3205be451ff6548fab3555d170c9c570e
(cherry picked from commit e1693df494dbdedfb5eac56bf59f86afc893b778)

graphics/java/android/graphics/BitmapFactory.java

index 6fd1763..429be49 100644 (file)
@@ -259,14 +259,26 @@ public class BitmapFactory {
          * (e.g. the bitmap is drawn, getPixels() is called), they will be
          * automatically re-decoded.
          *
-         * For the re-decode to happen, the bitmap must have access to the
+         * <p>For the re-decode to happen, the bitmap must have access to the
          * encoded data, either by sharing a reference to the input
          * or by making a copy of it. This distinction is controlled by
          * inInputShareable. If this is true, then the bitmap may keep a shallow
          * reference to the input. If this is false, then the bitmap will
          * explicitly make a copy of the input data, and keep that. Even if
          * sharing is allowed, the implementation may still decide to make a
-         * deep copy of the input data.
+         * deep copy of the input data.</p>
+         *
+         * <p>While inPurgeable can help avoid big Dalvik heap allocations (from
+         * API level 11 onward), it sacrifices performance predictability since any
+         * image that the view system tries to draw may incur a decode delay which
+         * can lead to dropped frames. Therefore, most apps should avoid using
+         * inPurgeable to allow for a fast and fluid UI. To minimize Dalvik heap
+         * allocations use the {@link #inBitmap} flag instead.</p>
+         *
+         * <p class="note"><strong>Note:</strong> This flag is ignored when used
+         * with {@link #decodeResource(Resources, int,
+         * android.graphics.BitmapFactory.Options)} or {@link #decodeFile(String,
+         * android.graphics.BitmapFactory.Options)}.</p>
          */
         public boolean inPurgeable;