From 00fad2c0d0fcdade570a08f046e85a4558f1fc0c Mon Sep 17 00:00:00 2001 From: nanxiongchao Date: Mon, 20 Feb 2017 16:33:22 +0800 Subject: First page should not reloaded For the displayed page, do not reload every time, should be displayed immediately Tested successfully on Loongson 3A2000 with fedora25(mips64el distribution). --- libview/ev-pixbuf-cache.c | 2 +- libview/ev-view.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c index 3c4fd31b..409b9c39 100644 --- a/libview/ev-pixbuf-cache.c +++ b/libview/ev-pixbuf-cache.c @@ -90,7 +90,7 @@ static gboolean new_selection_surface_needed(EvPixbufCache *pixbuf_cac #define PAGE_CACHE_LEN(pixbuf_cache) \ (pixbuf_cache->start_page>=0?((pixbuf_cache->end_page - pixbuf_cache->start_page) + 1):0) -#define MAX_PRELOADED_PAGES 3 +#define MAX_PRELOADED_PAGES 20 G_DEFINE_TYPE (EvPixbufCache, ev_pixbuf_cache, G_TYPE_OBJECT) diff --git a/libview/ev-view.c b/libview/ev-view.c index af0c3433..b360b22d 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -732,12 +732,13 @@ view_update_range_and_current_page (EvView *view) } } + #define PAGE_CACHE_NUMBER 10 ev_page_cache_set_page_range (view->page_cache, - view->start_page, - view->end_page); + MAX(view->start_page - PAGE_CACHE_NUMBER, 0), + MIN(view->end_page + PAGE_CACHE_NUMBER, ev_document_get_n_pages (view->document) - 1)); ev_pixbuf_cache_set_page_range (view->pixbuf_cache, - view->start_page, - view->end_page, + MAX(view->start_page - PAGE_CACHE_NUMBER, 0), + MIN(view->end_page + PAGE_CACHE_NUMBER, ev_document_get_n_pages (view->document) - 1), view->selection_info.selections); if (ev_pixbuf_cache_get_surface (view->pixbuf_cache, view->current_page)) -- cgit v1.2.1