summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2009-06-01 15:49:32 -0700
committerWei-Ta Chen <weita@google.com>2009-06-02 11:01:43 -0700
commiteb949674fd3b83b706f795fc6b16ab1c66250c93 (patch)
tree4c58350eef523e46bcd26423a15aaa109779988f
parent30b70cec05190c8fcfa5aeb175a37bf81ed3966d (diff)
downloadframeworks_base-eb949674fd3b83b706f795fc6b16ab1c66250c93.zip
frameworks_base-eb949674fd3b83b706f795fc6b16ab1c66250c93.tar.gz
frameworks_base-eb949674fd3b83b706f795fc6b16ab1c66250c93.tar.bz2
Unhide inPurgeable in BitmapFactory.Options.
The correctness and effectiveness of the usage of the parameter are evaluated in: https://android-git.corp.google.com/g/Gerrit#change,2768
-rw-r--r--api/current.xml10
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java42
2 files changed, 30 insertions, 22 deletions
diff --git a/api/current.xml b/api/current.xml
index d1d57ad..3a31034 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -48699,6 +48699,16 @@
visibility="public"
>
</field>
+<field name="inPurgeable"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="inSampleSize"
type="int"
transient="false"
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 9e88d7e..141cc68 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -18,18 +18,18 @@ package android.graphics;
import android.content.res.AssetManager;
import android.content.res.Resources;
-import android.util.TypedValue;
import android.util.DisplayMetrics;
+import android.util.TypedValue;
import java.io.BufferedInputStream;
+import java.io.FileDescriptor;
import java.io.FileInputStream;
-import java.io.InputStream;
import java.io.IOException;
-import java.io.FileDescriptor;
+import java.io.InputStream;
/**
- * Creates Bitmap objects from various sources, including files, streams,
- * and byte-arrays.
+ * Creates Bitmap objects from various sources, including files, streams,
+ * and byte-arrays.
*/
public class BitmapFactory {
public static class Options {
@@ -62,7 +62,7 @@ public class BitmapFactory {
* Also, powers of 2 are often faster/easier for the decoder to honor.
*/
public int inSampleSize;
-
+
/**
* If this is non-null, the decoder will try to decode into this
* internal configuration. If it is null, or the request cannot be met,
@@ -71,7 +71,7 @@ public class BitmapFactory {
* as if it has per-pixel alpha (requiring a config that also does).
*/
public Bitmap.Config inPreferredConfig;
-
+
/**
* If dither is true, the decoder will atttempt to dither the decoded
* image.
@@ -117,8 +117,6 @@ public class BitmapFactory {
* 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.
- *
- * @hide pending API council approval
*/
public boolean inPurgeable;
@@ -151,12 +149,12 @@ public class BitmapFactory {
* If not know, or there is an error, it is set to null.
*/
public String outMimeType;
-
+
/**
* Temp storage to use for decoding. Suggest 16K or so.
*/
public byte[] inTempStorage;
-
+
private native void requestCancel();
/**
@@ -167,7 +165,7 @@ public class BitmapFactory {
* if the operation is canceled.
*/
public boolean mCancel;
-
+
/**
* This can be called from another thread while this options object is
* inside a decode... call. Calling this will notify the decoder that
@@ -249,7 +247,7 @@ public class BitmapFactory {
if (opts.inDensity == 0) {
opts.inDensity = density == TypedValue.DENSITY_DEFAULT ?
DisplayMetrics.DEFAULT_DENSITY : density;
- }
+ }
float scale = opts.inDensity / (float) DisplayMetrics.DEFAULT_DENSITY;
if (opts.inScaled || isNinePatch) {
@@ -291,7 +289,7 @@ public class BitmapFactory {
*/
public static Bitmap decodeResource(Resources res, int id, Options opts) {
Bitmap bm = null;
-
+
try {
final TypedValue value = new TypedValue();
final InputStream is = res.openRawResource(id, value);
@@ -306,7 +304,7 @@ public class BitmapFactory {
}
return bm;
}
-
+
/**
* Decode an image referenced by a resource ID.
*
@@ -337,7 +335,7 @@ public class BitmapFactory {
}
return nativeDecodeByteArray(data, offset, length, opts);
}
-
+
/**
* Decode an immutable bitmap from the specified byte array.
*
@@ -350,13 +348,13 @@ public class BitmapFactory {
public static Bitmap decodeByteArray(byte[] data, int offset, int length) {
return decodeByteArray(data, offset, length, null);
}
-
+
/**
* Decode an input stream into a bitmap. If the input stream is null, or
* cannot be used to decode a bitmap, the function returns null.
* The stream's position will be where ever it was after the encoded data
* was read.
- *
+ *
* @param is The input stream that holds the raw data to be decoded into a
* bitmap.
* @param outPadding If not null, return the padding rect for the bitmap if
@@ -375,7 +373,7 @@ public class BitmapFactory {
if (is == null) {
return null;
}
-
+
// we need mark/reset to work properly
if (!is.markSupported()) {
@@ -413,7 +411,7 @@ public class BitmapFactory {
* cannot be used to decode a bitmap, the function returns null.
* The stream's position will be where ever it was after the encoded data
* was read.
- *
+ *
* @param is The input stream that holds the raw data to be decoded into a
* bitmap.
* @return The decoded bitmap, or null if the image data could not be
@@ -441,7 +439,7 @@ public class BitmapFactory {
public static Bitmap decodeFileDescriptor(FileDescriptor fd, Rect outPadding, Options opts) {
return nativeDecodeFileDescriptor(fd, outPadding, opts);
}
-
+
/**
* Decode a bitmap from the file descriptor. If the bitmap cannot be decoded
* return null. The position within the descriptor will not be changed when
@@ -453,7 +451,7 @@ public class BitmapFactory {
public static Bitmap decodeFileDescriptor(FileDescriptor fd) {
return nativeDecodeFileDescriptor(fd, null, null);
}
-
+
private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage,
Rect padding, Options opts);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,