File: dbl.h

package info (click to toggle)
xemacs21-packages 2009.02.17.dfsg.1-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 116,928 kB
  • ctags: 88,975
  • sloc: lisp: 1,232,060; ansic: 16,570; java: 13,514; xml: 6,477; sh: 4,611; makefile: 4,036; asm: 3,007; perl: 839; cpp: 500; ruby: 257; csh: 96; haskell: 93; awk: 49; python: 47
file content (68 lines) | stat: -rw-r--r-- 2,463 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/* ----------------------------------------------------------------------------
 *     Double buffering code
 * ----------------------------------------------------------------------------
 */

#include <stdio.h>
#include <X11/Xlib.h>

#define DBL_MAX_SURFACES 2
#define DBL_MIN_PLANES   2
#define DBL_MAX_PLANES   6
#define DBL_MAX_COLORS   (1 << (DBL_MAX_PLANES >> 1))

typedef struct _surface {
    int	         mask;          /* mask to use this surface           */
    int	       offset;          /* offset within colormap             */
    int	   num_colors;          /* number of colors in color array    */
    XColor   color[1];          /* the actual color array             */
} Surface;

typedef struct _doublebuffer {
    Display     *display;       /* X display for windows and pixmaps  */
    Screen      *screen;	/* X screen                           */
    Window	 window;	/* X window for this double buffer    */

    int		 width;		/* width of window                    */
    int          height;	/* height of window                   */

    Pixmap	 frame;	        /* pixmap for frame buffer            */
    Pixmap       backing;       /* pixmap for backing store           */
    Drawable     drawable;      /* copy of window/pixmap we draw in   */

    GC		 gc;		/* GC used to draw the drawable       */
    Visual      *visual;	/* X visual                           */
    Colormap     colormap;	/* X colormap identifier              */
    int          depth;	        /* depth of screen in planes          */
    int          num_planes;    /* number of planes used              */

/* surface information is used to do double buffering                 */

   int       num_surfaces;
   int       current_surface;
   Surface  *surface[DBL_MAX_SURFACES];

/* we need to remember which pixels and planes we allocated           */

   int           mask;
   unsigned long pixels[DBL_MAX_COLORS];
   unsigned long planes[DBL_MAX_PLANES];

/* the pixel values one should use when drawing to the viewports      */

   int       num_colors;
   int       colors[DBL_MAX_COLORS];
} DoubleBuffer;


void		DBLend_frame(DoubleBuffer *db, short init);
void		DBLbegin_frame (DoubleBuffer *db);
void		DBLdelete_double_buffer(DoubleBuffer *db);
unsigned long	DBLinq_background(DoubleBuffer *db);

DoubleBuffer *
DBLcreate_double_buffer (Display *display,
			 Window   window,
			 int      backing_store,
			 XColor  *colors,
			 int      num_colors);