From a128703a550dd27b7ef6085f5af12975e9e20681 Mon Sep 17 00:00:00 2001 From: Nelson Benitez Leon Date: Sat, 3 Jun 2017 19:35:55 +0500 Subject: sidebar-thumbnails: preload one extra visible range while scrolling Preload both before and after current visible scrolling range, the same amount of thumbnails in it, to help prevent thumbnail creation happening in the user's sight. https://bugzilla.gnome.org/show_bug.cgi?id=342110#c15 origin commit: https://git.gnome.org/browse/evince/commit/?id=1fc8c68 --- shell/ev-sidebar-thumbnails.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index 22054251..20243e5b 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -476,6 +476,14 @@ update_visible_range (EvSidebarThumbnails *sidebar_thumbnails, { EvSidebarThumbnailsPrivate *priv = sidebar_thumbnails->priv; int old_start_page, old_end_page; + int n_pages_in_visible_range; + + /* Preload before and after current visible scrolling range, the same amount of + * thumbs in it, to help prevent thumbnail creation happening in the user's sight. + * https://bugzilla.gnome.org/show_bug.cgi?id=342110#c15 */ + n_pages_in_visible_range = (end_page - start_page) + 1; + start_page = MAX (0, start_page - n_pages_in_visible_range); + end_page = MIN (priv->n_pages - 1, end_page + n_pages_in_visible_range); old_start_page = priv->start_page; old_end_page = priv->end_page; -- cgit v1.2.1