Hello, I gave a bit of thought to the fix I've sent earlier and now I would like to provide a better solution. Instead of preloading a fixed number of pages, it is set to preload as many pages at once as the number of columns is displayed. This makes viewing documents very neat as no blank pages are shown if scrolling at a reasonable speed.
Thanks, Igor -- :wq
--- pageview-orig.cpp 2009-09-21 00:08:56.000000000 +0300 +++ pageview.cpp 2009-09-21 00:10:43.000000000 +0300 @@ -3096,26 +3096,29 @@ // as the requests are done in the order as they appear in the list, // request first the next page and then the previous - // add the page after the 'visible series' in preload - int tailRequest = d->visibleItems.last()->pageNumber() + 1; - if ( tailRequest < (int)d->items.count() ) + int pagesToPreload = viewColumns(); + for( int j = 1; j <= pagesToPreload; j++ ) { - PageViewItem * i = d->items[ tailRequest ]; - // request the pixmap if not already present - if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->uncroppedWidth(), i->uncroppedHeight() ) && i->uncroppedWidth() > 0 ) - requestedPixmaps.push_back( new Okular::PixmapRequest( - PAGEVIEW_ID, i->pageNumber(), i->uncroppedWidth(), i->uncroppedHeight(), PAGEVIEW_PRELOAD_PRIO, true ) ); - } - - // add the page before the 'visible series' in preload - int headRequest = d->visibleItems.first()->pageNumber() - 1; - if ( headRequest >= 0 ) - { - PageViewItem * i = d->items[ headRequest ]; - // request the pixmap if not already present - if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->uncroppedWidth(), i->uncroppedHeight() ) && i->uncroppedWidth() > 0 ) - requestedPixmaps.push_back( new Okular::PixmapRequest( - PAGEVIEW_ID, i->pageNumber(), i->uncroppedWidth(), i->uncroppedHeight(), PAGEVIEW_PRELOAD_PRIO, true ) ); + // add the page after the 'visible series' in preload + int tailRequest = d->visibleItems.last()->pageNumber() + j; + if ( tailRequest < (int)d->items.count() ) + { + PageViewItem * i = d->items[ tailRequest ]; + // request the pixmap if not already present + if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->uncroppedWidth(), i->uncroppedHeight() ) && i->uncroppedWidth() > 0 ) + requestedPixmaps.push_back( new Okular::PixmapRequest( + PAGEVIEW_ID, i->pageNumber(), i->uncroppedWidth(), i->uncroppedHeight(), PAGEVIEW_PRELOAD_PRIO, true ) ); + } + // add the page before the 'visible series' in preload + int headRequest = d->visibleItems.first()->pageNumber() - j; + if ( headRequest >= 0 ) + { + PageViewItem * i = d->items[ headRequest ]; + // request the pixmap if not already present + if ( !i->page()->hasPixmap( PAGEVIEW_ID, i->uncroppedWidth(), i->uncroppedHeight() ) && i->uncroppedWidth() > 0 ) + requestedPixmaps.push_back( new Okular::PixmapRequest( + PAGEVIEW_ID, i->pageNumber(), i->uncroppedWidth(), i->uncroppedHeight(), PAGEVIEW_PRELOAD_PRIO, true ) ); + } } }
_______________________________________________ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel