[Android] Fix the thumbnail quality issue: downsampling and cache
Nicolas Pomepuy
git at videolan.org
Mon Sep 28 13:40:07 CEST 2020
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Mon Sep 28 12:18:23 2020 +0200| [f8ccb3ea80e955d73954e52615de1f122766e159] | committer: Nicolas Pomepuy
Fix the thumbnail quality issue: downsampling and cache
Fixes #1477
> https://code.videolan.org/videolan/vlc-android/commit/f8ccb3ea80e955d73954e52615de1f122766e159
---
application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt
index 8556e5429..c2580892a 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/AudioUtil.kt
@@ -169,7 +169,7 @@ object AudioUtil {
if (path.startsWith("http")) return runBlocking(Dispatchers.Main) {
HttpImageLoader.downloadBitmap(path)
}
- return BitmapCache.getBitmapFromMemCache(path.substringAfter("file://")) ?: fetchCoverBitmap(path, width)
+ return BitmapCache.getBitmapFromMemCache(path.substringAfter("file://")+"_$width") ?: fetchCoverBitmap(path, width)
}
@WorkerThread
@@ -188,7 +188,7 @@ object AudioUtil {
// Find the best decoding scale for the bitmap
if (width > 0) {
- while (options.outWidth / options.inSampleSize > width)
+ while (options.outWidth / (options.inSampleSize + 1) > width)
options.inSampleSize = options.inSampleSize * 2
}
More information about the Android
mailing list