comparison lisp/oobr/tree-x/dbl.h @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:376386a54a3c
1 /* ----------------------------------------------------------------------------
2 * Double buffering code
3 * ----------------------------------------------------------------------------
4 */
5
6 #include <stdio.h>
7 #include <X11/Xlib.h>
8
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))
13
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 */
19 } Surface;
20
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 */
25
26 int width; /* width of window */
27 int height; /* height of window */
28
29 Pixmap frame; /* pixmap for frame buffer */
30 Pixmap backing; /* pixmap for backing store */
31 Drawable drawable; /* copy of window/pixmap we draw in */
32
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 */
38
39 /* surface information is used to do double buffering */
40
41 int num_surfaces;
42 int current_surface;
43 Surface *surface[DBL_MAX_SURFACES];
44
45 /* we need to remember which pixels and planes we allocated */
46
47 int mask;
48 long pixels[DBL_MAX_COLORS];
49 long planes[DBL_MAX_PLANES];
50
51 /* the pixel values one should use when drawing to the viewports */
52
53 int num_colors;
54 int colors[DBL_MAX_COLORS];
55 } DoubleBuffer;
56
57
58 extern DoubleBuffer *DBLcreate_double_buffer();
59 extern void DBLdelete_double_buffer();
60 extern unsigned long DBLinq_background();
61 extern char *getenv();
62
63
64
65
66