mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 14:56:00 +01:00
Get/Free djvu page
This commit is contained in:
parent
1814caff30
commit
ecef579ce0
1 changed files with 23 additions and 2 deletions
|
@ -33,7 +33,7 @@ djvu_document_open(zathura_document_t* document)
|
|||
djvu_document->format = NULL;
|
||||
|
||||
/* setup format */
|
||||
djvu_document->format = ddjvu_format_create (DDJVU_FORMAT_RGBMASK32, 0, NULL);
|
||||
djvu_document->format = ddjvu_format_create(DDJVU_FORMAT_RGB24, 0, NULL);
|
||||
|
||||
if(!djvu_document->format) {
|
||||
goto error_free;
|
||||
|
@ -134,9 +134,27 @@ djvu_page_get(zathura_document_t* document, unsigned int page)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
djvu_document_t* djvu_document = (djvu_document_t*) document->data;
|
||||
zathura_page_t* document_page = malloc(sizeof(zathura_page_t));
|
||||
|
||||
if(!document_page) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
document_page->document = document;
|
||||
document_page->data = ddjvu_page_create_by_pageno(djvu_document->document, page);;
|
||||
|
||||
if(!document_page->data) {
|
||||
free(document_page);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
document_page->width = ddjvu_page_get_width(document_page->data);
|
||||
document_page->height = ddjvu_page_get_width(document_page->data);
|
||||
|
||||
return document_page;
|
||||
}
|
||||
|
||||
bool
|
||||
djvu_page_free(zathura_page_t* page)
|
||||
{
|
||||
|
@ -144,6 +162,9 @@ djvu_page_free(zathura_page_t* page)
|
|||
return false;
|
||||
}
|
||||
|
||||
ddjvu_page_release(page->data);
|
||||
free(page);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue