X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fev-document.c;h=8598c117703785e78ee08789eef080b4f1538fb5;hb=3f9b326b1e7351aeb08dc70ab78f4fcfda167318;hp=3793050d3750d4cb7b9e5874edd2df34f48f9652;hpb=dbbd21a4d621a47629ac03ffc71651172f574138;p=evince.git diff --git a/backend/ev-document.c b/backend/ev-document.c index 3793050d..8598c117 100644 --- a/backend/ev-document.c +++ b/backend/ev-document.c @@ -23,7 +23,6 @@ #include "ev-document.h" #include "ev-backend-marshalers.h" -#include "ev-job-queue.h" static void ev_document_class_init (gpointer g_class); @@ -69,24 +68,6 @@ ev_document_class_init (gpointer g_class) { } -#define PAGE_CACHE_STRING "ev-page-cache" - -EvPageCache * -ev_document_get_page_cache (EvDocument *document) -{ - EvPageCache *page_cache; - - g_return_val_if_fail (EV_IS_DOCUMENT (document), NULL); - - page_cache = g_object_get_data (G_OBJECT (document), PAGE_CACHE_STRING); - if (page_cache == NULL) { - page_cache = _ev_page_cache_new (document); - g_object_set_data_full (G_OBJECT (document), PAGE_CACHE_STRING, page_cache, g_object_unref); - } - - return page_cache; -} - GMutex * ev_document_get_doc_mutex (void) { @@ -120,10 +101,6 @@ ev_document_load (EvDocument *document, LOG ("ev_document_load"); retval = iface->load (document, uri, error); - /* Call this to make the initial cached copy */ - if (retval) - ev_document_get_page_cache (document); - return retval; } @@ -208,27 +185,34 @@ ev_document_get_text (EvDocument *document, return retval; } +gboolean +ev_document_has_attachments (EvDocument *document) +{ + EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); + + if (iface->has_attachments == NULL) + return FALSE; + + return iface->has_attachments (document); +} + GList * -ev_document_get_links (EvDocument *document, - int page) +ev_document_get_attachments (EvDocument *document) { EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); GList *retval; - LOG ("ev_document_get_link"); - if (iface->get_links == NULL) + LOG ("ev_document_get_attachments"); + if (iface->get_attachments == NULL) return NULL; - retval = iface->get_links (document, page); + retval = iface->get_attachments (document); return retval; } - - GdkPixbuf * -ev_document_render_pixbuf (EvDocument *document, - int page, - double scale) +ev_document_render_pixbuf (EvDocument *document, + EvRenderContext *rc) { EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document); GdkPixbuf *retval; @@ -236,7 +220,7 @@ ev_document_render_pixbuf (EvDocument *document, LOG ("ev_document_render_pixbuf"); g_assert (iface->render_pixbuf); - retval = iface->render_pixbuf (document, page, scale); + retval = iface->render_pixbuf (document, rc); return retval; } @@ -256,3 +240,22 @@ ev_document_info_free (EvDocumentInfo *info) g_free (info); } + + +/* Compares two rects. returns 0 if they're equal */ +#define EPSILON 0.0000001 + +gint +ev_rect_cmp (EvRectangle *a, + EvRectangle *b) +{ + if (a == b) + return 0; + if (a == NULL || b == NULL) + return 1; + + return ! ((ABS (a->x1 - b->x1) < EPSILON) && + (ABS (a->y1 - b->y1) < EPSILON) && + (ABS (a->x2 - b->x2) < EPSILON) && + (ABS (a->y2 - b->y2) < EPSILON)); +}