From a022d124e61a8c7d38a598abc36bad46bc8a828b Mon Sep 17 00:00:00 2001 From: Fabio D'Urso Date: Mon, 2 Jul 2012 08:28:23 +0200 Subject: [PATCH] pageview: Send pixmap preload requests in order of increasing distance from the viewport (instead of requesting everything past it till the end of the document, and then starting to load backwards) --- ui/pageview.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 0015aa19e..ec29bf0e6 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -4019,10 +4019,7 @@ void PageView::slotRequestVisiblePixmaps( int newValue ) requestedPixmaps.push_back( new Okular::PixmapRequest( PAGEVIEW_ID, i->pageNumber(), i->uncroppedWidth(), i->uncroppedHeight(), PAGEVIEW_PRELOAD_PRIO, true ) ); } - } - for( int j = 1; j <= pagesToPreload; j++ ) - { // add the page before the 'visible series' in preload int headRequest = d->visibleItems.first()->pageNumber() - j; if ( headRequest >= 0 ) @@ -4033,6 +4030,10 @@ void PageView::slotRequestVisiblePixmaps( int newValue ) requestedPixmaps.push_back( new Okular::PixmapRequest( PAGEVIEW_ID, i->pageNumber(), i->uncroppedWidth(), i->uncroppedHeight(), PAGEVIEW_PRELOAD_PRIO, true ) ); } + + // stop if we've already reached both ends of the document + if ( headRequest < 0 && tailRequest >= (int)d->items.count() ) + break; } }