+Tue Jan 4 21:25:05 2005 Jonathan Blandford <jrb@redhat.com>
+
+ * pdf/xpdf/pdf-document.cc: Do real thumbnailing of PDF files.
+ It's slow, but I'll speed it up next!
+
2005-01-04 Jeff Muizelaar <jrmuizel@nit.ca>
* shell/main.c (load_files):
}
void GDKSplashOutputDev::dump() {
- if (incrementalUpdate) {
+ if (incrementalUpdate && redrawCbk) {
(*redrawCbk)(redrawCbkData);
}
}
g_free (gdk_buf);
}
+void GDKSplashOutputDev::drawToPixbuf(GdkPixbuf *pixbuf, int pageNum) {
+
+}
+
GBool GDKSplashOutputDev::findText(Unicode *s, int len,
GBool startAtTop, GBool stopAtBottom,
GBool startAtLast, GBool stopAtLast,
int destX, int destY,
int width, int height);
+ void drawToPixbuf(GdkPixbuf *pixbuf, int pageNum);
+
// Find a string. If <startAtTop> is true, starts looking at the
// top of the page; else if <startAtLast> is true, starts looking
// immediately after the last find result; else starts looking at
}
/* Thumbnails */
+static GdkPixbuf *
+pdf_document_thumbnails_get_page_pixbuf (PdfDocument *pdf_document,
+ gdouble scale_factor,
+ gint page_num,
+ gint width,
+ gint height)
+{
+ GdkPixmap *pixmap;
+ GDKSplashOutputDev *output;
+ GdkPixbuf *pixbuf;
+
+ pixmap = gdk_pixmap_new (pdf_document->target,
+ width, height, -1);
+
+ output = new GDKSplashOutputDev (gdk_drawable_get_screen (pdf_document->target),
+ NULL, NULL);
+ output->startDoc (pdf_document->doc->getXRef());
+ pdf_document->doc->displayPage (output,
+ page_num + 1,
+ 72*scale_factor,
+ 72*scale_factor,
+ 0, gTrue, gFalse);
+ output->redraw (0, 0,
+ pixmap,
+ 0, 0,
+ width, height);
+ pixbuf = gdk_pixbuf_get_from_drawable (NULL,
+ pixmap,
+ NULL,
+ 0, 0,
+ 0, 0,
+ width, height);
+ gdk_drawable_unref (pixmap);
+ delete output;
+ return pixbuf;
+}
+
static GdkPixbuf *
pdf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document_thumbnails,
gint page,
thumbnail = tmp_pixbuf;
} else {
gdouble page_ratio;
+ gdouble scale_factor;
gint dest_height;
page_ratio = the_page->getHeight () / the_page->getWidth ();
+ scale_factor = (gdouble)width / the_page->getWidth ();
dest_height = (gint) (width * page_ratio);
-
- thumbnail = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, dest_height);
- gdk_pixbuf_fill (thumbnail, 0xffffffff);
+
+ thumbnail = pdf_document_thumbnails_get_page_pixbuf (pdf_document,
+ scale_factor,
+ page,
+ width,
+ dest_height);
+
/* FIXME: Actually get the image... */
}
GtkTreeIter iter;
tmp = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (priv->document),
- priv->current_page, THUMBNAIL_WIDTH);
+ priv->current_page, THUMBNAIL_WIDTH);
-#if 1
+#if 0
/* Don't add the shadow for now, as it's really slow */
pixbuf = g_object_ref (tmp);
#else