mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
free blitbuffer as soon as tile is kicked out from cache
other than waiting for the lazy garbage collector of lua
This commit is contained in:
@@ -28,6 +28,14 @@ function DocumentRegistry:openDocument(file)
|
||||
end
|
||||
end
|
||||
|
||||
TileCacheItem = CacheItem:new{}
|
||||
|
||||
function TileCacheItem:onFree()
|
||||
if self.bb.free then
|
||||
DEBUG("free blitbuffer", self.bb)
|
||||
self.bb:free()
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
This is an abstract interface to a document
|
||||
@@ -216,7 +224,7 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, render_mode)
|
||||
end
|
||||
|
||||
-- prepare cache item with contained blitbuffer
|
||||
local tile = CacheItem:new{
|
||||
local tile = TileCacheItem:new{
|
||||
size = size.w * size.h / 2 + 64, -- estimation
|
||||
excerpt = size,
|
||||
pageno = pageno,
|
||||
@@ -296,7 +304,6 @@ function Document:getPageText(pageno)
|
||||
return text
|
||||
end
|
||||
|
||||
|
||||
-- load implementations:
|
||||
|
||||
require "document/pdfdocument"
|
||||
|
||||
Reference in New Issue
Block a user