From 9f5d6cdd61d079d8e1e6e4f856f83cce34d186dd Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Thu, 29 Sep 2011 12:07:07 +0200 Subject: [PATCH] Added page_render_cairo function --- document.c | 24 ++++-------------------- document.h | 6 ++++++ 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/document.c b/document.c index 326e006..0d52706 100644 --- a/document.c +++ b/document.c @@ -206,32 +206,16 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password goto error_free; } - document = malloc(sizeof(zathura_document_t)); + document = g_malloc0(sizeof(zathura_document_t)); if (document == NULL) { goto error_free; } document->file_path = real_path; document->password = password; - document->current_page_number = 0; - document->number_of_pages = 0; document->scale = 1.0; - document->rotate = 0; - document->data = NULL; - document->pages = NULL; document->zathura = zathura; - document->functions.document_free = NULL; - document->functions.document_index_generate = NULL; - document->functions.document_save_as = NULL; - document->functions.document_attachments_get = NULL; - document->functions.page_get = NULL; - document->functions.page_free = NULL; - document->functions.page_search_text = NULL; - document->functions.page_links_get = NULL; - document->functions.page_form_fields_get = NULL; - document->functions.page_render = NULL; - girara_list_iterator_t* iter = girara_list_iterator(zathura->plugins.plugins); if (iter == NULL) { goto error_free; @@ -285,7 +269,7 @@ error_free: free(document->pages); } - free(document); + g_free(document); error_out: @@ -315,7 +299,7 @@ zathura_document_free(zathura_document_t* document) free(document->file_path); } - free(document); + g_free(document); return true; } @@ -325,7 +309,7 @@ zathura_document_free(zathura_document_t* document) free(document->file_path); } - free(document); + g_free(document); return r; } diff --git a/document.h b/document.h index 63517c4..3abc4bd 100644 --- a/document.h +++ b/document.h @@ -3,6 +3,7 @@ #ifndef DOCUMENT_H #define DOCUMENT_H +#include #include #include @@ -213,6 +214,11 @@ struct zathura_document_s */ zathura_image_buffer_t* (*page_render)(zathura_page_t* page); + /** + * Renders the page + */ + bool (*page_render_cairo)(zathura_page_t* page, cairo_t* cairo); + /** * Free page */