]> www.fi.muni.cz Git - evince.git/commitdiff
pdf: Bump poppler requirements to 0.16.0
authorCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 5 Jan 2011 16:32:46 +0000 (17:32 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Wed, 5 Jan 2011 16:32:46 +0000 (17:32 +0100)
And remove all unneeded #ifdefs.

backend/pdf/ev-poppler.cc
configure.ac

index 8c5b203ccb476eb9b6fe06ae835c88a216e68c3f..753fedc36f12385425c24b9171b5bc840af2caa8 100644 (file)
@@ -400,18 +400,6 @@ make_thumbnail_for_page (PopplerPage     *poppler_page,
                         gint             height)
 {
        GdkPixbuf *pixbuf;
-
-#ifdef POPPLER_WITH_GDK
-       pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
-                                width, height);
-       gdk_pixbuf_fill (pixbuf, 0xffffffff);
-
-       ev_document_fc_mutex_lock ();
-       poppler_page_render_to_pixbuf (poppler_page, 0, 0,
-                                      width, height,
-                                      rc->scale, rc->rotation, pixbuf);
-       ev_document_fc_mutex_unlock ();
-#else
        cairo_surface_t *surface;
 
        ev_document_fc_mutex_lock ();
@@ -420,7 +408,6 @@ make_thumbnail_for_page (PopplerPage     *poppler_page,
        
        pixbuf = ev_document_misc_pixbuf_from_surface (surface);
        cairo_surface_destroy (surface);
-#endif /* POPPLER_WITH_GDK */
 
        return pixbuf;
 }
@@ -431,6 +418,7 @@ pdf_document_get_thumbnail (EvDocument      *document,
 {
        PdfDocument *pdf_document = PDF_DOCUMENT (document);
        PopplerPage *poppler_page;
+       cairo_surface_t *surface;
        GdkPixbuf *pixbuf = NULL;
        GdkPixbuf *border_pixbuf;
        double page_width, page_height;
@@ -452,17 +440,11 @@ pdf_document_get_thumbnail (EvDocument      *document,
                height = temp;
        }
 
-#ifdef POPPLER_WITH_GDK
-       pixbuf = poppler_page_get_thumbnail_pixbuf (poppler_page);
-#else
-       cairo_surface_t *surface;
-       
        surface = poppler_page_get_thumbnail (poppler_page);
        if (surface) {
                pixbuf = ev_document_misc_pixbuf_from_surface (surface);
                cairo_surface_destroy (surface);
        }
-#endif /* POPPLER_WITH_GDK */
 
        if (pixbuf != NULL) {
                int thumb_width = (rc->rotation == 90 || rc->rotation == 270) ?
@@ -722,9 +704,7 @@ pdf_document_get_info (EvDocument *document)
        PopplerPermissions permissions;
        EvPage *page;
        char *metadata;
-#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
        gboolean linearized;
-#endif
 
        info = g_new0 (EvDocumentInfo, 1);
 
@@ -761,11 +741,7 @@ pdf_document_get_info (EvDocument *document)
                      "producer", &(info->producer),
                      "creation-date", &(info->creation_date),
                      "mod-date", &(info->modified_date),
-#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
                      "linearized", &linearized,
-#else
-                     "linearized", &(info->linearized),
-#endif
                      "metadata", &metadata,
                      NULL);
 
@@ -871,9 +847,7 @@ pdf_document_get_info (EvDocument *document)
                info->security = g_strdup (_("No"));
        }
 
-#ifdef HAVE_POPPLER_DOCUMENT_IS_LINEARIZED
        info->linearized = linearized ? g_strdup (_("Yes")) : g_strdup (_("No"));
-#endif
 
        return info;
 }
@@ -1219,7 +1193,6 @@ ev_link_from_action (PdfDocument   *pdf_document,
                case POPPLER_ACTION_MOVIE:
                        unimplemented_action = "POPPLER_ACTION_MOVIE";
                        break;
-#if POPPLER_CHECK_VERSION (0, 13, 2)
                case POPPLER_ACTION_RENDITION:
                        unimplemented_action = "POPPLER_ACTION_RENDITION";
                        break;
@@ -1265,7 +1238,6 @@ ev_link_from_action (PdfDocument   *pdf_document,
 
                }
                        break;
-#endif
                case POPPLER_ACTION_UNKNOWN:
                        unimplemented_action = "POPPLER_ACTION_UNKNOWN";
        }
@@ -1917,31 +1889,11 @@ pdf_selection_get_selected_text (EvSelection     *selection,
                                 EvSelectionStyle style,
                                 EvRectangle     *points)
 {
-       PopplerPage *poppler_page;
-       char *retval;
-
-       poppler_page = POPPLER_PAGE (page->backend_page);
-
-#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
-       retval = poppler_page_get_selected_text (poppler_page,
-                                                (PopplerSelectionStyle)style,
-                                                (PopplerRectangle *)points);
-#else
-       PopplerRectangle r;
-       double height;
-
-       poppler_page_get_size (poppler_page, NULL, &height);
-       r.x1 = points->x1;
-       r.y1 = height - points->y2;
-       r.x2 = points->x2;
-       r.y2 = height - points->y1;
-
-       retval = poppler_page_get_text (poppler_page,
-                                       (PopplerSelectionStyle)style,
-                                       &r);
-#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
+       g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
 
-       return retval;
+       return poppler_page_get_selected_text (POPPLER_PAGE (page->backend_page),
+                                              (PopplerSelectionStyle)style,
+                                              (PopplerRectangle *)points);
 }
 
 static cairo_region_t *
@@ -2027,66 +1979,33 @@ pdf_document_text_get_text_mapping (EvDocumentText *document_text,
        return retval;
 }
 
-#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
-static gchar *
-pdf_document_text_get_text (EvDocumentText  *selection,
-                           EvPage          *page)
-{
-       PopplerPage *poppler_page;
-
-       g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
-
-       poppler_page = POPPLER_PAGE (page->backend_page);
-
-       return poppler_page_get_text (poppler_page);
-}
-#else
 static gchar *
 pdf_document_text_get_text (EvDocumentText  *selection,
                            EvPage          *page)
 {
-       PopplerPage *poppler_page;
-       PopplerRectangle r;
-
        g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
 
-       poppler_page = POPPLER_PAGE (page->backend_page);
-
-       r.x1 = 0;
-       r.y1 = 0;
-       poppler_page_get_size (poppler_page, &(r.x2), &(r.y2));
-
-       return poppler_page_get_text (poppler_page,
-                                     POPPLER_SELECTION_WORD,
-                                     &r);
+       return poppler_page_get_text (POPPLER_PAGE (page->backend_page));
 }
-#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
 
-#ifdef HAVE_POPPLER_PAGE_GET_TEXT_LAYOUT
 static gboolean
 pdf_document_text_get_text_layout (EvDocumentText  *selection,
                                   EvPage          *page,
                                   EvRectangle    **areas,
                                   guint           *n_areas)
 {
-       PopplerPage *poppler_page;
-
        g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), FALSE);
 
