Re: GTK+ redrawing strategy: backing store, double buffering



Quoting "Gustavo J. A. M. Carneiro" <gjc inescporto pt>:

>   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>
> 
> 
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-devel-list
> 
> 
 
i tried using X's background image as backbuffer. I hacked it in to GTK. That 
way X won't send any expose events. But will do all the drawing itself. It 
really makes a difference when dragging one window over the other, and when 
unshading. Some problems:

- Scrolling has to be rewritten. Quite alot of work, i couldn't get it figured 
out. 

- Resizing a window is still a problem

Wouter




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