diff options
author | Mike Reed <reed@google.com> | 2010-01-26 10:13:53 -0500 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2010-01-26 10:18:32 -0500 |
commit | ab4a0c164b5a44d5bfd37069cfe499db31e7620c (patch) | |
tree | 56b7bb3091cbd7c3c376fac80c1284c3863f8cf6 /graphics | |
parent | 111d0367d75e0bba6558e4464a7662dc95825ba4 (diff) | |
download | frameworks_base-ab4a0c164b5a44d5bfd37069cfe499db31e7620c.zip frameworks_base-ab4a0c164b5a44d5bfd37069cfe499db31e7620c.tar.gz frameworks_base-ab4a0c164b5a44d5bfd37069cfe499db31e7620c.tar.bz2 |
add API to change default config on image decoders.
May be called by the browser to get high-quality images when running in a 32bit window
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/BitmapFactory.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java index 3c03eed..2313f4c 100644 --- a/graphics/java/android/graphics/BitmapFactory.java +++ b/graphics/java/android/graphics/BitmapFactory.java @@ -558,6 +558,30 @@ public class BitmapFactory { return decodeFileDescriptor(fd, null, null); } + /** + * Set the default config used for decoding bitmaps. This config is + * presented to the codec if the caller did not specify a preferred config + * in their call to decode... + * + * The default value is chosen by the system to best match the device's + * screen and memory constraints. + * + * @param config The preferred config for decoding bitmaps. If null, then + * a suitable default is chosen by the system. + * + * @hide - only called by the browser at the moment, but should be stable + * enough to expose if needed + */ + public static void setDefaultConfig(Bitmap.Config config) { + if (config == null) { + // pick this for now, as historically it was our default. + // However, if we have a smarter algorithm, we can change this. + config = Bitmap.Config.RGB_565; + } + nativeSetDefaultConfig(config.nativeInt); + } + + private static native void nativeSetDefaultConfig(int nativeConfig); private static native Bitmap nativeDecodeStream(InputStream is, byte[] storage, Rect padding, Options opts); private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd, |