-       poppler_page = POPPLER_PAGE (page->backend_page);
-
-       return poppler_page_get_text_layout (poppler_page, (PopplerRectangle **)areas, n_areas);
+       return poppler_page_get_text_layout (POPPLER_PAGE (page->backend_page),
+                                            (PopplerRectangle **)areas, n_areas);
 }
-#endif
 
 static void
 pdf_document_text_iface_init (EvDocumentTextInterface *iface)
 {
         iface->get_text_mapping = pdf_document_text_get_text_mapping;
         iface->get_text = pdf_document_text_get_text;
-#ifdef HAVE_POPPLER_PAGE_GET_TEXT_LAYOUT
         iface->get_text_layout = pdf_document_text_get_text_layout;
-#endif
 }
 
 /* Page Transitions */
@@ -2560,7 +2479,6 @@ poppler_annot_color_to_gdk_color (PopplerAnnot *poppler_annot,
 static EvAnnotationTextIcon
 get_annot_text_icon (PopplerAnnotText *poppler_annot)
 {
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
        gchar *icon = poppler_annot_text_get_icon (poppler_annot);
        EvAnnotationTextIcon retval;
 
@@ -2591,15 +2509,11 @@ get_annot_text_icon (PopplerAnnotText *poppler_annot)
        g_free (icon);
 
        return retval;
-#else
-       return EV_ANNOTATION_TEXT_ICON_UNKNOWN;
-#endif
 }
 
 static const gchar *
 get_poppler_annot_text_icon (EvAnnotationTextIcon icon)
 {
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
        switch (icon) {
        case EV_ANNOTATION_TEXT_ICON_NOTE:
                return POPPLER_ANNOT_TEXT_ICON_NOTE;
@@ -2623,9 +2537,6 @@ get_poppler_annot_text_icon (EvAnnotationTextIcon icon)
        default:
                return POPPLER_ANNOT_TEXT_ICON_NOTE;
        }
-#else
-       return "Note";
-#endif
 }
 
 static EvAnnotation *
@@ -2867,7 +2778,6 @@ pdf_document_annotations_document_is_modified (EvDocumentAnnotations *document_a
        return PDF_DOCUMENT (document_annotations)->annots_modified;
 }
 
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
 static void
 pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotations,
                                         EvAnnotation          *annot,
@@ -2970,7 +2880,6 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
 
        pdf_document->annots_modified = TRUE;
 }
