Skip to content

Commit 1d0a9f3

Browse files
committed
update BitmapCache
1 parent 991615a commit 1d0a9f3

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

library/src/com/lidroid/xutils/bitmap/core/BitmapCache.java

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -263,34 +263,34 @@ public Bitmap getBitmapFromDiskCache(String uri, BitmapDisplayConfig config) {
263263
} catch (Throwable e) {
264264
}
265265
}
266-
if (mDiskLruCache != null) {
267-
LruDiskCache.Snapshot snapshot = null;
268-
try {
269-
snapshot = mDiskLruCache.get(uri);
270-
if (snapshot != null) {
271-
Bitmap bitmap = null;
272-
if (config == null || config.isShowOriginal()) {
273-
bitmap = BitmapDecoder.decodeFileDescriptor(
274-
snapshot.getInputStream(DISK_CACHE_INDEX).getFD());
275-
} else {
276-
bitmap = BitmapDecoder.decodeSampledBitmapFromDescriptor(
277-
snapshot.getInputStream(DISK_CACHE_INDEX).getFD(),
278-
config.getBitmapMaxSize(),
279-
config.getBitmapConfig());
280-
}
281-
282-
bitmap = rotateBitmapIfNeeded(uri, config, bitmap);
283-
addBitmapToMemoryCache(uri, config, bitmap, mDiskLruCache.getExpiryTimestamp(uri));
284-
return bitmap;
266+
}
267+
if (mDiskLruCache != null) {
268+
LruDiskCache.Snapshot snapshot = null;
269+
try {
270+
snapshot = mDiskLruCache.get(uri);
271+
if (snapshot != null) {
272+
Bitmap bitmap = null;
273+
if (config == null || config.isShowOriginal()) {
274+
bitmap = BitmapDecoder.decodeFileDescriptor(
275+
snapshot.getInputStream(DISK_CACHE_INDEX).getFD());
276+
} else {
277+
bitmap = BitmapDecoder.decodeSampledBitmapFromDescriptor(
278+
snapshot.getInputStream(DISK_CACHE_INDEX).getFD(),
279+
config.getBitmapMaxSize(),
280+
config.getBitmapConfig());
285281
}
286-
} catch (Throwable e) {
287-
LogUtils.e(e.getMessage(), e);
288-
} finally {
289-
IOUtils.closeQuietly(snapshot);
282+
283+
bitmap = rotateBitmapIfNeeded(uri, config, bitmap);
284+
addBitmapToMemoryCache(uri, config, bitmap, mDiskLruCache.getExpiryTimestamp(uri));
285+
return bitmap;
290286
}
287+
} catch (Throwable e) {
288+
LogUtils.e(e.getMessage(), e);
289+
} finally {
290+
IOUtils.closeQuietly(snapshot);
291291
}
292-
return null;
293292
}
293+
return null;
294294
}
295295

296296
/**

0 commit comments

Comments
 (0)