mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
save two blitbuffer memory allocations for crengine on each page turn
One for drawbuffer at CreDocument:drawCurrentView and another for resizing of drawBuf at cre.drawCurrentPage.
This commit is contained in:
2
base
2
base
Submodule base updated: 2d733e38de...2a2c0f3c59
@@ -212,10 +212,15 @@ function CreDocument:getScreenBoxesFromPositions(pos0, pos1)
|
||||
end
|
||||
|
||||
function CreDocument:drawCurrentView(target, x, y, rect, pos)
|
||||
tile_bb = Blitbuffer.new(rect.w, rect.h)
|
||||
self._document:drawCurrentPage(tile_bb)
|
||||
target:blitFrom(tile_bb, x, y, 0, 0, rect.w, rect.h)
|
||||
tile_bb:free()
|
||||
if self.buffer and (self.buffer.w ~= rect.w or self.buffer.h ~= rect.h) then
|
||||
self.buffer:free()
|
||||
self.buffer = nil
|
||||
end
|
||||
if not self.buffer then
|
||||
self.buffer = Blitbuffer.new(rect.w, rect.h)
|
||||
end
|
||||
self._document:drawCurrentPage(self.buffer)
|
||||
target:blitFrom(self.buffer, x, y, 0, 0, rect.w, rect.h)
|
||||
end
|
||||
|
||||
function CreDocument:drawCurrentViewByPos(target, x, y, rect, pos)
|
||||
|
||||
@@ -237,7 +237,7 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, render_mode)
|
||||
|
||||
-- prepare cache item with contained blitbuffer
|
||||
local tile = TileCacheItem:new{
|
||||
size = size.w * size.h / 2 + 64, -- estimation
|
||||
size = size.w * size.h + 64, -- estimation
|
||||
excerpt = size,
|
||||
pageno = pageno,
|
||||
bb = Blitbuffer.new(size.w, size.h)
|
||||
|
||||
Reference in New Issue
Block a user