Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

file loading difference

tanyeun
2010-03-23
2013-03-05
  • tanyeun
    tanyeun
    2010-03-23

    recently I tried the newest version of xournal(0.4.5)
    and I found out the way xournal read files were different
    old version read all files at once, which take longer time for large pdf files but very fluent when you read the files
    new one read files by pages, which loads fast but will have a little lag when reading from pages to pages
    especially when you need to jump between chapters for ebooks
    I am thinking of an improvement in between
    is it possible to read like 10 pages or so each time?
    if jump pages, just load the target page instead of all the other pages in between
    if I want to try modify the code myself, where should I start?

    thx,

    David

     
  • Denis Auroux
    Denis Auroux
    2010-03-23

    First: you can ask all pages to be loaded/scaled by disabling "Progressive Backgrounds" in the options menu. But this slows things down at startup and uses more RAM especially if you zoom in.

    Also: if you keep the "Progressive" option enabled, and if you jump to a target page by entering its number in the selection box at the lower-left then the pages in between should NOT get loaded. (If you scroll, the intermediate pages do get loaded because they become visible at some point while you're scrolling!)

    The source code for this part is complicated, but look for:

    - add_bgpdf_request() enqueues a request for a particular PDF page at a particular zoom level; once the request gets processed, bgpdf_update_bg() gets called from within bgpdf_scheduler_callback() to actually display the bitmap.

    - rescale_bg_pixmaps() is normally in charge of calling add_bgpdf_request() whenever needed

    - when in progressive mode, do_switch_page() (which is called whenever a new page is switched to) is in charge of calling rescale_bg_pixmaps() to cause things to be refreshed when needed. Otherwise, rescaling/reloading happens when you change the zoom level or load a new file (look for all places where rescale_bg_pixmaps() is called in the code).

    So concretely you could either modify rescale_bg_pixmaps() to have it request backgrounds based on a different logic than the current one (probably the best way); or just add calls to add_bgpdf_request() in those places where you think a page should be requested specifically (be careful).

    Denis

     
  • same problem here

    xournal is very slow when change page

     
  • ok solved by disable progressive option from menu :)