optimization: Render on pixmaps and copy the result on Stack_Wins

This should speed up the rendering of Stack_Wins with many window
decorations and it should considerably reduce flicker.
This commit is contained in:
Michael Stapelberg
2009-07-17 18:32:40 +02:00
parent 0434b6ea3d
commit 5b51c8c6f0
7 changed files with 80 additions and 7 deletions

@ -101,6 +101,22 @@ struct Colorpixel {
SLIST_ENTRY(Colorpixel) colorpixels;
};
struct Cached_Pixmap {
xcb_pixmap_t id;
/* Were going to paint on it, so a graphics context will be needed */
xcb_gcontext_t gc;
/* The rect with which the pixmap was created */
Rect rect;
/* The rect of the object to which this pixmap belongs. Necessary to
* find out when we need to re-create the pixmap. */
Rect *referred_rect;
xcb_drawable_t referred_drawable;
};
/**
* Contains data for the windows needed to draw the titlebars on in stacking
* mode
@ -108,7 +124,7 @@ struct Colorpixel {
*/
struct Stack_Window {
xcb_window_t window;
xcb_gcontext_t gc;
struct Cached_Pixmap pixmap;
Rect rect;
/** Backpointer to the container this stack window is in */

@ -30,6 +30,7 @@ extern TAILQ_HEAD(assignments_head, Assignment) assignments;
extern SLIST_HEAD(stack_wins_head, Stack_Window) stack_wins;
extern xcb_event_handlers_t evenths;
extern int num_screens;
extern uint8_t root_depth;
extern xcb_atom_t atoms[NUM_ATOMS];
#endif

@ -143,4 +143,13 @@ void xcb_get_numlock_mask(xcb_connection_t *conn);
*/
void xcb_raise_window(xcb_connection_t *conn, xcb_window_t window);
/**
*
* Prepares the given Cached_Pixmap for usage (checks whether the size of the
* object this pixmap is related to (e.g. a window) has changed and re-creates
* the pixmap if so).
*
*/
void cached_pixmap_prepare(xcb_connection_t *conn, struct Cached_Pixmap *pixmap);
#endif