Re: [gtk-list] Re: GDK_EXPOSE



slogan@crash.cts.com (Syd Logan) wrote:
>But I might want to hear about the GraphicsExpose/NoExpose events 
>asynchronously via a signal callback. If I am copying a huge area it would 
>be more efficient to fire the copy off and go do something else. 

Yes, that's true. I handle this in my app by keeping my own queue of pending
repaint operations:

- do an gdk_window_copy_area()

- after the copy, spin on gdk_event_get_graphics_expose()

- in expose(), paint the exposed area with a background pattern, and add the
  expose area to a list of pending repaints ... it checks for stuff already in
  the repaint list first

- in a background work proc, take stuff off the repaint list and paint image
  pixels to the screen as time allows

This means I spin only long enough to get the GraphicsExpose events back
from the server, I don't need to wait to repaint. I think this is more-or-less
what gtk does.

It could be faster still ... I only really need to sit and spin if I want do
do another gdk_window_copy_area() before all the exposes have come in from a
previous gdk_window_copy_area(). To do this, I guess we would need an explicit
GraphicsExpose event, as you suggest. Does anyone know how much of a speed-up
this would give?

John



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