1 /* ----------------------------------------------------------------------------
2 * Double buffering code
3 * ----------------------------------------------------------------------------
9 #define DBL_MAX_SURFACES 2
10 #define DBL_MIN_PLANES 2
11 #define DBL_MAX_PLANES 6
12 #define DBL_MAX_COLORS (1 << (DBL_MAX_PLANES >> 1))
14 typedef struct _surface {
15 int mask; /* mask to use this surface */
16 int offset; /* offset within colormap */
17 int num_colors; /* number of colors in color array */
18 XColor color[1]; /* the actual color array */
21 typedef struct _doublebuffer {
22 Display *display; /* X display for windows and pixmaps */
23 Screen *screen; /* X screen */
24 Window window; /* X window for this double buffer */
26 int width; /* width of window */
27 int height; /* height of window */
29 Pixmap frame; /* pixmap for frame buffer */
30 Pixmap backing; /* pixmap for backing store */
31 Drawable drawable; /* copy of window/pixmap we draw in */
33 GC gc; /* GC used to draw the drawable */
34 Visual *visual; /* X visual */
35 Colormap colormap; /* X colormap identifier */
36 int depth; /* depth of screen in planes */
37 int num_planes; /* number of planes used */
39 /* surface information is used to do double buffering */
43 Surface *surface[DBL_MAX_SURFACES];
45 /* we need to remember which pixels and planes we allocated */
48 unsigned long pixels[DBL_MAX_COLORS];
49 unsigned long planes[DBL_MAX_PLANES];
51 /* the pixel values one should use when drawing to the viewports */
54 int colors[DBL_MAX_COLORS];
58 void DBLend_frame(DoubleBuffer *db, short init);
59 void DBLbegin_frame (DoubleBuffer *db);
60 void DBLdelete_double_buffer(DoubleBuffer *db);
61 unsigned long DBLinq_background(DoubleBuffer *db);
64 DBLcreate_double_buffer (Display *display,