X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=pixbuf%2Fpixbuf-document.c;h=01df2783b705b0e08911434c651af889b5624a18;hb=63291b1562445867a2c7b113cccadc2dd63a2925;hp=c8efd2d9588d21039dfbb7b60b978ab06b7ab9c8;hpb=809ca307a8b35886451648e3ae7d794a2a20c63e;p=evince.git diff --git a/pixbuf/pixbuf-document.c b/pixbuf/pixbuf-document.c index c8efd2d9..01df2783 100644 --- a/pixbuf/pixbuf-document.c +++ b/pixbuf/pixbuf-document.c @@ -1,5 +1,5 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ -/* pixbuf-document.h: Implementation of EvDocument for PIXBUF +/* * Copyright (C) 2004, Anders Carlsson * * This program is free software; you can redistribute it and/or modify @@ -18,6 +18,7 @@ */ #include "pixbuf-document.h" +#include "ev-document-thumbnails.h" struct _PixbufDocumentClass { @@ -38,10 +39,14 @@ struct _PixbufDocument typedef struct _PixbufDocumentClass PixbufDocumentClass; static void pixbuf_document_document_iface_init (EvDocumentIface *iface); +static void pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface); G_DEFINE_TYPE_WITH_CODE (PixbufDocument, pixbuf_document, G_TYPE_OBJECT, { G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT, - pixbuf_document_document_iface_init) }); + pixbuf_document_document_iface_init); + G_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, + pixbuf_document_document_thumbnails_iface_init) + }); static GObjectClass *parent_class; @@ -170,19 +175,6 @@ pixbuf_document_render (EvDocument *document, } } -static void -pixbuf_document_begin_find (EvDocument *document, - const char *search_string, - gboolean case_sensitive) -{ - -} - -static void -pixbuf_document_end_find (EvDocument *document) -{ -} - static void pixbuf_document_finalize (GObject *object) { @@ -215,10 +207,36 @@ pixbuf_document_document_iface_init (EvDocumentIface *iface) iface->set_page_offset = pixbuf_document_set_page_offset; iface->get_page_size = pixbuf_document_get_page_size; iface->render = pixbuf_document_render; - iface->begin_find = pixbuf_document_begin_find; - iface->end_find = pixbuf_document_end_find; } +static GdkPixbuf * +pixbuf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, + gint page, + gint width) +{ + PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); + GdkPixbuf *pixbuf; + gdouble scale_factor; + gint height; + + scale_factor = (gdouble)width / gdk_pixbuf_get_width (pixbuf_document->pixbuf); + + height = gdk_pixbuf_get_height (pixbuf_document->pixbuf) * scale_factor; + + pixbuf = gdk_pixbuf_scale_simple (pixbuf_document->pixbuf, width, height, + GDK_INTERP_BILINEAR); + + return pixbuf; +} + + +static void +pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface) +{ + iface->get_thumbnail = pixbuf_document_thumbnails_get_thumbnail; +} + + static void pixbuf_document_init (PixbufDocument *pixbuf_document) {