Closed maxsteciuk closed 5 years ago
I can confirm that this does fix the compilation error. But pdf do not open. May or may not be related to this patch or another issue.
Separate issue Seems related to optimization and parallelization of page rendering code such as keeping track of pages.size() vs pagesStillLoading counter
I just wanted to leave it open for Ken to review and make the decision on.
Ok I think I figured out the rendering part of issue:
Renderer::imageHash(int pagenum) { if(!imageCache.contains(pagenum)) { return QImage(); } ... // push to cache // return from cache }
Proposed solution:
Renderer::imageHash(int pagenum) if(not imageCache.contains(pagenum)){ imageCache.push(pagenum, pages[pagenum].render()); return *imageCache.get(pagenum); } else { std::optional
cachedImage = imageCache.get(pagenum); if (cachedImage.has_value()) return cachedImage; else { // in case image in cache is somehow not rendered do we want to re-render it? imageCache.push(pagenum, pages[pagenum].render()); return imageCache.get(pagenum); } }
imageCache.push(pagenum, pages[pagenum].render()); return *imageCache.get(pagenum);
In mainUI.cpp the ShowPage() which Rendered::imageHash() is only invoked when "Slideshow" is invoked and never after page rendering is finished
In paralell mode there seems to be race codition when updating pagesStillLoading counter which drives checking whether rendering is complete and so the finished condition in MainUI::slotPageLoaded(int page) does not get called
P.S.
I was able test this snippet when running lumina-pdf in sequential mode (i.e. commenting out BACKEND->loadMultiThread() branch).
Closing PR. Overcome by events. The poppler backend has already been redone to ensure rapid loading of pages without overloading the page cache.
Fix for https://github.com/lumina-desktop/lumina/issues/662