From 9e6f3dac653b1a726541d2d4c82d6122f9952a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bri=C3=A8re?= Date: Mon, 5 Aug 2024 16:47:51 -0400 Subject: [PATCH] Panel zoom: Properly handle `renderPage()` not rendering the whole page (#12296) When zooming to a small panel on a device with a large display, the resulting zoom factor often causes `renderPage()` to only render the panel itself instead of the whole page. `getPagePart()` needs to account for that when extracting the panel from the rendered tile. Fixes half of #7961 (namely the black/half-black rectangles) --- frontend/document/document.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/document/document.lua b/frontend/document/document.lua index 929df9914..5bee6571f 100644 --- a/frontend/document/document.lua +++ b/frontend/document/document.lua @@ -541,7 +541,11 @@ function Document:getPagePart(pageno, rect, rotation) } local tile = self:renderPage(pageno, scaled_rect, zoom, rotation, 1.0) local target = Blitbuffer.new(scaled_rect.w, scaled_rect.h, self.render_color and self.color_bb_type or nil) - target:blitFrom(tile.bb, 0, 0, scaled_rect.x, scaled_rect.y, scaled_rect.w, scaled_rect.h) + target:blitFrom(tile.bb, + 0, 0, + scaled_rect.x - tile.excerpt.x, + scaled_rect.y - tile.excerpt.y, + scaled_rect.w, scaled_rect.h) return target end