Fast animation prototype code



I've wrote this example code and it seems to work properly both on Linux and Win32, I'm wandering if some GTK guru has some suggestions to improve it, obviously it's only an example, but this will be the structure that will be included in the application, the thread that build the image will be an h263 decoder that get the video through the net, this is why the simple image creation of the demo is made in a separate thread. It works without changes both in win32/linux and uses 5/10% of CPU of pretty old machines.

I'm wandering what happens if I set an idle_function with g_idle_add() while the previous idle cbk has not yet completed (the coherence of the image is not a problem because I already plan to use a SpinBuffer for it in the real app).

I'm wandering also if it's better to use gdk_flush() when I draw a frame or it's also safe/fast to do gtk_widget_queue_redraw() for the drawing
area widget...

Compile with:

gcc -o test gtkview.c `pkg-config gtk+-2.0 --cflags --libs` `pkg-config gthread-2.0 --cflags --libs`

--
Bye,
 Gabry



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