diff options
author | Jonathan Blandford <jrb@redhat.com> | 2005-01-06 23:56:14 (GMT) |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2005-01-06 23:56:14 (GMT) |
commit | 2aadab6feb778de1be1a92f20ba60e44de571199 (patch) | |
tree | a5773d36548293d25e98053c8b04f8dc1df9932d /pdf | |
parent | b322dbd94ce1ef24aa1d40e18cc18d66c9c85ef0 (diff) |
fill in the thumbnail with white. New interface to get the size of a page.
Thu Jan 6 18:48:11 2005 Jonathan Blandford <jrb@redhat.com>
* backend/ev-document-misc.c
(ev_document_misc_get_thumbnail_frame): fill in the thumbnail with
white.
* backend/ev-document-thumbnails.h: New interface to get the size
of a page.
Diffstat (limited to 'pdf')
-rw-r--r-- | pdf/xpdf/pdf-document.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/pdf/xpdf/pdf-document.cc b/pdf/xpdf/pdf-document.cc index d3f4ea6..a4049c6 100644 --- a/pdf/xpdf/pdf-document.cc +++ b/pdf/xpdf/pdf-document.cc @@ -1138,6 +1138,39 @@ pdf_document_thumbnails_get_page_pixbuf (PdfDocument *pdf_document, return pixbuf; } +static void +pdf_document_thumbnails_get_dimensions (EvDocumentThumbnails *document_thumbnails, + gint page, + gint suggested_width, + gint *width, + gint *height) +{ + PdfDocument *pdf_document = PDF_DOCUMENT (document_thumbnails); + Page *the_page; + Object the_thumb; + Thumb *thumb = NULL; + gdouble page_ratio; + + /* getPage seems to want page + 1 for some reason; */ + the_page = pdf_document->doc->getCatalog ()->getPage (page + 1); + the_page->getThumb (&the_thumb); + + + + if (!(the_thumb.isNull () || the_thumb.isNone())) { + /* Build the thumbnail object */ + thumb = new Thumb(pdf_document->doc->getXRef (), + &the_thumb); + + *width = thumb->getWidth (); + *height = thumb->getHeight (); + } else { + page_ratio = the_page->getHeight () / the_page->getWidth (); + *width = suggested_width; + *height = (gint) (suggested_width * page_ratio); + } +} + static GdkPixbuf * pdf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails, gint page, @@ -1202,6 +1235,7 @@ static void pdf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface) { iface->get_thumbnail = pdf_document_thumbnails_get_thumbnail; + iface->get_dimensions = pdf_document_thumbnails_get_dimensions; } |