[cairo] GTK+, Cairo, XLib integration for fast 2D graphics drawing

Christos Sotiriou csotiriou at gmail.com
Mon Mar 19 03:43:31 PDT 2012

On 18 March 2012 17:46, Chris Wilson <chris at chris-wilson.co.uk> wrote:

> On Sun, 18 Mar 2012 17:37:06 +0200, Christos Sotiriou <csotiriou at gmail.com>
> wrote:
> > My problem is that drawing is too, too slow when drawing >100K
> rectangles.
> > I have tried double buffering in two ways (a) by using a cairo image
> > surface, drawing upon it and then copying the pattern to my drawing
> > context, and (b) by using cairo's surface_create_similar() function,
> which
> > supposedly uses X.
> >
> > I have found that drawing is simply toooooo slow, every which way.
> My first suspicion is that you may simply be expecting too much. The
> fastest hardware I have can only render 2M 10x10 rectangles per second.
> Having said that, there are likely many tricks we can show you to improve
> your drawing performance, mostly to make you aware of exactly what you
> are asking to be drawn and to then simplify those operations until they
> match hardware capabilities.

Dear Chris, Dear Dov,

thanks again for your replies.

I have thought through my current approach carefully, and have concluded
that its weakness lies in the fact that I am drawing > 100K objects "live",
*i.e. *whenever the window is exposed or the user zooms in/out, I use cairo
to draw the double buffer image, then I copy it over to the GtkLayout

I believe it would be easier to create an cairo image surface at the
maximum required resolution, and then simply scale/pan that appropriately.



Christos P. Sotiriou
email: csotiriou at gmail.com
Cell: +30 697 8984 222
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120319/415ad818/attachment.htm>

More information about the cairo mailing list