2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

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)
This commit is contained in:
Frédéric Brière 2024-08-05 16:47:51 -04:00 committed by GitHub
parent a6663202b7
commit 9e6f3dac65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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