mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Panel zoom - improve output image resolution (#6709)
This commit is contained in:
@@ -414,9 +414,18 @@ function Document:getDrawnImagesStatistics()
|
||||
end
|
||||
|
||||
function Document:getPagePart(pageno, rect, rotation)
|
||||
local tile = self:renderPage(pageno, rect, 1, rotation, 1, 0)
|
||||
local target = Blitbuffer.new(rect.w, rect.h, self.render_color and self.color_bb_type or nil)
|
||||
target:blitFrom(tile.bb, 0, 0, rect.x, rect.y, rect.w, rect.h)
|
||||
local canvas_size = CanvasContext:getSize()
|
||||
local zoom = math.min(canvas_size.w*2 / rect.w, canvas_size.h*2 / rect.h)
|
||||
-- it's really, really important to do math.floor, otherwise we get image projection
|
||||
local scaled_rect = {
|
||||
x = math.floor(rect.x * zoom),
|
||||
y = math.floor(rect.y * zoom),
|
||||
w = math.floor(rect.w * zoom),
|
||||
h = math.floor(rect.h * zoom),
|
||||
}
|
||||
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)
|
||||
return target
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user