[cairo] Scrolling/Panning Demo -- howto increase speed

Stefan Salewski mail at ssalewski.de
Sat Dec 11 08:20:33 PST 2010

I have written a small test application, which draws some graphics into
a GTK drawing area. It supports zooming, scrolling and panning:


As expected scrolling and panning is not really fast, because I always
redraw the whole content of the drawing area. For simple graphics this
is ok, but for more complicated stuff (electronics schematics editor) it
is not really nice.

Is there an not too complicated way to increase performance? 
Maybe copying part of the picture contents and redrawing only the
changed area? (First I intended to always draw to a large buffer area
and to copy only the visible zoomed in rectangle to the GTK drawing
area. That would make panning really fast, but may introduce overhead
for other operations.)

Maybe smarter demos are available -- I was not able to find one, so I
wrote it from scratch.

Best regards

Stefan Salewski

More information about the cairo mailing list