summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/eom-scroll-view.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index a82fc75..c83471c 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -1831,19 +1831,32 @@ image_loading_cancelled_cb (EomImage *img, gpointer data)
}
}
*/
+
+/* Use when the pixbuf in the view is changed, to keep a
+ reference to it and create its cairo surface. */
static void
-image_changed_cb (EomImage *img, gpointer data)
+update_pixbuf (EomScrollView *view, GdkPixbuf *pixbuf)
{
EomScrollViewPrivate *priv;
- priv = EOM_SCROLL_VIEW (data)->priv;
+ priv = view->priv;
if (priv->pixbuf != NULL) {
g_object_unref (priv->pixbuf);
priv->pixbuf = NULL;
}
- priv->pixbuf = eom_image_get_pixbuf (img);
+ priv->pixbuf = pixbuf;
+}
+
+static void
+image_changed_cb (EomImage *img, gpointer data)
+{
+ EomScrollViewPrivate *priv;
+
+ priv = EOM_SCROLL_VIEW (data)->priv;
+
+ update_pixbuf (EOM_SCROLL_VIEW (data), eom_image_get_pixbuf (img));
set_zoom_fit (EOM_SCROLL_VIEW (data));
check_scrollbar_visibility (EOM_SCROLL_VIEW (data), NULL);
@@ -2099,12 +2112,7 @@ display_next_frame_cb (EomImage *image, gint delay, gpointer data)
view = EOM_SCROLL_VIEW (data);
priv = view->priv;
- if (priv->pixbuf != NULL) {
- g_object_unref (priv->pixbuf);
- priv->pixbuf = NULL;
- }
-
- priv->pixbuf = eom_image_get_pixbuf (image);
+ update_pixbuf (view, eom_image_get_pixbuf (image));
gtk_widget_queue_draw (GTK_WIDGET (priv->display));
}
@@ -2137,7 +2145,7 @@ eom_scroll_view_set_image (EomScrollView *view, EomImage *image)
eom_image_data_ref (image);
if (priv->pixbuf == NULL) {
- priv->pixbuf = eom_image_get_pixbuf (image);
+ update_pixbuf (view, eom_image_get_pixbuf (image));
priv->progressive_state = PROGRESSIVE_NONE;
set_zoom_fit (view);
check_scrollbar_visibility (view, NULL);