From 35f16f87a40d7eb801f5aa4a844bf7da109df755 Mon Sep 17 00:00:00 2001 From: poire-z Date: Sun, 8 Oct 2023 17:51:41 +0200 Subject: [PATCH] ReaderThumbnail: fix slow thumbnails when in scroll mode If originally with two-columns in page mode, and switching to scroll mode, thumbnails generation would be slow as the document would be rerendered for each thumbnail. --- frontend/apps/reader/modules/readerthumbnail.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/apps/reader/modules/readerthumbnail.lua b/frontend/apps/reader/modules/readerthumbnail.lua index cb4465522..0f7653c0f 100644 --- a/frontend/apps/reader/modules/readerthumbnail.lua +++ b/frontend/apps/reader/modules/readerthumbnail.lua @@ -420,7 +420,13 @@ function ReaderThumbnail:_getPageImage(page) -- CRE documents: pages all have the aspect ratio of our screen (alt top status bar -- will be croped out after drawing), we will show them just as rendered. self.ui.rolling.rendering_state = nil -- Remove any partial rerendering icon - self.ui.view:onSetViewMode("page") -- Get out of scroll mode + if self.ui.view.view_mode == "scroll" then + -- Get out of scroll mode, and be sure we'll be in one-page mode as that + -- is what is shown in scroll mode (needs to do the following in that + -- order to avoid rendering hash change) + self.ui.rolling:onSetVisiblePages(1) + self.ui.view:onSetViewMode("page") + end if self.ui.document.configurable.font_gamma < 30 then -- Increase font gamma (if not already increased), self.ui.document:setGammaIndex(30) -- as downscaling will make text grayer end