From 14fbe0f72e1b6a537530491b77479ed2cbbacbbf Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Mon, 27 Dec 2010 09:22:08 +0100 Subject: [PATCH] Render ddjvu document --- ft/djvu/djvu.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ft/djvu/djvu.c b/ft/djvu/djvu.c index da8ba9c..ca04c14 100644 --- a/ft/djvu/djvu.c +++ b/ft/djvu/djvu.c @@ -56,6 +56,23 @@ djvu_document_open(zathura_document_t* document) goto error_free; } + /* load document info */ + ddjvu_message_t* msg; + ddjvu_message_wait(djvu_document->context); + + while((msg = ddjvu_message_peek(djvu_document->context)) && (msg->m_any.tag != DDJVU_DOCINFO)) { + if(msg->m_any.tag == DDJVU_ERROR) { + goto error_free; + } + + ddjvu_message_pop(djvu_document->context); + } + + /* decoding error */ + if(ddjvu_document_decoding_error(djvu_document->document)) { + goto error_free; + } + document->number_of_pages = ddjvu_document_get_pagenum(djvu_document->document); return true; @@ -150,6 +167,8 @@ djvu_page_get(zathura_document_t* document, unsigned int page) return NULL; } + while(!ddjvu_page_decoding_done(document_page->data)); + document_page->width = ddjvu_page_get_width(document_page->data); document_page->height = ddjvu_page_get_width(document_page->data);