summaryrefslogtreecommitdiff
path: root/shell/ev-sidebar-thumbnails.c
diff options
context:
space:
mode:
authorNelson Benitez Leon <[email protected]>2017-06-03 19:35:55 +0500
committerraveit65 <[email protected]>2017-08-15 14:09:42 +0200
commitc3bc9fa16ddeae691b9154024725dd85d56011d7 (patch)
tree05bbed9c0d1a7d584dc2e5d74ba5a9f2f5b97f76 /shell/ev-sidebar-thumbnails.c
parent79a83766f4ce2f3ee29ada760e0a17f48e7be034 (diff)
downloadatril-c3bc9fa16ddeae691b9154024725dd85d56011d7.tar.bz2
atril-c3bc9fa16ddeae691b9154024725dd85d56011d7.tar.xz
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
Diffstat (limited to 'shell/ev-sidebar-thumbnails.c')
-rw-r--r--shell/ev-sidebar-thumbnails.c8
1 files changed, 8 insertions, 0 deletions
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;