[evince] sidebar-thumbnails: preload one extra visible range while scrolling



commit 1fc8c68c53daa89eedf84d6d36b24c4afd5441c6
Author: Nelson Benítez León <nbenitezl+gnome gmail com>
Date:   Sat Jun 3 19:35:55 2017 +0500

    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

 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 6876c40..7822c27 100644
--- a/shell/ev-sidebar-thumbnails.c
+++ b/shell/ev-sidebar-thumbnails.c
@@ -547,6 +547,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;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]