[cairo] GTK+, Cairo, XLib integration for fast 2D graphics drawing
chris at chris-wilson.co.uk
Mon Mar 19 03:51:16 PDT 2012
On Mon, 19 Mar 2012 12:43:31 +0200, Christos Sotiriou <csotiriou at gmail.com> wrote:
> 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
If you can create a small benchmark for your current drawing routine,
i.e. extract out your GtkWidget put it into a window and add some
dummy/representation data, I am very interested in making sure that
the drivers are performing as well as can be expected.
Chris Wilson, Intel Open Source Technology Centre
More information about the cairo