From 8f71c00440df8a76367325d75c05e541f2b048cd Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sat, 17 May 2025 09:25:46 +0200 Subject: [PATCH] ImageViewer: small optimization (#13807) Avoid decoding the first image twice (and decompressing it twice when used through ArchiveViewer). --- frontend/ui/widget/imageviewer.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/ui/widget/imageviewer.lua b/frontend/ui/widget/imageviewer.lua index 6ddcba711..436ed1fd3 100644 --- a/frontend/ui/widget/imageviewer.lua +++ b/frontend/ui/widget/imageviewer.lua @@ -466,6 +466,9 @@ function ImageViewer:onShow() end function ImageViewer:switchToImageNum(image_num) + if image_num == self._images_list_cur then + return + end if self.image and self.image_disposable and self.image.free then logger.dbg("ImageViewer:switchToImageNum: free self.image", self.image) self.image:free()