-#endif /* HAVE_POPPLER_PAGE_ADD_ANNOT */
 
 static void
 pdf_document_annotations_save_annotation (EvDocumentAnnotations *document_annotations,
@@ -2987,7 +2896,6 @@ pdf_document_annotations_save_annotation (EvDocumentAnnotations *document_annota
                poppler_annot_set_contents (poppler_annot,
                                            ev_annotation_get_contents (annot));
 
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
        if (mask & EV_ANNOTATIONS_SAVE_COLOR) {
                PopplerColor color;
                GdkColor     ev_color;
@@ -3026,7 +2934,7 @@ pdf_document_annotations_save_annotation (EvDocumentAnnotations *document_annota
                        poppler_annot_text_set_icon (text, get_poppler_annot_text_icon (icon));
                }
        }
-#endif /* HAVE_POPPLER_PAGE_ADD_ANNOT */
+
        PDF_DOCUMENT (document_annotations)->annots_modified = TRUE;
 }
 
@@ -3035,9 +2943,7 @@ pdf_document_document_annotations_iface_init (EvDocumentAnnotationsInterface *if
 {
        iface->get_annotations = pdf_document_annotations_get_annotations;
        iface->document_is_modified = pdf_document_annotations_document_is_modified;
-#ifdef HAVE_POPPLER_PAGE_ADD_ANNOT
        iface->add_annotation = pdf_document_annotations_add_annotation;
-#endif
        iface->save_annotation = pdf_document_annotations_save_annotation;
 }
 
index f4ae133f8a38c652945042c57a73433c911d35af..afd863fd035ff2d935761654f4e1e5dd30da6a5a 100644 (file)
@@ -482,17 +482,10 @@ AC_ARG_ENABLE([pdf],
   [enable_pdf=yes])
 
 if test "x$enable_pdf" = "xyes"; then
-    POPPLER_REQUIRED=0.14.0
+    POPPLER_REQUIRED=0.16.0
     PKG_CHECK_MODULES(POPPLER, poppler-glib >= $POPPLER_REQUIRED libxml-2.0 >= $LIBXML_REQUIRED,enable_pdf=yes,enable_pdf=no)
 
     if test "x$enable_pdf" = "xyes"; then
-           evince_save_LIBS=$LIBS
-           LIBS="$LIBS $POPPLER_LIBS"
-           AC_CHECK_FUNCS(poppler_page_get_text_layout)
-           AC_CHECK_FUNCS(poppler_page_get_selected_text)
-           AC_CHECK_FUNCS(poppler_page_add_annot)
-           AC_CHECK_FUNCS(poppler_document_is_linearized)
-           LIBS=$evince_save_LIBS
            PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, enable_cairo_pdf=yes, enable_cairo_pdf=no)
            if test x$enable_cairo_pdf = xyes; then
                    AC_DEFINE([HAVE_CAIRO_PDF], [1], [defined if cairo-pdf is available])