mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #268 from houqp/master
set crengine cache size in lua code
This commit is contained in:
10
cre.cpp
10
cre.cpp
@@ -33,6 +33,13 @@ typedef struct CreDocument {
|
||||
ldomDocument *dom_doc;
|
||||
} CreDocument;
|
||||
|
||||
static int initCache(lua_State *L) {
|
||||
int cache_size = luaL_optint(L, 1, (2 << 20) * 64); // 64Mb on disk cache for DOM
|
||||
|
||||
ldomDocCache::init(lString16("./cr3cache"), cache_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int openDocument(lua_State *L) {
|
||||
const char *file_name = luaL_checkstring(L, 1);
|
||||
@@ -493,6 +500,7 @@ static int findText(lua_State *L) {
|
||||
}
|
||||
|
||||
static const struct luaL_Reg cre_func[] = {
|
||||
{"initCache", initCache},
|
||||
{"openDocument", openDocument},
|
||||
{"getFontFaces", getFontFaces},
|
||||
{"getGammaIndex", getGammaIndex},
|
||||
@@ -546,8 +554,6 @@ int luaopen_cre(lua_State *L) {
|
||||
/* initialize font manager for CREngine */
|
||||
InitFontManager(lString8());
|
||||
|
||||
ldomDocCache::init(lString16("./cr3cache"), 1024 * 1024 * 64); // 64Mb on disk cache for DOM
|
||||
|
||||
#ifdef DEBUG_CRENGINE
|
||||
CRLog::setStdoutLogger();
|
||||
CRLog::setLogLevel(CRLog::LL_DEBUG);
|
||||
|
||||
@@ -18,6 +18,9 @@ CREReader = UniReader:new{
|
||||
function CREReader:init()
|
||||
self:addAllCommands()
|
||||
self:adjustCreReaderCommands()
|
||||
|
||||
-- initialize cache
|
||||
cre.initCache(1024*1024*64)
|
||||
-- we need to initialize the CRE font list
|
||||
local fonts = Font:getFontList()
|
||||
for _k, _v in ipairs(fonts) do
|
||||
|
||||
Reference in New Issue
Block a user