diff --git a/unireader.lua b/unireader.lua index dd3ea6227..f2ecd3626 100644 --- a/unireader.lua +++ b/unireader.lua @@ -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()) + local face, fhash = Font:getFaceAndHash(22) - fb.bb:paintRect(0, ypos, width, 50, 0) + -- 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 face, fhash = Font:getFaceAndHash(22) 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()