diff --git a/src/image_viewer.c b/src/image_viewer.c index d71dc36..b1cf215 100644 --- a/src/image_viewer.c +++ b/src/image_viewer.c @@ -2102,22 +2102,22 @@ cb_rstto_image_loader_image_ready (GdkPixbufLoader *loader, RsttoImageViewerTran } viewer->priv->animation = gdk_pixbuf_loader_get_animation (loader); - viewer->priv->iter = gdk_pixbuf_animation_get_iter (viewer->priv->animation, NULL); - g_object_ref (viewer->priv->animation); - timeout = gdk_pixbuf_animation_iter_get_delay_time (viewer->priv->iter); - - if (timeout > 0) + if (gdk_pixbuf_animation_is_static_image (viewer->priv->animation)) { - viewer->priv->animation_timeout_id = - gdk_threads_add_timeout (timeout, (GSourceFunc) cb_rstto_image_viewer_update_pixbuf, viewer); + /* This is a single-frame image, there is no need to copy the pixbuf since it won't change */ + viewer->priv->pixbuf = gdk_pixbuf_animation_get_static_image (viewer->priv->animation); + g_object_ref (viewer->priv->pixbuf); } else { - /* This is a single-frame image, there is no need to copy the pixbuf since it won't change */ - viewer->priv->pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (viewer->priv->iter); - g_object_ref (viewer->priv->pixbuf); + viewer->priv->iter = gdk_pixbuf_animation_get_iter (viewer->priv->animation, NULL); + + timeout = gdk_pixbuf_animation_iter_get_delay_time (viewer->priv->iter); + + viewer->priv->animation_timeout_id = + gdk_threads_add_timeout (timeout, (GSourceFunc) cb_rstto_image_viewer_update_pixbuf, viewer); } } }