From a90c2239d39181519c53f0b02b5af90be0d7ef3d Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Wed, 9 Dec 2009 18:36:17 +0100 Subject: [PATCH] Use EvPage instead of page index to get images So that we can re-use the page object instead of creating and deleting a new one. --- backend/pdf/ev-poppler.cc | 7 +++---- libdocument/ev-document-images.c | 2 +- libdocument/ev-document-images.h | 4 ++-- libview/ev-jobs.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc index 82cde9e3..6d1c937a 100644 --- a/backend/pdf/ev-poppler.cc +++ b/backend/pdf/ev-poppler.cc @@ -1326,7 +1326,7 @@ pdf_document_document_links_iface_init (EvDocumentLinksIface *iface) static GList * pdf_document_images_get_image_mapping (EvDocumentImages *document_images, - gint page) + EvPage *page) { GList *retval = NULL; PdfDocument *pdf_document; @@ -1335,7 +1335,7 @@ pdf_document_images_get_image_mapping (EvDocumentImages *document_images, GList *list; pdf_document = PDF_DOCUMENT (document_images); - poppler_page = poppler_document_get_page (pdf_document->document, page); + poppler_page = POPPLER_PAGE (page->backend_page); mapping_list = poppler_page_get_image_mapping (poppler_page); for (list = mapping_list; list; list = list->next) { @@ -1346,7 +1346,7 @@ pdf_document_images_get_image_mapping (EvDocumentImages *document_images, ev_image_mapping = g_new (EvMapping, 1); - ev_image_mapping->data = ev_image_new (page, image_mapping->image_id); + ev_image_mapping->data = ev_image_new (page->index, image_mapping->image_id); ev_image_mapping->area.x1 = image_mapping->area.x1; ev_image_mapping->area.y1 = image_mapping->area.y1; ev_image_mapping->area.x2 = image_mapping->area.x2; @@ -1356,7 +1356,6 @@ pdf_document_images_get_image_mapping (EvDocumentImages *document_images, } poppler_page_free_image_mapping (mapping_list); - g_object_unref (poppler_page); return g_list_reverse (retval); } diff --git a/libdocument/ev-document-images.c b/libdocument/ev-document-images.c index 1754ded2..a7f85f0c 100644 --- a/libdocument/ev-document-images.c +++ b/libdocument/ev-document-images.c @@ -30,7 +30,7 @@ ev_document_images_class_init (EvDocumentImagesIface *klass) GList * ev_document_images_get_image_mapping (EvDocumentImages *document_images, - gint page) + EvPage *page) { EvDocumentImagesIface *iface = EV_DOCUMENT_IMAGES_GET_IFACE (document_images); diff --git a/libdocument/ev-document-images.h b/libdocument/ev-document-images.h index d9d76965..95b2ac7d 100644 --- a/libdocument/ev-document-images.h +++ b/libdocument/ev-document-images.h @@ -48,14 +48,14 @@ struct _EvDocumentImagesIface { /* Methods */ GList *(* get_image_mapping) (EvDocumentImages *document_images, - gint page); + EvPage *page); GdkPixbuf *(* get_image) (EvDocumentImages *document_images, EvImage *image); }; GType ev_document_images_get_type (void) G_GNUC_CONST; GList *ev_document_images_get_image_mapping (EvDocumentImages *document_images, - gint page); + EvPage *page); GdkPixbuf *ev_document_images_get_image (EvDocumentImages *document_images, EvImage *image); diff --git a/libview/ev-jobs.c b/libview/ev-jobs.c index ac716308..20f4ee21 100644 --- a/libview/ev-jobs.c +++ b/libview/ev-jobs.c @@ -606,7 +606,7 @@ ev_job_page_data_run (EvJob *job) if ((job_pd->flags & EV_PAGE_DATA_INCLUDE_IMAGES) && EV_IS_DOCUMENT_IMAGES (job->document)) job_pd->image_mapping = ev_document_images_get_image_mapping (EV_DOCUMENT_IMAGES (job->document), - job_pd->page); + ev_page); if ((job_pd->flags & EV_PAGE_DATA_INCLUDE_ANNOTS) && EV_IS_DOCUMENT_ANNOTATIONS (job->document)) job_pd->annot_mapping = ev_document_annotations_get_annotations (EV_DOCUMENT_ANNOTATIONS (job->document), -- 2.43.5