Re: [gtk-list] Re: Displaying JPEGs



Larry Lee <lclee@primenet.com> wrote:
>My initial code constructed an entire row of rgb byte values (800 pixels
>times 3 bytes) and used gdk_draw_rgb_image() to put the row on the screen.
>And this took about 113 seconds to draw the whole map (600 rows worth).
>I haven't tried sending over the entire image 800x600x3 yet, but I
>probably will soon.

Woah, that is *slow*. What speed do you get if you run testrgb? I have over 
7 m pixels/sec for this sort of operation.

I use the following call sequence:

in main():
	gtk_init( &argc, &argv );
	gdk_rgb_init();
	gtk_widget_set_default_colormap( gdk_rgb_get_cmap() );
	gtk_widget_set_default_visual( gdk_rgb_get_visual() );

in expose():
	gdk_draw_rgb_image( widget->window,
                widget->style->white_gc,
                left, top, width, height
                buffer, line_skip );

And I get fast repaints.

>In my reading I think I've found that a pixmap is maintained and
>manipulated in the server, while an image map is maintained in the
>client program.  And that everytime I call a function with a _draw_
>then I am sending a message through gdk and through xlib to the server.
>And I believe that it is all this extra communication that is causing the
>delays.

The gdk rgb functions automatically detect shared memory, and use that for
passing your image over. There should be no significant communication
overhead.

You're right, pixmaps are server-side, images are client side. But if client
and server are on the same machine, there is no real difference. I think it's
generally a good idea to avoid large pixmaps if you can, as they clog the
server up.

John
--
John Cupitt, john.cupitt@ng-london.org.uk, +44 (0)171 930 2108
VASARI Lab, The National Gallery, Trafalgar Square, London, WC2N 5DN



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