summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ta Chen <weita@google.com>2009-06-03 14:08:04 -0700
committerWei-Ta Chen <weita@google.com>2009-06-03 14:27:52 -0700
commit2a2c5cd74128a7750f05683614c9824c9262addc (patch)
tree1c84af1017a720032e3ebdcb0bc889b704572d3e
parentb9a39cd300998a1a4577ac7eb87f9b505b8621dc (diff)
downloadframeworks_base-2a2c5cd74128a7750f05683614c9824c9262addc.zip
frameworks_base-2a2c5cd74128a7750f05683614c9824c9262addc.tar.gz
frameworks_base-2a2c5cd74128a7750f05683614c9824c9262addc.tar.bz2
Modify the decoding logic in the FD case when a purgeable flag is set,
and lower the threshold of bitmap size for using ashmem(). For the decoding logic, we now go through the "non-purgeable" path if isShareable is false, irrespective of the value of the purgeable flag.
-rw-r--r--core/jni/android/graphics/BitmapFactory.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index 1fd15d6..137707f 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -311,7 +311,7 @@ static SkPixelRef* installPixelRef(SkBitmap* bitmap, SkStream* stream,
int sampleSize) {
SkPixelRef* pr;
// only use ashmem for large images, since mmaps come at a price
- if (bitmap->getSize() >= 32 * 65536) {
+ if (bitmap->getSize() >= 32 * 1024) {
pr = new SkImageRef_ashmem(stream, bitmap->config(), sampleSize);
} else {
pr = new SkImageRef_GlobalPool(stream, bitmap->config(), sampleSize);
@@ -520,7 +520,10 @@ static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz,
*/
AutoFDSeek as(descriptor);
- return doDecode(env, stream, padding, bitmapFactoryOptions, true);
+ /* Allow purgeable iff we own the FD, i.e., in the puregeable and
+ shareable case.
+ */
+ return doDecode(env, stream, padding, bitmapFactoryOptions, weOwnTheFD);
}
/* make a deep copy of the asset, and return it as a stream, or NULL if there