From 28ba1c7e3792872d1ab9292fb957d41ea51d037a Mon Sep 17 00:00:00 2001 From: Tigran Aivazian Date: Fri, 14 Sep 2012 23:22:19 +0100 Subject: [PATCH] 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. --- djvu.c | 8 ++++---- djvureader.lua | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/djvu.c b/djvu.c index 8be9bc694..7ea55a829 100644 --- a/djvu.c +++ b/djvu.c @@ -79,9 +79,9 @@ static int openDocument(lua_State *L) { luaL_getmetatable(L, "djvudocument"); lua_setmetatable(L, -2); - doc->context = ddjvu_context_create("DJVUReader"); + doc->context = ddjvu_context_create("kindlepdfviewer"); if (! doc->context) { - return luaL_error(L, "cannot create context."); + return luaL_error(L, "cannot create context"); } printf("## cache_size = %d\n", cache_size); @@ -91,12 +91,12 @@ static int openDocument(lua_State *L) { while (! ddjvu_document_decoding_done(doc->doc_ref)) handle(L, doc->context, True); 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); 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_y_direction(doc->pixelformat, 1); diff --git a/djvureader.lua b/djvureader.lua index 0edb4bca3..012c0ccc2 100644 --- a/djvureader.lua +++ b/djvureader.lua @@ -47,9 +47,7 @@ function DJVUReader:select_render_mode() local mode = mode_menu:choose(0, fb.bb:getHeight()) if mode then self.render_mode = mode - 1 - Debug("select_render_mode(), render_mode=", self.render_mode) self:clearCache() - self.doc:cleanCache() end self:redrawCurrentPage() end