GTK+ redrawing strategy: backing store, double buffering
- From: "Gustavo J. A. M. Carneiro" <gjc inescporto pt>
- To: gtk-devel-list gnome org
- Subject: GTK+ redrawing strategy: backing store, double buffering
- Date: Tue, 07 Oct 2003 14:10:51 +0100
Currently, gtk+ does double buffering by default. I think it's like
this:
1. widget calls queue_draw()
2. gtk main loop sends expose event
3. widget's expose event handler:
3.1 create temporary pixmap;
3.2 draw everything to temp pixmap
3.3 blit pixmap into widget->window
3.4 destroy temp pixmap
Now, would it be better to integrate this with backing store (if that
is the correct term), like this:
size-allocate handler:
1. create or resize widget->backing_store_pixmap with
allocation.[width|height]
redrawing:
1. widget calls queue_draw()
2. gtk main loop sends expose event
3. widget's expose event handler:
3.1 draw everything to backing store pixmap
3.2 blit backing store pixmap into widget->window
if more expose events occur from the X server:
1. blit the expose event area from backing store pixmap into
widget->window
Here's the impact I foresee:
(+) much faster (perceived and real speed); for example, imagine
dragging a window over a gtk+ app. In this case, no redrawing is
necessary at all, except blitting the backing store pixmap into the
widget's window. Or, by calling gdk_window_set_back_pixmap, expose
events become completely redundant!
(-) keeping the pixmaps around for each widget consumes a lot more X
server memory. In this case, however, I think that this could
optionally disabled (disabled by default perhaps).
Video cards with 64MB are common these days, and I really think we
should take advantage of this memory to improve performance of
applications.
Does any of this make sense?
Regards,
--
Gustavo João Alves Marques Carneiro
<gjc inescporto pt> <gustavo users sourceforge net>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]