Skip to content

Commit

Permalink
update BitmapCache
Browse files Browse the repository at this point in the history
  • Loading branch information
wyouflf committed Jun 7, 2014
1 parent 991615a commit 1d0a9f3
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions library/src/com/lidroid/xutils/bitmap/core/BitmapCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,34 +263,34 @@ public Bitmap getBitmapFromDiskCache(String uri, BitmapDisplayConfig config) {
} catch (Throwable e) {
}
}
if (mDiskLruCache != null) {
LruDiskCache.Snapshot snapshot = null;
try {
snapshot = mDiskLruCache.get(uri);
if (snapshot != null) {
Bitmap bitmap = null;
if (config == null || config.isShowOriginal()) {
bitmap = BitmapDecoder.decodeFileDescriptor(
snapshot.getInputStream(DISK_CACHE_INDEX).getFD());
} else {
bitmap = BitmapDecoder.decodeSampledBitmapFromDescriptor(
snapshot.getInputStream(DISK_CACHE_INDEX).getFD(),
config.getBitmapMaxSize(),
config.getBitmapConfig());
}

bitmap = rotateBitmapIfNeeded(uri, config, bitmap);
addBitmapToMemoryCache(uri, config, bitmap, mDiskLruCache.getExpiryTimestamp(uri));
return bitmap;
}
if (mDiskLruCache != null) {
LruDiskCache.Snapshot snapshot = null;
try {
snapshot = mDiskLruCache.get(uri);
if (snapshot != null) {
Bitmap bitmap = null;
if (config == null || config.isShowOriginal()) {
bitmap = BitmapDecoder.decodeFileDescriptor(
snapshot.getInputStream(DISK_CACHE_INDEX).getFD());
} else {
bitmap = BitmapDecoder.decodeSampledBitmapFromDescriptor(
snapshot.getInputStream(DISK_CACHE_INDEX).getFD(),
config.getBitmapMaxSize(),
config.getBitmapConfig());
}
} catch (Throwable e) {
LogUtils.e(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(snapshot);

bitmap = rotateBitmapIfNeeded(uri, config, bitmap);
addBitmapToMemoryCache(uri, config, bitmap, mDiskLruCache.getExpiryTimestamp(uri));
return bitmap;
}
} catch (Throwable e) {
LogUtils.e(e.getMessage(), e);
} finally {
IOUtils.closeQuietly(snapshot);
}
return null;
}
return null;
}

/**
Expand Down

0 comments on commit 1d0a9f3

Please sign in to comment.