mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #84 from houqp/master
force freeing biltbuffer on cache evict
This commit is contained in:
@@ -209,6 +209,7 @@ function UniReader:cacheClaim(size)
|
||||
else
|
||||
-- cache slot is at end of life, so kick it out
|
||||
self.cache_current_memsize = self.cache_current_memsize - self.cache[k].size
|
||||
self.cache[k].bb:free()
|
||||
self.cache[k] = nil
|
||||
end
|
||||
end
|
||||
@@ -804,13 +805,21 @@ function UniReader:showHighLight()
|
||||
end
|
||||
|
||||
function UniReader:showMenu()
|
||||
local ypos = height - 50
|
||||
local load_percent = (self.pageno / self.doc:getPages())
|
||||
|
||||
fb.bb:paintRect(0, ypos, width, 50, 0)
|
||||
|
||||
ypos = ypos + 15
|
||||
local face, fhash = Font:getFaceAndHash(22)
|
||||
|
||||
-- display memory on top of page
|
||||
fb.bb:paintRect(0, 0, width, 15+6*2, 0)
|
||||
renderUtf8Text(fb.bb, 10, 15+6, face, fhash,
|
||||
"Memory: "..
|
||||
math.ceil( self.cache_current_memsize / 1024 ).."/"..math.ceil( self.cache_max_memsize / 1024 )..
|
||||
" "..math.ceil( self.doc:getCacheSize() / 1024 ).."/"..math.ceil( self.cache_document_size / 1024 ).." k",
|
||||
true)
|
||||
|
||||
-- display reading progress on bottom of page
|
||||
local ypos = height - 50
|
||||
fb.bb:paintRect(0, ypos, width, 50, 0)
|
||||
ypos = ypos + 15
|
||||
local cur_section = self:getTOCTitleByPage(self.pageno)
|
||||
if cur_section ~= "" then
|
||||
cur_section = "Section: "..cur_section
|
||||
@@ -823,14 +832,6 @@ function UniReader:showMenu()
|
||||
blitbuffer.progressBar(fb.bb, 10, ypos, width-20, 15,
|
||||
5, 4, load_percent, 8)
|
||||
|
||||
-- display memory on top of page
|
||||
fb.bb:paintRect(0, 0, width, 15+6*2, 0)
|
||||
renderUtf8Text(fb.bb, 10, 15+6, face, fhash,
|
||||
"Memory: "..
|
||||
math.ceil( self.cache_current_memsize / 1024 ).."/"..math.ceil( self.cache_max_memsize / 1024 )..
|
||||
" "..math.ceil( self.doc:getCacheSize() / 1024 ).."/"..math.ceil( self.cache_document_size / 1024 ).." k",
|
||||
true)
|
||||
|
||||
fb:refresh(1)
|
||||
while 1 do
|
||||
local ev = input.waitForEvent()
|
||||
|
||||
Reference in New Issue
Block a user