[evince] ev-sidebar-thumbnails: Render thumbnails to a cairo surface instead of using GdkPixbuf



commit d47597cc6d10f061ea39b8b42d477747fefd8a00
Author: Carlos Garcia Campos <carlosgc gnome org>
Date:   Sat Mar 22 12:48:02 2014 +0100

    ev-sidebar-thumbnails: Render thumbnails to a cairo surface instead of using GdkPixbuf
    
    Now that the sidebar model uses cairo surfaces, getting a surface from
    the backend we avoid an unnecessary conversion from GdkPixbuf to cairo
    surface.

 shell/ev-sidebar-thumbnails.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c
index d747d79..8ab8fa8 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -495,6 +495,7 @@ add_range (EvSidebarThumbnails *sidebar_thumbnails,
                                                    page, priv->rotation,
                                                    get_scale_for_page (sidebar_thumbnails, page));
                         ev_job_thumbnail_set_has_frame (EV_JOB_THUMBNAIL (job), FALSE);
+                        ev_job_thumbnail_set_output_format (EV_JOB_THUMBNAIL (job), 
EV_JOB_THUMBNAIL_SURFACE);
                        g_object_set_data_full (G_OBJECT (job), "tree_iter",
                                                gtk_tree_iter_copy (&iter),
                                                (GDestroyNotify) gtk_tree_iter_free);
@@ -893,15 +894,10 @@ thumbnail_job_completed_callback (EvJobThumbnail      *job,
        EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv;
        GtkTreeIter                *iter;
         cairo_surface_t            *surface;
-        cairo_surface_t            *thumbnail;
-
-        thumbnail = gdk_cairo_surface_create_from_pixbuf (job->thumbnail,
-                                                          1,
-                                                          gtk_widget_get_window (widget));
-        surface = ev_document_misc_render_thumbnail_surface_with_frame (widget, thumbnail,
-                                                                        gdk_pixbuf_get_width 
(job->thumbnail),
-                                                                        gdk_pixbuf_get_height 
(job->thumbnail));
-        cairo_surface_destroy (thumbnail);
+
+        surface = ev_document_misc_render_thumbnail_surface_with_frame (widget,
+                                                                        job->thumbnail_surface,
+                                                                        -1, -1);
 
        iter = (GtkTreeIter *) g_object_get_data (G_OBJECT (job), "tree_iter");
        if (priv->inverted_colors)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]