1 /* ----------------------------------------------------------------------------
\r
2 * Double buffering code
\r
3 * ----------------------------------------------------------------------------
\r
9 #include <X11/Xlib.h>
\r
11 #define DBL_MAX_SURFACES 2
\r
12 #define DBL_MIN_PLANES 2
\r
13 #define DBL_MAX_PLANES 6
\r
14 #define DBL_MAX_COLORS (1 << (DBL_MAX_PLANES >> 1))
\r
16 typedef struct _surface {
\r
17 int mask; /* mask to use this surface */
\r
18 int offset; /* offset within colormap */
\r
19 int num_colors; /* number of colors in color array */
\r
20 XColor color[1]; /* the actual color array */
\r
24 #include <windows.h>
\r
25 #define DBL_MAX_COLORS 10
\r
28 typedef struct _doublebuffer {
\r
34 COLORREF colors[DBL_MAX_COLORS];
\r
36 Display *display; /* X display for windows and pixmaps */
\r
37 Screen *screen; /* X screen */
\r
38 Window window; /* X window for this double buffer */
\r
40 int width; /* width of window */
\r
41 int height; /* height of window */
\r
43 Pixmap frame; /* pixmap for frame buffer */
\r
44 Pixmap backing; /* pixmap for backing store */
\r
45 Drawable drawable; /* copy of window/pixmap we draw in */
\r
47 GC gc; /* GC used to draw the drawable */
\r
48 Visual *visual; /* X visual */
\r
49 Colormap colormap; /* X colormap identifier */
\r
50 int depth; /* depth of screen in planes */
\r
51 int num_planes; /* number of planes used */
\r
53 /* surface information is used to do double buffering */
\r
56 int current_surface;
\r
57 Surface *surface[DBL_MAX_SURFACES];
\r
59 /* we need to remember which pixels and planes we allocated */
\r
62 long pixels[DBL_MAX_COLORS];
\r
63 long planes[DBL_MAX_PLANES];
\r
65 /* the pixel values one should use when drawing to the viewports */
\r
68 int colors[DBL_MAX_COLORS];
\r
73 extern DoubleBuffer *DBLcreate_double_buffer();
\r
74 extern void DBLdelete_double_buffer();
\r
75 extern unsigned long DBLinq_background();
\r
76 extern char *getenv();
\r