comparison pkg-src/tree-x/dbl.c @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents 85ec50267440
children
comparison
equal deleted inserted replaced
168:9851d5c6556e 169:15872534500d
29 Window window, 29 Window window,
30 int backing_store, 30 int backing_store,
31 XColor *colors, 31 XColor *colors,
32 int num_colors) 32 int num_colors)
33 { 33 {
34 int i, j, k, l, m, offset, mask, size; 34 int i, j, k, l, offset, mask, size;
35 int max_planes; 35 int max_planes;
36 36
37 char *string; 37 char *string;
38 Surface *surface; 38 Surface *surface;
39 DoubleBuffer *db; 39 DoubleBuffer *db;
42 42
43 /* allocate the double buffer structure, and then open the display */ 43 /* allocate the double buffer structure, and then open the display */
44 44
45 if ((db = (DoubleBuffer *)calloc(1, sizeof(DoubleBuffer))) == 0) { 45 if ((db = (DoubleBuffer *)calloc(1, sizeof(DoubleBuffer))) == 0) {
46 printf("DBLopen_double_buffer : memory allocation error\n"); 46 printf("DBLopen_double_buffer : memory allocation error\n");
47 return (NULL); 47 return NULL;
48 } 48 }
49 49
50 /* note the display */ 50 /* note the display */
51 51
52 db->display = display; 52 db->display = display;
141 if ((surface = (Surface *)malloc(size)) != NULL) 141 if ((surface = (Surface *)malloc(size)) != NULL)
142 db->surface[i] = surface; 142 db->surface[i] = surface;
143 else { 143 else {
144 printf("DBLcreate_double_buffer : memory allocation error\n"); 144 printf("DBLcreate_double_buffer : memory allocation error\n");
145 DBLdelete_double_buffer(db); 145 DBLdelete_double_buffer(db);
146 return(NULL); 146 return NULL;
147 } 147 }
148 148
149 surface->offset = offset + i * (db->num_planes >> 1); 149 surface->offset = offset + i * (db->num_planes >> 1);
150 surface->mask = mask << surface->offset; 150 surface->mask = mask << surface->offset;
151 surface->num_colors = 1 << db->num_planes; 151 surface->num_colors = 1 << db->num_planes;
243 243
244 /* do an initial frame to setup the colormap, and return */ 244 /* do an initial frame to setup the colormap, and return */
245 245
246 DBLbegin_frame(db); 246 DBLbegin_frame(db);
247 DBLend_frame(db, 1); 247 DBLend_frame(db, 1);
248 return (db); 248 return db;
249 } 249 }
250 250
251 /* ------------------------------------------------------------------------- */ 251 /* ------------------------------------------------------------------------- */
252 252
253 void 253 void
286 286
287 unsigned long 287 unsigned long
288 DBLinq_background(DoubleBuffer *db) 288 DBLinq_background(DoubleBuffer *db)
289 { 289 {
290 if (db->num_surfaces > 0) 290 if (db->num_surfaces > 0)
291 return(db->surface[0]->color[0].pixel); 291 return db->surface[0]->color[0].pixel;
292 else 292 else
293 return(WhitePixelOfScreen(db->screen)); 293 return WhitePixelOfScreen(db->screen);
294 } 294 }
295 295
296 /* ------------------------------------------------------------------------- */ 296 /* ------------------------------------------------------------------------- */
297 297
298 void 298 void