]> www.fi.muni.cz Git - evince.git/blobdiff - backend/ev-document.c
Reduce relocations. Bug #360616.
[evince.git] / backend / ev-document.c
index 9bccc4cab7ee2d09ed99e5024ac3144a6cea4456..94647c6b571f82f5d1982f317e44051f91f8933a 100644 (file)
@@ -37,7 +37,7 @@ ev_document_get_type (void)
 
        if (G_UNLIKELY (type == 0))
        {
-               static const GTypeInfo our_info =
+               const GTypeInfo our_info =
                {
                        sizeof (EvDocumentIface),
                        NULL,
@@ -185,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;
@@ -213,28 +220,11 @@ 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;
 }
 
-EvOrientation
-ev_document_get_orientation (EvDocument *document)
-{
-       EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
-
-       return iface->get_orientation (document);
-}
-
-void
-ev_document_set_orientation (EvDocument     *document,
-                            EvOrientation   orientation)
-{
-       EvDocumentIface *iface = EV_DOCUMENT_GET_IFACE (document);
-
-       iface->set_orientation (document, orientation);
-}
-
 void
 ev_document_info_free (EvDocumentInfo *info)
 {
@@ -250,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));
+}