Initial Commit
[packages] / xemacs-packages / oo-browser / tree-w32 / dbl.h
1 /* ----------------------------------------------------------------------------\r
2  *     Double buffering code\r
3  * ----------------------------------------------------------------------------\r
4  */\r
5 \r
6 \r
7 #ifndef MSW\r
8 #include <stdio.h>\r
9 #include <X11/Xlib.h>\r
10 \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
15 \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
21 } Surface;\r
22 \r
23 #else\r
24 #include <windows.h>\r
25 #define DBL_MAX_COLORS   10\r
26 #endif\r
27 \r
28 typedef struct _doublebuffer {\r
29 #ifdef MSW\r
30     HDC         hdc;\r
31     int         DrawingWidth;\r
32     int         DrawingHeight;\r
33     int         LineWidth;\r
34     COLORREF    colors[DBL_MAX_COLORS];\r
35 #else\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
39 \r
40     int          width;         /* width of window                    */\r
41     int          height;        /* height of window                   */\r
42 \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
46 \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
52 \r
53 /* surface information is used to do double buffering                 */ \r
54 \r
55    int       num_surfaces;\r
56    int       current_surface;\r
57    Surface  *surface[DBL_MAX_SURFACES];\r
58 \r
59 /* we need to remember which pixels and planes we allocated           */\r
60 \r
61    int       mask;\r
62    long      pixels[DBL_MAX_COLORS];                                  \r
63    long      planes[DBL_MAX_PLANES];\r
64 \r
65 /* the pixel values one should use when drawing to the viewports      */\r
66 \r
67    int       num_colors; \r
68    int       colors[DBL_MAX_COLORS];\r
69 #endif\r
70 } DoubleBuffer;\r
71 \r
72 \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
77 \r