2010/3/18 Krzysztof KosiĆski <tweenk.pl@...400...>:
Here are some requirements for our canvas. 0. Based on Cairo.
- Model/view split: objects displayed on the canvas can exist without it.
NRArenaItems do exist separately, all cairo stuff should definitely be under them.
- Widgetless rendering: it should be possible to render completely in
memory, for example for console-mode PDF export.
Our NRArena satisfies this, and indeed is used for things other than the main editing area.
- No excessive ties to Inkscape - implemented as a library, perhaps
using a few well-defined portions of the existing codebase (e.g. 2geom).
Sounds nice, but would be quite difficult to extract the arena stuff from Inkscape.
- Canvas primitives should be sufficient to render SVG.
They obviously are now, since we render it :)
There are many things to discuss, but here's the first one: Tiling reduces the area of the screen that needs to be redrawn, but increases the number of drawing operations. We could instead have a tile-less system that would compute the affected bounding box and redraw it in one go, instead of redrawing many tiles. What do you think?
The reason for redrawing tiles is improving interactivity at the cost of increasing render time. Since Inkscape is single-threaded, we need ways to interrupt rendering and respond to user actions. For this, the renderer runs a main loop iteration after each tile, potentially cancelling this render if the user did something that needs redraw, such as zoom. Another reason is that tiles allow Inkscape to show parts of the image before other parts are ready, and thus allow the user to quickly take a decision on what to do next, without waiting for the whole screen to finish; for this, tile rendering always starts with the point where your mouse cursor is (i.e. where you work) and spreads from it outwards. The performance cost of rendering separate tiles is real, for example each tile covering a path should do its own path calculations, and some of them are inevitably done on the entire path even if you're redrawing only one tile. However, this cost can be reduced by smart cashing of calculation-intensive data associated with objects.