X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=backend%2Fpixbuf%2Fpixbuf-document.c;h=ae7b4376cb27c116da0d8558bd6ddac1981a7667;hb=6ac3eb8adb9f4bb8c59c832e7d83334243d90cd5;hp=978970ddbf6ee3f0116575e2d8be55c69b1b1d6c;hpb=e3ef2dccab9e03cd510a37ba7e64b681be38f65c;p=evince.git diff --git a/backend/pixbuf/pixbuf-document.c b/backend/pixbuf/pixbuf-document.c index 978970dd..ae7b4376 100644 --- a/backend/pixbuf/pixbuf-document.c +++ b/backend/pixbuf/pixbuf-document.c @@ -21,7 +21,6 @@ #include #include "pixbuf-document.h" -#include "ev-document-thumbnails.h" #include "ev-document-misc.h" #include "ev-file-helpers.h" @@ -41,13 +40,7 @@ struct _PixbufDocument typedef struct _PixbufDocumentClass PixbufDocumentClass; -static void pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface); - -EV_BACKEND_REGISTER_WITH_CODE (PixbufDocument, pixbuf_document, - { - EV_BACKEND_IMPLEMENT_INTERFACE (EV_TYPE_DOCUMENT_THUMBNAILS, - pixbuf_document_document_thumbnails_iface_init) - }); +EV_BACKEND_REGISTER (PixbufDocument, pixbuf_document) static gboolean pixbuf_document_load (EvDocument *document, @@ -127,6 +120,27 @@ pixbuf_document_render (EvDocument *document, return surface; } +static GdkPixbuf * +pixbuf_document_get_thumbnail (EvDocument *document, + EvRenderContext *rc) +{ + PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); + GdkPixbuf *pixbuf, *rotated_pixbuf; + gint width, height; + + width = (gint) (gdk_pixbuf_get_width (pixbuf_document->pixbuf) * rc->scale); + height = (gint) (gdk_pixbuf_get_height (pixbuf_document->pixbuf) * rc->scale); + + pixbuf = gdk_pixbuf_scale_simple (pixbuf_document->pixbuf, + width, height, + GDK_INTERP_BILINEAR); + + rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation); + g_object_unref (pixbuf); + + return rotated_pixbuf; +} + static void pixbuf_document_finalize (GObject *object) { @@ -151,37 +165,9 @@ pixbuf_document_class_init (PixbufDocumentClass *klass) ev_document_class->get_n_pages = pixbuf_document_get_n_pages; ev_document_class->get_page_size = pixbuf_document_get_page_size; ev_document_class->render = pixbuf_document_render; + ev_document_class->get_thumbnail = pixbuf_document_get_thumbnail; } -static GdkPixbuf * -pixbuf_document_thumbnails_get_thumbnail (EvDocumentThumbnails *document, - EvRenderContext *rc, - gboolean border) -{ - PixbufDocument *pixbuf_document = PIXBUF_DOCUMENT (document); - GdkPixbuf *pixbuf, *rotated_pixbuf; - gint width, height; - - width = (gint) (gdk_pixbuf_get_width (pixbuf_document->pixbuf) * rc->scale); - height = (gint) (gdk_pixbuf_get_height (pixbuf_document->pixbuf) * rc->scale); - - pixbuf = gdk_pixbuf_scale_simple (pixbuf_document->pixbuf, - width, height, - GDK_INTERP_BILINEAR); - - rotated_pixbuf = gdk_pixbuf_rotate_simple (pixbuf, 360 - rc->rotation); - g_object_unref (pixbuf); - - return rotated_pixbuf; -} - -static void -pixbuf_document_document_thumbnails_iface_init (EvDocumentThumbnailsInterface *iface) -{ - iface->get_thumbnail = pixbuf_document_thumbnails_get_thumbnail; -} - - static void pixbuf_document_init (PixbufDocument *pixbuf_document) {