]> www.fi.muni.cz Git - evince.git/blobdiff - pdf/ev-poppler.cc
only call ev_properties_fonts_set_document() if the document implements
[evince.git] / pdf / ev-poppler.cc
index 92f89a660bfaa4ae2844d824affee39bd151e0f2..aa33b7f1ba39726b3522fcbd72da5ccbc8522254 100644 (file)
@@ -83,6 +83,7 @@ static void pdf_document_thumbnails_get_dimensions      (EvDocumentThumbnails
 static int  pdf_document_get_n_pages                   (EvDocument                *document);
 
 static EvLink * ev_link_from_action (PopplerAction *action);
+static void pdf_document_search_free (PdfDocumentSearch   *search);
 
 
 G_DEFINE_TYPE_WITH_CODE (PdfDocument, pdf_document, G_TYPE_OBJECT,
@@ -358,8 +359,7 @@ pdf_document_render_pixbuf (EvDocument   *document,
                                       0, 0,
                                       width, height,
                                       rc->scale,
-                                      pixbuf,
-                                      0, 0);
+                                      pixbuf);
        
        g_object_unref (poppler_page);
        
@@ -821,9 +821,8 @@ make_thumbnail_for_size (PdfDocument *pdf_document,
                         gboolean     border)
 {
        PopplerPage *poppler_page;
-       GdkPixbuf *pixbuf;
+       GdkPixbuf *pixbuf, *sub_pixbuf;
        int width, height;
-       int x_offset, y_offset;
        double scale;
        gdouble unscaled_width, unscaled_height;
 
@@ -837,20 +836,24 @@ make_thumbnail_for_size (PdfDocument *pdf_document,
 
        if (border) {
                pixbuf = ev_document_misc_get_thumbnail_frame (width, height, NULL);
-               x_offset = 1;
-               y_offset = 1;
+
+               sub_pixbuf = gdk_pixbuf_new_subpixbuf (pixbuf,
+                                                      1, 1,
+                                                      width - 1, height - 1);
        } else {
                pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
                                         width, height);
                gdk_pixbuf_fill (pixbuf, 0xffffffff);
-               x_offset = 0;
-               y_offset = 0;
+               sub_pixbuf = gdk_pixbuf_new_subpixbuf (pixbuf,
+                                                      0, 0,
+                                                      width, height);
        }
 
        poppler_page_render_to_pixbuf (poppler_page, 0, 0,
                                       width, height,
-                                      scale, pixbuf,
-                                      x_offset, y_offset);
+                                      scale, sub_pixbuf);
+
+       g_object_unref (G_OBJECT (sub_pixbuf));
 
        g_object_unref (poppler_page);
        return pixbuf;
@@ -1235,11 +1238,35 @@ pdf_selection_get_selection_region (EvSelection     *selection,
        return retval;
 }
 
+GdkRegion *
+pdf_selection_get_selection_map (EvSelection     *selection,
+                                EvRenderContext *rc)
+{
+       PdfDocument *pdf_document;
+       PopplerPage *poppler_page;
+       PopplerRectangle points;
+       GdkRegion *retval;
+
+       pdf_document = PDF_DOCUMENT (selection);
+       poppler_page = poppler_document_get_page (pdf_document->document,
+                                                 rc->page);
+       set_page_orientation (pdf_document, poppler_page);
+
+       points.x1 = 0.0;
+       points.y1 = 0.0;
+       poppler_page_get_size (poppler_page, &(points.x2), &(points.y2));
+       retval = poppler_page_get_selection_region (poppler_page, 1.0, &points);
+       g_object_unref (poppler_page);
+
+       return retval;
+}
+
 static void
 pdf_selection_iface_init (EvSelectionIface *iface)
 {
         iface->render_selection = pdf_selection_render_selection;
         iface->get_selection_region = pdf_selection_get_selection_region;
+        iface->get_selection_map = pdf_selection_get_selection_map;
 }
 
 PdfDocument *