Re: speed of gdk rectangles ; X vs Win32



Hi,

Carsten Burstedde <bursted iam uni-bonn de> writes:

> > While looking through the archives I noticed questions (Jan 2000) about why
> > anyone
> > would want to draw lots of rectangles. I have such code: it is a finite
> > difference solver where results are given on a rectangular mesh.
> > Displaying results involves filling the screen with lots of abutting
> > rectangles.
> 
> Another way to achieve this ist to copy the rectangles into a single chunk of
> data suitable for gdk_draw_rgb_image. This takes place in client memory and
> should be fast. Then the function can be used to draw into a pixmap, which is
> copied to the window as needed in a gtk_draw_area expose handler.

I doubt you can write code that draws filled rectangles faster than your
graphics card. Filled solid rectangles are drawn in hardware unless your
display driver sucks completely and you can't beat that speed. The problem
when drawing lots of rectangles one by one is the function call overhead 
and the fact that you have to do the setup for drawing filled rectangles 
(in GDK and in your gfx card) very often which takes considerably more time 
than the actual drawing.

As an example, a (reasonably optimized) software implementation to draw 
solid-colored filled rectangles draws 60.8 MPixel/sec on my computer. 
If I let my gfx card to this work, this number goes up to 373.6 MPixel/sec. 
I have seen other gfx cards achieving around 4 GPixel/sec on the same test.


Salut, Sven



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]