2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00

show djvu cache size #80

Currently it shows cache_max_memsize and cache_item_max_pixels from
lua and djvu cache size on menu key
This commit is contained in:
Dobrica Pavlinusic 2012-03-31 12:53:40 +02:00
parent dbeef1b4c2
commit 92ec4213c0
2 changed files with 17 additions and 1 deletions

9
djvu.c
View File

@ -447,6 +447,14 @@ static int drawPage(lua_State *L) {
return 0;
}
static int getCacheSize(lua_State *L) {
DjvuDocument *doc = (DjvuDocument*) luaL_checkudata(L, 1, "djvudocument");
unsigned long size = ddjvu_cache_get_size(doc->context);
printf("ddjvu_cache_get_size = %d\n", size);
lua_pushnumber(L, size);
return 1;
}
static const struct luaL_Reg djvu_func[] = {
{"openDocument", openDocument},
{NULL, NULL}
@ -458,6 +466,7 @@ static const struct luaL_Reg djvudocument_meth[] = {
{"getTOC", getTableOfContent},
{"getPageText", getPageText},
{"close", closeDocument},
{"getCacheSize", getCacheSize},
{"__gc", closeDocument},
{NULL, NULL}
};

View File

@ -126,6 +126,13 @@ function UniReader:toggleTextHighLight(word_list)
return
end
----------------------------------------------------
-- renderer memory
----------------------------------------------------
function UniReader:getCacheSize()
return -1
end
--[ following are default methods ]--
@ -799,7 +806,7 @@ function UniReader:showMenu()
end
renderUtf8Text(fb.bb, 10, ypos+6, face, fhash,
"Page: "..self.pageno.."/"..self.doc:getPages()..
" "..cur_section, true)
" "..cur_section.." Memory: "..( self.cache_max_memsize / 1024 ).." "..( self.cache_item_max_pixels / 1024 ).." "..( self.doc:getCacheSize() / 1024 ).." k", true)
ypos = ypos + 15
blitbuffer.progressBar(fb.bb, 10, ypos, width-20, 15,