
Actually, in interactive mode, we draw directly on the Xlib surface provided by GTK.
This way is really slow. On first stage of sK1 "cairofication" we also used direct drawing on Xlib surface. But as I have noticed in my presentation on LGM 2007, the surface is slow, because it uses X11 protocol. So rendering scheme:
model -> cairo -> Xlib surface (i.e. XWin)
should be considered as:
X CLIENT X SERVER model ->cairo -> xlib -> | X11 | ->Xlib -> XWin
X11 and Xlib don't support RGBA graphics, so to render RGBA images (for example antialiased curves) Cairo reads from X Server either part or whole canvas window as RGB image, pasts RGBA drawing on X Client side and returns back this RGB result. And this procedure is repeated for each drawing command. Therefore such rendering is very slow.
To increase rendering performance we use intermediate Image surface. Image surface is allocated on X Client side, so rendering on this surface is a quite fast. We use RGB Image surface, because it's compartible with Xlib. This surface is the same as canvas by size and has white bg. Our rendering scheme is following:
model -> Image (RGB) model -> Image (RGB) .... model -> Image (RGB) model -> Image (RGB)
--- End of model rendering ---
Image (RGB) -> Xlib surface
So we have only one bitmap transfer through X11 protocol and this has allowed us greatly increasing rendering performance.
Nevertheless, cairo rendering is slow, so this thread was really interesting for me and I'm going to play with latest Cairo branch to test current improvements.
I hope that our small expirience could be helpful for Inkscape development.
Regards,
Igor Novikov sK1 Project http://sk1project.org