diff options
author | Nelson Benitez Leon <[email protected]> | 2017-06-03 19:35:55 +0500 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-15 14:45:59 +0200 |
commit | a128703a550dd27b7ef6085f5af12975e9e20681 (patch) | |
tree | 1109324b16a732e91fbdea4082e0ae20c46bcdbd | |
parent | b601eabe6000466d35bafd70b21c65d3fafb933f (diff) | |
download | atril-a128703a550dd27b7ef6085f5af12975e9e20681.tar.bz2 atril-a128703a550dd27b7ef6085f5af12975e9e20681.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
-rw-r--r-- | shell/ev-sidebar-thumbnails.c | 8 |
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; |