2
0
mirror of https://github.com/koreader/koreader synced 2024-11-16 06:12:56 +00:00

1. It is customary to call DjVu context by the name of the program.

2. When changing DjVu page rendering mode there is no need to clear DjVu cache, only our own tile cache.

Conflicts:

	djvureader.lua
This commit is contained in:
Tigran Aivazian 2012-09-14 23:22:19 +01:00 committed by Qingping Hou
parent dfff1906fd
commit 97f59ed07c

8
djvu.c
View File

@ -78,9 +78,9 @@ static int openDocument(lua_State *L) {
luaL_getmetatable(L, "djvudocument"); luaL_getmetatable(L, "djvudocument");
lua_setmetatable(L, -2); lua_setmetatable(L, -2);
doc->context = ddjvu_context_create("DJVUReader"); doc->context = ddjvu_context_create("kindlepdfviewer");
if (! doc->context) { if (! doc->context) {
return luaL_error(L, "cannot create context."); return luaL_error(L, "cannot create context");
} }
printf("## cache_size = %d\n", cache_size); printf("## cache_size = %d\n", cache_size);
@ -90,12 +90,12 @@ static int openDocument(lua_State *L) {
while (! ddjvu_document_decoding_done(doc->doc_ref)) while (! ddjvu_document_decoding_done(doc->doc_ref))
handle(L, doc->context, True); handle(L, doc->context, True);
if (! doc->doc_ref) { if (! doc->doc_ref) {
return luaL_error(L, "cannot open DJVU file <%s>", filename); return luaL_error(L, "cannot open DjVu file <%s>", filename);
} }
doc->pixelformat = ddjvu_format_create(DDJVU_FORMAT_GREY8, 0, NULL); doc->pixelformat = ddjvu_format_create(DDJVU_FORMAT_GREY8, 0, NULL);
if (! doc->pixelformat) { if (! doc->pixelformat) {
return luaL_error(L, "cannot create DJVU pixelformat for <%s>", filename); return luaL_error(L, "cannot create DjVu pixelformat for <%s>", filename);
} }
ddjvu_format_set_row_order(doc->pixelformat, 1); ddjvu_format_set_row_order(doc->pixelformat, 1);
ddjvu_format_set_y_direction(doc->pixelformat, 1); ddjvu_format_set_y_direction(doc->pixelformat, 1);