426
426
return g_list_reverse (retval);
430
pdf_document_render_pixbuf (EvDocument *document,
429
static cairo_surface_t *
430
pdf_document_render (EvDocument *document,
433
433
PdfDocument *pdf_document;
434
cairo_surface_t *surface;
435
435
double width_points, height_points;
436
436
gint width, height;
448
448
width = (int) ((width_points * rc->scale) + 0.5);
449
449
height = (int) ((height_points * rc->scale) + 0.5);
452
#ifdef HAVE_POPPLER_PAGE_RENDER
455
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
457
memset (cairo_image_surface_get_data (surface), 0xff,
458
cairo_image_surface_get_height (surface) *
459
cairo_image_surface_get_stride (surface));
461
cr = cairo_create (surface);
462
switch (rc->rotation) {
464
cairo_translate (cr, width, 0);
467
cairo_translate (cr, width, height);
470
cairo_translate (cr, 0, height);
473
cairo_translate (cr, 0, 0);
475
cairo_scale (cr, rc->scale, rc->scale);
476
cairo_rotate (cr, rc->rotation * G_PI / 180.0);
477
poppler_page_render (POPPLER_PAGE (rc->data), cr);
479
#else /* HAVE_POPPLER_PAGE_RENDER */
452
482
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
671
703
iface->get_page_label = pdf_document_get_page_label;
672
704
iface->has_attachments = pdf_document_has_attachments;
673
705
iface->get_attachments = pdf_document_get_attachments;
674
iface->render_pixbuf = pdf_document_render_pixbuf;
706
iface->render = pdf_document_render;
675
707
iface->get_text = pdf_document_get_text;
676
708
iface->can_get_text = pdf_document_can_get_text;
677
709
iface->get_info = pdf_document_get_info;
1614
1645
pdf_document = PDF_DOCUMENT (selection);
1615
1646
set_rc_data (pdf_document, rc);
1617
poppler_page_get_size (POPPLER_PAGE (rc->data), &width_points, &height_points);
1648
poppler_page_get_size (POPPLER_PAGE (rc->data),
1649
&width_points, &height_points);
1618
1650
width = (int) ((width_points * rc->scale) + 0.5);
1619
1651
height = (int) ((height_points * rc->scale) + 0.5);
1621
if (*pixbuf == NULL) {
1622
* pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
1654
#ifdef HAVE_POPPLER_PAGE_RENDER
1657
if (*surface == NULL) {
1658
*surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
1663
cr = cairo_create (*surface);
1664
cairo_scale (cr, rc->scale, rc->scale);
1665
cairo_surface_set_device_offset (*surface, 0, 0);
1666
memset (cairo_image_surface_get_data (*surface), 0x00,
1667
cairo_image_surface_get_height (*surface) *
1668
cairo_image_surface_get_stride (*surface));
1627
1669
poppler_page_render_selection (POPPLER_PAGE (rc->data),
1628
rc->scale, rc->rotation, *pixbuf,
1629
1671
(PopplerRectangle *)points,
1630
1672
(PopplerRectangle *)old_points,
1673
POPPLER_SELECTION_NORMAL, /* SelectionStyle */
1677
#else /* HAVE_POPPLER_PAGE_RENDER */
1680
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
1684
poppler_page_render_selection_to_pixbuf (POPPLER_PAGE (rc->data),
1685
rc->scale, rc->rotation, pixbuf,
1686
(PopplerRectangle *)points,
1687
(PopplerRectangle *)old_points,
1688
POPPLER_SELECTION_NORMAL, /* SelectionStyle */
1692
cairo_surface_destroy (*surface);
1693
*surface = ev_document_misc_surface_from_pixbuf (pixbuf);
1694
g_object_unref (pixbuf);
1695
#endif /* HAVE_POPPLER_PAGE_RENDER */
1646
1709
set_rc_data (pdf_document, rc);
1648
retval = poppler_page_get_selection_region ((PopplerPage *)rc->data, rc->scale, (PopplerRectangle *) points);
1711
retval = poppler_page_get_selection_region ((PopplerPage *)rc->data,
1713
(PopplerRectangle *) points);