Sunday, November 18, 2012

Tiling rendering in Evince

One of the oldest bug in evince is the ability to zoom-in a large scales, like 1600% or more. This happens because the Cache that render the pages can only render full pages and rendering full pages at large scales eats a lot of memory. So some days ago I started to work on making the cache in evince "tile" aware, that is, to render only portions of a full page. I am happy to say that a preliminary result can be found in
my evince repo in github (github.com/jaliste/evince) in the wip/tiling_manager branch. Right now a lot of things still don't work, but tile rendering in single and continuous mode are working (not in dual mode yet)...


video

In the video above, you can see evince rendering a page using 256 tiles. The red tiles only appear while there is no rendered tile, and are just there to test the code.

Note that the rendering 256 tiles is quite slow because Poppler will reparse the pdf file each time we render a tile... So why bother? In fact, the video is only for ilustration, ideally evince will use tiles of the size of the screen or around that size, so you only get to see a few tiles at a time. The main advantage of this code is that now we can easily implement larger zoom modes. The next picture shows Evince running the Pdf 1.7 reference document at 1600% using 256 tiles for each page. Memory used by evince is around 150 M with this.



Unfortunately, there are a lot of things that still don't work...selections, dual_page mode, and other... Also since this is a main refactor/rework of the Cache code, it will need a lot of testing and review before it gets merged into master (as new code it is likely to have more bugs and we don't want to evince to be unstable) ... but we are right in the begining of the 3.7 cycle, so I hope I can get this merged into evince 3.8.


1 comment: