SufficientlySecure / document-viewer

Document Viewer is a highly customizable document viewer for Android.
GNU General Public License v3.0
524 stars 155 forks source link

Images are decoded without resizing: #335

Open sunshinelwj opened 3 years ago

sunshinelwj commented 3 years ago

When loading an image, Google suggests us to resize the image before decoding them, so as to save memory resource https://developer.android.com/topic/performance/graphics/load-bitmap.html

I noticed that in the following code of Document Viewer, image resizing is correctly applied: org.ebookdroid.ui.opds.adapters.LoadThumbnailTask.java loadBookThumbnail() (line number:80) https://github.com/SufficientlySecure/document-viewer/blob/master/document-viewer/src/main/java/org/ebookdroid/ui/opds/adapters/LoadThumbnailTask.java#L80

However, in the code below, images are decoded directly without resizing: org.ebookdroid.common.cache.ThumbnailFile.java load() (line number: 96) https://github.com/SufficientlySecure/document-viewer/blob/master/document-viewer/src/main/java/org/ebookdroid/common/cache/ThumbnailFile.java#L96

I am curious about the latter case. Why this method does not resize images? For the images to be displayed, in many cases, they are larger than required.

Thanks.