diff --git a/core/document.cpp b/core/document.cpp --- a/core/document.cpp +++ b/core/document.cpp @@ -1282,6 +1282,7 @@ const qulonglong memoryToFree = calculateMemoryToFree(); const int currentViewportPage = (*m_viewportIterator).pageNumber; int maxDistance = INT_MAX; // Default: No maximum + qCDebug(OkularCoreDebug) << "sendGeneratorPixmapRequest entry for " << currentViewportPage; if ( memoryToFree ) { AllocatedPixmap *pixmapToReplace = searchLowestPriorityPixmap( true ); @@ -1303,7 +1304,12 @@ QRect requestRect = r->isTile() ? r->normalizedRect().geometry( r->width(), r->height() ) : QRect( 0, 0, r->width(), r->height() ); TilesManager *tilesManager = r->d->tilesManager(); + double normalizedArea = r->normalizedRect().width() * r->normalizedRect().height(); + qCDebug(OkularCoreDebug) << "sendGeneratorPixmapRequest loop (tile): for " << currentViewportPage << " isTile: " << r->isTile() + << " preload: " << r->preload() + << " normalizedRect" << r->normalizedRect() + << " requestRect=" << requestRect << " wxh=" << r->width() << " x " << r->height(); // If it's a preload but the generator is not threaded no point in trying to preload if ( r->preload() && !m_generator->hasFeature( Generator::Threaded ) ) { @@ -1319,17 +1325,20 @@ else if ( !r->d->mForce && r->preload() && qAbs( r->pageNumber() - currentViewportPage ) >= maxDistance ) { m_pixmapRequestsStack.pop_back(); - //qCDebug(OkularCoreDebug) << "Ignoring request that doesn't fit in cache"; + qCDebug(OkularCoreDebug) << "Ignoring request that doesn't fit in cache"; delete r; } // Ignore requests for pixmaps that are already being generated else if ( tilesManager && tilesManager->isRequesting( r->normalizedRect(), r->width(), r->height() ) ) { + qCDebug(OkularCoreDebug).nospace() << "ignore already gen req for " << r->pageNumber(); m_pixmapRequestsStack.pop_back(); delete r; } - // If the requested area is above 8000000 pixels, switch on the tile manager - else if ( !tilesManager && m_generator->hasFeature( Generator::TiledRendering ) && (long)r->width() * (long)r->height() > 8000000L ) + // If the requested area is above 8000000 pixels, and we're not rendering most of the page, switch on the tile manager + else if ( !tilesManager && m_generator->hasFeature( Generator::TiledRendering ) && + (long)r->width() * (long)r->height() > 8000000L && + normalizedArea < 0.75 && normalizedArea != 0 ) { // if the image is too big. start using tiles qCDebug(OkularCoreDebug).nospace() << "Start using tiles on page " << r->pageNumber() @@ -1373,6 +1382,7 @@ r->setNormalizedRect( tilesRect ); request = r; + qCDebug(OkularCoreDebug).nospace() << "large case request set:" << r; } else { @@ -1382,6 +1392,7 @@ // zoom level to a tiled one m_pixmapRequestsStack.pop_back(); delete r; + qCDebug(OkularCoreDebug).nospace() << "large case request discard"; } } // If the requested area is below 6000000 pixels, switch off the tile manager @@ -1418,6 +1429,7 @@ if ( !request ) { m_pixmapRequestsMutex.unlock(); + qCDebug(OkularCoreDebug) << "sendGeneratorPixmapRequest exit !request for " << currentViewportPage; return; } @@ -1468,6 +1480,7 @@ // pino (7/4/2006): set the polling interval from 10 to 30 QTimer::singleShot( 30, m_parent, SLOT(sendGeneratorPixmapRequest()) ); } + qCDebug(OkularCoreDebug) << "sendGeneratorPixmapRequest exit bottom for " << currentViewportPage; } void DocumentPrivate::rotationFinished( int page, Okular::Page *okularPage ) diff --git a/ui/presentationwidget.cpp b/ui/presentationwidget.cpp --- a/ui/presentationwidget.cpp +++ b/ui/presentationwidget.cpp @@ -1447,7 +1447,10 @@ QApplication::setOverrideCursor( QCursor( Qt::BusyCursor ) ); // request the pixmap QLinkedList< Okular::PixmapRequest * > requests; - requests.push_back( new Okular::PixmapRequest( this, m_frameIndex, pixW, pixH, PRESENTATION_PRIO, Okular::PixmapRequest::NoFeature ) ); + Okular::PixmapRequest * mainRequest = new Okular::PixmapRequest( this, m_frameIndex, pixW, pixH, PRESENTATION_PRIO, Okular::PixmapRequest::NoFeature ); + mainRequest->setNormalizedRect(Okular::NormalizedRect(0,0,1,1)); + + requests.push_back( mainRequest ); // restore cursor QApplication::restoreOverrideCursor(); // ask for next and previous page if not in low memory usage setting