1 /* $Id: xm_span.c,v 1.1 2000/09/07 15:40:30 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include "glxheader.h"
38 #include "extensions.h"
44 * The following functions are used to trap XGetImage() calls which
45 * generate BadMatch errors if the drawable isn't mapped.
49 static int caught_xgetimage_error
= 0;
50 static int (*old_xerror_handler
)( XMesaDisplay
*dpy
, XErrorEvent
*ev
);
51 static unsigned long xgetimage_serial
;
54 * This is the error handler which will be called if XGetImage fails.
56 static int xgetimage_error_handler( XMesaDisplay
*dpy
, XErrorEvent
*ev
)
58 if (ev
->serial
==xgetimage_serial
&& ev
->error_code
==BadMatch
) {
59 /* caught the expected error */
60 caught_xgetimage_error
= 0;
63 /* call the original X error handler, if any. otherwise ignore */
64 if (old_xerror_handler
) {
65 (*old_xerror_handler
)( dpy
, ev
);
73 * Call this right before XGetImage to setup error trap.
75 static void catch_xgetimage_errors( XMesaDisplay
*dpy
)
77 xgetimage_serial
= NextRequest( dpy
);
78 old_xerror_handler
= XSetErrorHandler( xgetimage_error_handler
);
79 caught_xgetimage_error
= 0;
84 * Call this right after XGetImage to check if an error occured.
86 static int check_xgetimage_errors( void )
88 /* restore old handler */
89 (void) XSetErrorHandler( old_xerror_handler
);
90 /* return 0=no error, 1=error caught */
91 return caught_xgetimage_error
;
97 * Read a pixel from an X drawable.
99 static unsigned long read_pixel( XMesaDisplay
*dpy
,
100 XMesaDrawable d
, int x
, int y
)
103 #ifndef XFree86Server
104 XMesaImage
*pixel
= NULL
;
107 catch_xgetimage_errors( dpy
);
108 pixel
= XGetImage( dpy
, d
, x
, y
, 1, 1, AllPlanes
, ZPixmap
);
109 error
= check_xgetimage_errors();
110 if (pixel
&& !error
) {
111 p
= XMesaGetPixel( pixel
, 0, 0 );
117 XMesaDestroyImage( pixel
);
120 (*dpy
->GetImage
)(d
, x
, y
, 1, 1, ZPixmap
, ~0L, (pointer
)&p
);
128 * The Mesa library needs to be able to draw pixels in a number of ways:
129 * 1. RGB vs Color Index
130 * 2. as horizontal spans (polygons, images) vs random locations (points,
132 * 3. different color per-pixel or same color for all pixels
134 * Furthermore, the X driver needs to support rendering to 3 possible
135 * "buffers", usually one, but sometimes two at a time:
136 * 1. The front buffer as an X window
137 * 2. The back buffer as a Pixmap
138 * 3. The back buffer as an XImage
140 * Finally, if the back buffer is an XImage, we can avoid using XPutPixel and
141 * optimize common cases such as 24-bit and 8-bit modes.
143 * By multiplication, there's at least 48 possible combinations of the above.
145 * Below are implementations of the most commonly used combinations. They are
146 * accessed through function pointers which get initialized here and are used
147 * directly from the Mesa library. The 8 function pointers directly correspond
148 * to the first 3 cases listed above.
151 * The function naming convention is:
153 * write_[span|pixels]_[mono]_[format]_[pixmap|ximage]
155 * New functions optimized for specific cases can be added without too much
156 * trouble. An example might be the 24-bit TrueColor mode 8A8R8G8B which is
157 * found on IBM RS/6000 X servers.
163 /**********************************************************************/
164 /*** Write COLOR SPAN functions ***/
165 /**********************************************************************/
168 #define RGBA_SPAN_ARGS const GLcontext *ctx, \
169 GLuint n, GLint x, GLint y, \
170 CONST GLubyte rgba[][4], const GLubyte mask[]
172 #define RGB_SPAN_ARGS const GLcontext *ctx, \
173 GLuint n, GLint x, GLint y, \
174 CONST GLubyte rgb[][3], const GLubyte mask[]
177 /* NOTE: if mask==NULL, draw all pixels */
181 * Write a span of PF_TRUECOLOR pixels to a pixmap.
183 static void write_span_TRUECOLOR_pixmap( RGBA_SPAN_ARGS
)
185 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
186 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
187 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
188 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
190 y
= FLIP(xmesa
->xm_buffer
, y
);
192 for (i
=0;i
<n
;i
++,x
++) {
195 PACK_TRUECOLOR( p
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
196 XMesaSetForeground( dpy
, gc
, p
);
197 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
202 /* draw all pixels */
203 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
206 PACK_TRUECOLOR( p
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
207 XMesaPutPixel( rowimg
, i
, 0, p
);
209 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
215 * Write a span of PF_TRUECOLOR pixels to a pixmap.
217 static void write_span_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS
)
219 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
220 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
221 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
222 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
224 y
= FLIP(xmesa
->xm_buffer
, y
);
226 for (i
=0;i
<n
;i
++,x
++) {
229 PACK_TRUECOLOR( p
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
230 XMesaSetForeground( dpy
, gc
, p
);
231 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
236 /* draw all pixels */
237 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
240 PACK_TRUECOLOR( p
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
241 XMesaPutPixel( rowimg
, i
, 0, p
);
243 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
249 * Write a span of PF_TRUEDITHER pixels to a pixmap.
251 static void write_span_TRUEDITHER_pixmap( RGBA_SPAN_ARGS
)
253 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
254 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
255 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
256 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
258 y
= FLIP(xmesa
->xm_buffer
, y
);
260 for (i
=0;i
<n
;i
++,x
++) {
263 PACK_TRUEDITHER(p
, x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
264 XMesaSetForeground( dpy
, gc
, p
);
265 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
270 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
273 PACK_TRUEDITHER(p
, x
+i
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
274 XMesaPutPixel( rowimg
, i
, 0, p
);
276 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
282 * Write a span of PF_TRUEDITHER pixels to a pixmap (no alpha).
284 static void write_span_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS
)
286 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
287 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
288 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
289 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
291 y
= FLIP(xmesa
->xm_buffer
, y
);
293 for (i
=0;i
<n
;i
++,x
++) {
296 PACK_TRUEDITHER(p
, x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
297 XMesaSetForeground( dpy
, gc
, p
);
298 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
303 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
306 PACK_TRUEDITHER(p
, x
+i
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
307 XMesaPutPixel( rowimg
, i
, 0, p
);
309 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
316 * Write a span of PF_8A8B8G8R pixels to a pixmap.
318 static void write_span_8A8B8G8R_pixmap( RGBA_SPAN_ARGS
)
320 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
321 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
322 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
323 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
325 y
= FLIP(xmesa
->xm_buffer
, y
);
327 for (i
=0;i
<n
;i
++,x
++) {
329 XMesaSetForeground( dpy
, gc
,
330 PACK_8A8B8G8R(rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
], rgba
[i
][ACOMP
]) );
331 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
336 /* draw all pixels */
337 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
338 register GLuint
*ptr4
= (GLuint
*) rowimg
->data
;
340 *ptr4
++ = PACK_8A8B8G8R( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
], rgba
[i
][ACOMP
] );
342 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
348 * Write a span of PF_8A8B8G8R pixels to a pixmap (no alpha).
350 static void write_span_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS
)
352 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
353 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
354 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
355 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
357 y
= FLIP(xmesa
->xm_buffer
, y
);
359 for (i
=0;i
<n
;i
++,x
++) {
361 XMesaSetForeground( dpy
, gc
,
362 PACK_8B8G8R(rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
363 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
368 /* draw all pixels */
369 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
370 register GLuint
*ptr4
= (GLuint
*) rowimg
->data
;
372 *ptr4
++ = PACK_8B8G8R(rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
374 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
380 * Write a span of PF_8R8G8B pixels to a pixmap.
382 static void write_span_8R8G8B_pixmap( RGBA_SPAN_ARGS
)
384 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
385 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
386 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
387 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
389 y
= FLIP(xmesa
->xm_buffer
, y
);
391 for (i
=0;i
<n
;i
++,x
++) {
393 XMesaSetForeground( dpy
, gc
, PACK_8R8G8B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ));
394 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
399 /* draw all pixels */
400 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
401 register GLuint
*ptr4
= (GLuint
*) rowimg
->data
;
403 *ptr4
++ = PACK_8R8G8B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
405 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
411 * Write a span of PF_8R8G8B24 pixels to a pixmap.
413 static void write_span_8R8G8B24_pixmap( RGBA_SPAN_ARGS
)
415 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
416 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
417 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
418 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
419 y
= FLIP(xmesa
->xm_buffer
, y
);
422 for (i
=0;i
<n
;i
++,x
++) {
424 XMesaSetForeground( dpy
, gc
,
425 PACK_8R8G8B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ));
426 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
431 /* draw all pixels */
432 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
433 register GLuint
*ptr4
= (GLuint
*) rowimg
->data
;
434 register GLuint pixel
;
435 static const GLuint shift
[4] = {0, 8, 16, 24};
436 register GLuint i
= 0;
439 pixel
= rgba
[i
][BCOMP
] /* << shift[0]*/;
440 pixel
|= rgba
[i
][GCOMP
] << shift
[1];
441 pixel
|= rgba
[i
++][RCOMP
] << shift
[2];
442 pixel
|= rgba
[i
][BCOMP
] << shift
[3];
445 pixel
= rgba
[i
][GCOMP
] /* << shift[0]*/;
446 pixel
|= rgba
[i
++][RCOMP
] << shift
[1];
447 pixel
|= rgba
[i
][BCOMP
] << shift
[2];
448 pixel
|= rgba
[i
][GCOMP
] << shift
[3];
451 pixel
= rgba
[i
++][RCOMP
]/* << shift[0]*/;
452 pixel
|= rgba
[i
][BCOMP
] << shift
[1];
453 pixel
|= rgba
[i
][GCOMP
] << shift
[2];
454 pixel
|= rgba
[i
++][RCOMP
] << shift
[3];
462 pixel
|= rgba
[i
][BCOMP
] /*<< shift[0]*/;
463 pixel
|= rgba
[i
][GCOMP
] << shift
[1];
464 pixel
|= rgba
[i
++][RCOMP
] << shift
[2];
465 pixel
|= rgba
[i
][BCOMP
] << shift
[3];
468 pixel
|= rgba
[i
][GCOMP
] /*<< shift[0]*/;
469 pixel
|= rgba
[i
++][RCOMP
] << shift
[1];
470 pixel
|= rgba
[i
][BCOMP
] << shift
[2];
471 pixel
|= rgba
[i
][GCOMP
] << shift
[3];
473 pixel
= 0xffffff00 & *ptr4
;
474 pixel
|= rgba
[i
][RCOMP
] /*<< shift[0]*/;
479 pixel
|= rgba
[i
][BCOMP
] /*<< shift[0]*/;
480 pixel
|= rgba
[i
][GCOMP
] << shift
[1];
481 pixel
|= rgba
[i
++][RCOMP
] << shift
[2];
482 pixel
|= rgba
[i
][BCOMP
] << shift
[3];
484 pixel
= 0xffff0000 & *ptr4
;
485 pixel
|= rgba
[i
][GCOMP
] /*<< shift[0]*/;
486 pixel
|= rgba
[i
][RCOMP
] << shift
[1];
490 pixel
= 0xff000000 & *ptr4
;
491 pixel
|= rgba
[i
][BCOMP
] /*<< shift[0]*/;
492 pixel
|= rgba
[i
][GCOMP
] << shift
[1];
493 pixel
|= rgba
[i
][RCOMP
] << shift
[2];
499 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
505 * Write a span of PF_8R8G8B pixels to a pixmap (no alpha).
507 static void write_span_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS
)
509 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
510 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
511 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
512 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
514 y
= FLIP(xmesa
->xm_buffer
, y
);
516 for (i
=0;i
<n
;i
++,x
++) {
518 XMesaSetForeground( dpy
, gc
, PACK_8R8G8B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ));
519 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
524 /* draw all pixels */
525 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
526 register GLuint
*ptr4
= (GLuint
*) rowimg
->data
;
528 *ptr4
++ = PACK_8R8G8B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
530 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
536 * Write a span of PF_8R8G8B24 pixels to a pixmap (no alpha).
538 static void write_span_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS
)
540 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
541 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
542 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
543 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
544 y
= FLIP(xmesa
->xm_buffer
, y
);
547 for (i
=0;i
<n
;i
++,x
++) {
549 XMesaSetForeground( dpy
, gc
,
550 PACK_8R8G8B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ));
551 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
556 /* draw all pixels */
557 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
558 register GLuint
*ptr4
= (GLuint
*) rowimg
->data
;
559 register GLuint pixel
;
560 static const GLuint shift
[4] = {0, 8, 16, 24};
562 register GLuint i
= 0;
565 pixel
|= rgb
[i
][BCOMP
]/* << shift[0]*/;
566 pixel
|= rgb
[i
][GCOMP
] << shift
[1];
567 pixel
|= rgb
[i
++][RCOMP
] << shift
[2];
568 pixel
|= rgb
[i
][BCOMP
] <<shift
[3];
572 pixel
|= rgb
[i
][GCOMP
]/* << shift[0]*/;
573 pixel
|= rgb
[i
++][RCOMP
] << shift
[1];
574 pixel
|= rgb
[i
][BCOMP
] << shift
[2];
575 pixel
|= rgb
[i
][GCOMP
] << shift
[3];
579 pixel
|= rgb
[i
++][RCOMP
]/* << shift[0]*/;
580 pixel
|= rgb
[i
][BCOMP
] << shift
[1];
581 pixel
|= rgb
[i
][GCOMP
] << shift
[2];
582 pixel
|= rgb
[i
++][RCOMP
] << shift
[3];
589 pixel
|= rgb
[i
][BCOMP
]/* << shift[0]*/;
590 pixel
|= rgb
[i
][GCOMP
] << shift
[1];
591 pixel
|= rgb
[i
++][RCOMP
] << shift
[2];
592 pixel
|= rgb
[i
][BCOMP
] << shift
[3];
595 pixel
|= rgb
[i
][GCOMP
]/* << shift[0]*/;
596 pixel
|= rgb
[i
++][RCOMP
] << shift
[1];
597 pixel
|= rgb
[i
][BCOMP
] << shift
[2];
598 pixel
|= rgb
[i
][GCOMP
] << shift
[3];
602 pixel
|= rgb
[i
++][RCOMP
]/* << shift[0]*/;
607 pixel
|= rgb
[i
][BCOMP
]/* << shift[0]*/;
608 pixel
|= rgb
[i
][GCOMP
] << shift
[1];
609 pixel
|= rgb
[i
++][RCOMP
] << shift
[2];
610 pixel
|= rgb
[i
][BCOMP
] << shift
[3];
614 pixel
|= rgb
[i
][GCOMP
]/* << shift[0]*/;
615 pixel
|= rgb
[i
++][RCOMP
] << shift
[1];
621 pixel
|= rgb
[i
][BCOMP
]/* << shift[0]*/;
622 pixel
|= rgb
[i
][GCOMP
] << shift
[1];
623 pixel
|= rgb
[i
++][RCOMP
] << shift
[2];
629 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
635 * Write a span of PF_5R6G5B pixels to a pixmap.
637 static void write_span_5R6G5B_pixmap( RGBA_SPAN_ARGS
)
639 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
640 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
641 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
642 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
644 y
= FLIP(xmesa
->xm_buffer
, y
);
646 for (i
=0;i
<n
;i
++,x
++) {
648 XMesaSetForeground( dpy
, gc
, PACK_5R6G5B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ));
649 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
654 /* draw all pixels */
655 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
656 register GLushort
*ptr2
= (GLushort
*) rowimg
->data
;
658 ptr2
[i
] = PACK_5R6G5B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
660 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
666 * Write a span of PF_DITHER_5R6G5B pixels to a pixmap.
668 static void write_span_DITHER_5R6G5B_pixmap( RGBA_SPAN_ARGS
)
670 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
671 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
672 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
673 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
675 y
= FLIP(xmesa
->xm_buffer
, y
);
677 for (i
=0;i
<n
;i
++,x
++) {
680 PACK_TRUEDITHER(p
, x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
681 XMesaSetForeground( dpy
, gc
, p
);
682 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
687 /* draw all pixels */
688 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
689 register GLushort
*ptr2
= (GLushort
*) rowimg
->data
;
691 PACK_TRUEDITHER( ptr2
[i
], x
+i
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
693 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
699 * Write a span of PF_5R6G5B pixels to a pixmap (no alpha).
701 static void write_span_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS
)
703 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
704 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
705 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
706 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
708 y
= FLIP(xmesa
->xm_buffer
, y
);
710 for (i
=0;i
<n
;i
++,x
++) {
712 XMesaSetForeground( dpy
, gc
, PACK_5R6G5B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ));
713 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
718 /* draw all pixels */
719 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
720 register GLushort
*ptr2
= (GLushort
*) rowimg
->data
;
722 ptr2
[i
] = PACK_5R6G5B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
724 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
730 * Write a span of PF_DITHER_5R6G5B pixels to a pixmap (no alpha).
732 static void write_span_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS
)
734 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
735 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
736 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
737 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
739 y
= FLIP(xmesa
->xm_buffer
, y
);
741 for (i
=0;i
<n
;i
++,x
++) {
744 PACK_TRUEDITHER(p
, x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
745 XMesaSetForeground( dpy
, gc
, p
);
746 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
751 /* draw all pixels */
752 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
753 register GLushort
*ptr2
= (GLushort
*) rowimg
->data
;
755 PACK_TRUEDITHER( ptr2
[i
], x
+i
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
757 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
764 * Write a span of PF_DITHER pixels to a pixmap.
766 static void write_span_DITHER_pixmap( RGBA_SPAN_ARGS
)
768 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
769 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
770 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
771 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
774 y
= FLIP(xmesa
->xm_buffer
, y
);
776 for (i
=0;i
<n
;i
++,x
++) {
778 XMesaSetForeground( dpy
, gc
, XDITHER(x
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]) );
779 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
784 /* draw all pixels */
785 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
787 XMesaPutPixel( rowimg
, i
, 0, XDITHER(x
+i
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]) );
789 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
795 * Write a span of PF_DITHER pixels to a pixmap (no alpha).
797 static void write_span_rgb_DITHER_pixmap( RGB_SPAN_ARGS
)
799 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
800 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
801 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
802 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
805 y
= FLIP(xmesa
->xm_buffer
, y
);
807 for (i
=0;i
<n
;i
++,x
++) {
809 XMesaSetForeground( dpy
, gc
, XDITHER(x
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
810 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
815 /* draw all pixels */
816 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
818 XMesaPutPixel( rowimg
, i
, 0, XDITHER(x
+i
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
820 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
826 * Write a span of PF_1BIT pixels to a pixmap.
828 static void write_span_1BIT_pixmap( RGBA_SPAN_ARGS
)
830 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
831 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
832 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
833 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
836 y
= FLIP(xmesa
->xm_buffer
, y
);
838 for (i
=0;i
<n
;i
++,x
++) {
840 XMesaSetForeground( dpy
, gc
,
841 DITHER_1BIT( x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
842 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
847 /* draw all pixels */
848 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
850 XMesaPutPixel( rowimg
, i
, 0,
851 DITHER_1BIT( x
+i
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
853 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
859 * Write a span of PF_1BIT pixels to a pixmap (no alpha).
861 static void write_span_rgb_1BIT_pixmap( RGB_SPAN_ARGS
)
863 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
864 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
865 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
866 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
869 y
= FLIP(xmesa
->xm_buffer
, y
);
871 for (i
=0;i
<n
;i
++,x
++) {
873 XMesaSetForeground( dpy
, gc
,
874 DITHER_1BIT(x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
875 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
880 /* draw all pixels */
881 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
883 XMesaPutPixel( rowimg
, i
, 0,
884 DITHER_1BIT(x
+i
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
886 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
892 * Write a span of PF_HPCR pixels to a pixmap.
894 static void write_span_HPCR_pixmap( RGBA_SPAN_ARGS
)
896 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
897 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
898 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
899 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
901 y
= FLIP(xmesa
->xm_buffer
, y
);
903 for (i
=0;i
<n
;i
++,x
++) {
905 XMesaSetForeground( dpy
, gc
,
906 DITHER_HPCR( x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
907 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
912 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
913 register GLubyte
*ptr
= (GLubyte
*) xmesa
->xm_buffer
->rowimage
->data
;
915 ptr
[i
] = DITHER_HPCR( (x
+i
), y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
917 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
923 * Write a span of PF_HPCR pixels to a pixmap (no alpha).
925 static void write_span_rgb_HPCR_pixmap( RGB_SPAN_ARGS
)
927 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
928 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
929 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
930 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
932 y
= FLIP(xmesa
->xm_buffer
, y
);
934 for (i
=0;i
<n
;i
++,x
++) {
936 XMesaSetForeground( dpy
, gc
,
937 DITHER_HPCR(x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
938 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
943 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
944 register GLubyte
*ptr
= (GLubyte
*) xmesa
->xm_buffer
->rowimage
->data
;
946 ptr
[i
] = DITHER_HPCR( (x
+i
), y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
948 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
954 * Write a span of PF_LOOKUP pixels to a pixmap.
956 static void write_span_LOOKUP_pixmap( RGBA_SPAN_ARGS
)
958 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
959 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
960 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
961 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
964 y
= FLIP(xmesa
->xm_buffer
, y
);
966 for (i
=0;i
<n
;i
++,x
++) {
968 XMesaSetForeground( dpy
, gc
, LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
969 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
974 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
976 XMesaPutPixel( rowimg
, i
, 0, LOOKUP(rgba
[i
][RCOMP
],rgba
[i
][GCOMP
],rgba
[i
][BCOMP
]) );
978 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
984 * Write a span of PF_LOOKUP pixels to a pixmap (no alpha).
986 static void write_span_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS
)
988 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
989 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
990 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
991 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
994 y
= FLIP(xmesa
->xm_buffer
, y
);
996 for (i
=0;i
<n
;i
++,x
++) {
998 XMesaSetForeground( dpy
, gc
, LOOKUP( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
999 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
1004 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
1006 XMesaPutPixel( rowimg
, i
, 0, LOOKUP(rgb
[i
][RCOMP
],rgb
[i
][GCOMP
],rgb
[i
][BCOMP
]) );
1008 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
1015 * Write a span of PF_GRAYSCALE pixels to a pixmap.
1017 static void write_span_GRAYSCALE_pixmap( RGBA_SPAN_ARGS
)
1019 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1020 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
1021 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
1022 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
1024 y
= FLIP(xmesa
->xm_buffer
, y
);
1026 for (i
=0;i
<n
;i
++,x
++) {
1028 XMesaSetForeground( dpy
, gc
, GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1029 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
1034 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
1036 XMesaPutPixel( rowimg
, i
, 0, GRAY_RGB(rgba
[i
][RCOMP
],rgba
[i
][GCOMP
],rgba
[i
][BCOMP
]) );
1038 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
1044 * Write a span of PF_GRAYSCALE pixels to a pixmap (no alpha).
1046 static void write_span_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS
)
1048 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1049 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
1050 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
1051 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
1053 y
= FLIP(xmesa
->xm_buffer
, y
);
1055 for (i
=0;i
<n
;i
++,x
++) {
1057 XMesaSetForeground( dpy
, gc
, GRAY_RGB( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1058 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
1063 XMesaImage
*rowimg
= xmesa
->xm_buffer
->rowimage
;
1065 XMesaPutPixel( rowimg
, i
, 0, GRAY_RGB(rgb
[i
][RCOMP
],rgb
[i
][GCOMP
],rgb
[i
][BCOMP
]) );
1067 XMesaPutImage( dpy
, buffer
, gc
, rowimg
, 0, 0, x
, y
, n
, 1 );
1073 * Write a span of PF_TRUECOLOR pixels to an XImage.
1075 static void write_span_TRUECOLOR_ximage( RGBA_SPAN_ARGS
)
1077 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1078 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1080 y
= FLIP(xmesa
->xm_buffer
, y
);
1082 for (i
=0;i
<n
;i
++,x
++) {
1085 PACK_TRUECOLOR( p
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1086 XMesaPutPixel( img
, x
, y
, p
);
1091 /* draw all pixels */
1092 for (i
=0;i
<n
;i
++,x
++) {
1094 PACK_TRUECOLOR( p
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1095 XMesaPutPixel( img
, x
, y
, p
);
1102 * Write a span of PF_TRUECOLOR pixels to an XImage (no alpha).
1104 static void write_span_rgb_TRUECOLOR_ximage( RGB_SPAN_ARGS
)
1106 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1107 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1109 y
= FLIP(xmesa
->xm_buffer
, y
);
1111 for (i
=0;i
<n
;i
++,x
++) {
1114 PACK_TRUECOLOR( p
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1115 XMesaPutPixel( img
, x
, y
, p
);
1120 /* draw all pixels */
1121 for (i
=0;i
<n
;i
++,x
++) {
1123 PACK_TRUECOLOR( p
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1124 XMesaPutPixel( img
, x
, y
, p
);
1131 * Write a span of PF_TRUEDITHER pixels to an XImage.
1133 static void write_span_TRUEDITHER_ximage( RGBA_SPAN_ARGS
)
1135 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1136 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1138 y
= FLIP(xmesa
->xm_buffer
, y
);
1140 for (i
=0;i
<n
;i
++,x
++) {
1143 PACK_TRUEDITHER(p
, x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1144 XMesaPutPixel( img
, x
, y
, p
);
1149 /* draw all pixels */
1150 for (i
=0;i
<n
;i
++,x
++) {
1152 PACK_TRUEDITHER(p
, x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1153 XMesaPutPixel( img
, x
, y
, p
);
1160 * Write a span of PF_TRUEDITHER pixels to an XImage (no alpha).
1162 static void write_span_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS
)
1164 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1165 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1167 y
= FLIP(xmesa
->xm_buffer
, y
);
1169 for (i
=0;i
<n
;i
++,x
++) {
1172 PACK_TRUEDITHER(p
, x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
1173 XMesaPutPixel( img
, x
, y
, p
);
1178 /* draw all pixels */
1179 for (i
=0;i
<n
;i
++,x
++) {
1181 PACK_TRUEDITHER(p
, x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
1182 XMesaPutPixel( img
, x
, y
, p
);
1189 * Write a span of PF_8A8B8G8R-format pixels to an ximage.
1191 static void write_span_8A8B8G8R_ximage( RGBA_SPAN_ARGS
)
1193 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1195 register GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
, y
);
1199 ptr
[i
] = PACK_8A8B8G8R( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
], rgba
[i
][ACOMP
] );
1204 /* draw all pixels */
1206 ptr
[i
] = PACK_8A8B8G8R( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
], rgba
[i
][ACOMP
] );
1213 * Write a span of PF_8A8B8G8R-format pixels to an ximage (no alpha).
1215 static void write_span_rgb_8A8B8G8R_ximage( RGB_SPAN_ARGS
)
1217 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1219 register GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
, y
);
1223 ptr
[i
] = PACK_8A8B8G8R( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
], 255 );
1228 /* draw all pixels */
1230 ptr
[i
] = PACK_8A8B8G8R( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
], 255 );
1237 * Write a span of PF_8R8G8B-format pixels to an ximage.
1239 static void write_span_8R8G8B_ximage( RGBA_SPAN_ARGS
)
1241 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1243 register GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
, y
);
1247 ptr
[i
] = PACK_8R8G8B(rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1253 ptr
[i
] = PACK_8R8G8B(rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1260 * Write a span of PF_8R8G8B24-format pixels to an ximage.
1262 static void write_span_8R8G8B24_ximage( RGBA_SPAN_ARGS
)
1264 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1266 register GLubyte
*ptr
= (GLubyte
*) PIXELADDR3( xmesa
->xm_buffer
, x
, y
);
1270 GLuint
*ptr4
= (GLuint
*) ptr
;
1271 register GLuint pixel
= *ptr4
;
1272 switch (3 & (int)(ptr
- (GLubyte
*)ptr4
)) {
1274 pixel
&= 0xff000000;
1275 pixel
|= rgba
[i
][BCOMP
];
1276 pixel
|= rgba
[i
][GCOMP
] << 8;
1277 pixel
|= rgba
[i
][RCOMP
] << 16;
1281 pixel
&= 0x00ffffff;
1282 pixel
|= rgba
[i
][BCOMP
] << 24;
1284 pixel
= *ptr4
&& 0xffff0000;
1285 pixel
|= rgba
[i
][GCOMP
];
1286 pixel
|= rgba
[i
][RCOMP
] << 8;
1290 pixel
&= 0x0000ffff;
1291 pixel
|= rgba
[i
][BCOMP
] << 16;
1292 pixel
|= rgba
[i
][GCOMP
] << 24;
1294 pixel
= *ptr4
&& 0xffffff00;
1295 pixel
|= rgba
[i
][RCOMP
];
1299 pixel
&= 0x000000ff;
1300 pixel
|= rgba
[i
][BCOMP
] << 8;
1301 pixel
|= rgba
[i
][GCOMP
] << 16;
1302 pixel
|= rgba
[i
][RCOMP
] << 24;
1311 /* write all pixels */
1313 GLuint
*ptr4
= (GLuint
*) ptr
;
1314 register GLuint pixel
= *ptr4
;
1315 int index
= (int)(ptr
- (GLubyte
*)ptr4
);
1316 register GLuint i
= 0;
1321 pixel
&= 0x00ffffff;
1322 pixel
|= rgba
[i
][BCOMP
] << 24;
1324 pixel
= *ptr4
&& 0xffff0000;
1325 pixel
|= rgba
[i
][GCOMP
];
1326 pixel
|= rgba
[i
++][RCOMP
] << 8;
1331 pixel
&= 0x0000ffff;
1332 pixel
|= rgba
[i
][BCOMP
] << 16;
1333 pixel
|= rgba
[i
][GCOMP
] << 24;
1335 pixel
= *ptr4
&& 0xffffff00;
1336 pixel
|= rgba
[i
++][RCOMP
];
1341 pixel
&= 0x000000ff;
1342 pixel
|= rgba
[i
][BCOMP
] << 8;
1343 pixel
|= rgba
[i
][GCOMP
] << 16;
1344 pixel
|= rgba
[i
++][RCOMP
] << 24;
1351 pixel
= rgba
[i
][BCOMP
];
1352 pixel
|= rgba
[i
][GCOMP
] << 8;
1353 pixel
|= rgba
[i
++][RCOMP
] << 16;
1354 pixel
|= rgba
[i
][BCOMP
] << 24;
1356 pixel
= rgba
[i
][GCOMP
];
1357 pixel
|= rgba
[i
++][RCOMP
] << 8;
1358 pixel
|= rgba
[i
][BCOMP
] << 16;
1359 pixel
|= rgba
[i
][GCOMP
] << 24;
1361 pixel
= rgba
[i
++][RCOMP
];
1362 pixel
|= rgba
[i
][BCOMP
] << 8;
1363 pixel
|= rgba
[i
][GCOMP
] << 16;
1364 pixel
|= rgba
[i
++][RCOMP
] << 24;
1372 pixel
= *ptr4
& 0xff000000;
1373 pixel
|= rgba
[i
][BCOMP
];
1374 pixel
|= rgba
[i
][GCOMP
] << 8;
1375 pixel
|= rgba
[i
][RCOMP
] << 16;
1379 pixel
= rgba
[i
][BCOMP
];
1380 pixel
|= rgba
[i
][GCOMP
] << 8;
1381 pixel
|= rgba
[i
++][RCOMP
] << 16;
1382 pixel
|= rgba
[i
][BCOMP
] << 24;
1384 pixel
= *ptr4
& 0xffff0000;
1385 pixel
|= rgba
[i
][GCOMP
];
1386 pixel
|= rgba
[i
][RCOMP
] << 8;
1390 pixel
= rgba
[i
][BCOMP
];
1391 pixel
|= rgba
[i
][GCOMP
] << 8;
1392 pixel
|= rgba
[i
++][RCOMP
] << 16;
1393 pixel
|= rgba
[i
][BCOMP
] << 24;
1395 pixel
= rgba
[i
][GCOMP
];
1396 pixel
|= rgba
[i
++][RCOMP
] << 8;
1397 pixel
|= rgba
[i
][BCOMP
] << 16;
1398 pixel
|= rgba
[i
][GCOMP
] << 24;
1400 pixel
= *ptr4
& 0xffffff00;
1401 pixel
|= rgba
[i
][RCOMP
];
1410 * Write a span of PF_8R8G8B-format pixels to an ximage (no alpha).
1412 static void write_span_rgb_8R8G8B_ximage( RGB_SPAN_ARGS
)
1414 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1416 register GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
, y
);
1420 ptr
[i
] = PACK_8R8G8B(rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
1425 /* draw all pixels */
1427 ptr
[i
] = PACK_8R8G8B(rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
1434 * Write a span of PF_8R8G8B24-format pixels to an ximage (no alpha).
1436 static void write_span_rgb_8R8G8B24_ximage( RGB_SPAN_ARGS
)
1438 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1440 register GLubyte
*ptr
= (GLubyte
*) PIXELADDR3( xmesa
->xm_buffer
, x
, y
);
1444 *ptr
++ = rgb
[i
][BCOMP
];
1445 *ptr
++ = rgb
[i
][GCOMP
];
1446 *ptr
++ = rgb
[i
][RCOMP
];
1454 /* draw all pixels */
1456 *ptr
++ = rgb
[i
][BCOMP
];
1457 *ptr
++ = rgb
[i
][GCOMP
];
1458 *ptr
++ = rgb
[i
][RCOMP
];
1465 * Write a span of PF_5R6G5B-format pixels to an ximage.
1467 static void write_span_5R6G5B_ximage( RGBA_SPAN_ARGS
)
1469 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1471 register GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
, y
);
1475 ptr
[i
] = PACK_5R6G5B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1480 /* draw all pixels */
1481 #if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */
1482 GLuint
*ptr32
= (GLuint
*) ptr
;
1483 GLuint extraPixel
= (n
& 1);
1485 for (i
= 0; i
< n
; i
+= 2) {
1487 p0
= PACK_5R6G5B(rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1488 p1
= PACK_5R6G5B(rgba
[i
+1][RCOMP
], rgba
[i
+1][GCOMP
], rgba
[i
+1][BCOMP
]);
1489 *ptr32
++ = (p1
<< 16) | p0
;
1492 ptr
[n
] = PACK_5R6G5B(rgba
[n
][RCOMP
], rgba
[n
][GCOMP
], rgba
[n
][BCOMP
]);
1495 for (i
= 0; i
< n
; i
++) {
1496 ptr
[i
] = PACK_5R6G5B(rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1504 * Write a span of PF_DITHER_5R6G5B-format pixels to an ximage.
1506 static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS
)
1508 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1510 register GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
, y
);
1512 for (i
=0;i
<n
;i
++,x
++) {
1514 PACK_TRUEDITHER( ptr
[i
], x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1519 /* draw all pixels */
1520 #if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */
1521 GLuint
*ptr32
= (GLuint
*) ptr
;
1522 GLuint extraPixel
= (n
& 1);
1524 for (i
= 0; i
< n
; i
+= 2, x
+= 2) {
1526 PACK_TRUEDITHER( p0
, x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1527 PACK_TRUEDITHER( p1
, x
+1, y
, rgba
[i
+1][RCOMP
], rgba
[i
+1][GCOMP
], rgba
[i
+1][BCOMP
] );
1528 *ptr32
++ = (p1
<< 16) | p0
;
1531 PACK_TRUEDITHER( ptr
[n
], x
+n
, y
, rgba
[n
][RCOMP
], rgba
[n
][GCOMP
], rgba
[n
][BCOMP
]);
1534 for (i
= 0; i
< n
; i
++, x
++) {
1535 PACK_TRUEDITHER( ptr
[i
], x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
1543 * Write a span of PF_5R6G5B-format pixels to an ximage (no alpha).
1545 static void write_span_rgb_5R6G5B_ximage( RGB_SPAN_ARGS
)
1547 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1549 register GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
, y
);
1553 ptr
[i
] = PACK_5R6G5B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1558 /* draw all pixels */
1559 #if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */
1560 GLuint
*ptr32
= (GLuint
*) ptr
;
1561 GLuint extraPixel
= (n
& 1);
1563 for (i
= 0; i
< n
; i
+= 2) {
1565 p0
= PACK_5R6G5B(rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]);
1566 p1
= PACK_5R6G5B(rgb
[i
+1][RCOMP
], rgb
[i
+1][GCOMP
], rgb
[i
+1][BCOMP
]);
1567 *ptr32
++ = (p1
<< 16) | p0
;
1570 ptr
[n
] = PACK_5R6G5B(rgb
[n
][RCOMP
], rgb
[n
][GCOMP
], rgb
[n
][BCOMP
]);
1574 ptr
[i
] = PACK_5R6G5B( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1582 * Write a span of PF_DITHER_5R6G5B-format pixels to an ximage (no alpha).
1584 static void write_span_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS
)
1586 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1588 register GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
, y
);
1590 for (i
=0;i
<n
;i
++,x
++) {
1592 PACK_TRUEDITHER( ptr
[i
], x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1597 /* draw all pixels */
1598 #if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */
1599 GLuint
*ptr32
= (GLuint
*) ptr
;
1600 GLuint extraPixel
= (n
& 1);
1602 for (i
= 0; i
< n
; i
+= 2, x
+= 2) {
1604 PACK_TRUEDITHER( p0
, x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1605 PACK_TRUEDITHER( p1
, x
+1, y
, rgb
[i
+1][RCOMP
], rgb
[i
+1][GCOMP
], rgb
[i
+1][BCOMP
] );
1606 *ptr32
++ = (p1
<< 16) | p0
;
1609 PACK_TRUEDITHER( ptr
[n
], x
+n
, y
, rgb
[n
][RCOMP
], rgb
[n
][GCOMP
], rgb
[n
][BCOMP
]);
1612 for (i
=0;i
<n
;i
++,x
++) {
1613 PACK_TRUEDITHER( ptr
[i
], x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1621 * Write a span of PF_DITHER pixels to an XImage.
1623 static void write_span_DITHER_ximage( RGBA_SPAN_ARGS
)
1625 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1626 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1628 int yy
= FLIP(xmesa
->xm_buffer
, y
);
1631 for (i
=0;i
<n
;i
++,x
++) {
1633 XMesaPutPixel( img
, x
, yy
, XDITHER( x
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1638 /* draw all pixels */
1639 for (i
=0;i
<n
;i
++,x
++) {
1640 XMesaPutPixel( img
, x
, yy
, XDITHER( x
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1647 * Write a span of PF_DITHER pixels to an XImage (no alpha).
1649 static void write_span_rgb_DITHER_ximage( RGB_SPAN_ARGS
)
1651 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1652 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1654 int yy
= FLIP(xmesa
->xm_buffer
, y
);
1657 for (i
=0;i
<n
;i
++,x
++) {
1659 XMesaPutPixel( img
, x
, yy
, XDITHER( x
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1664 /* draw all pixels */
1665 for (i
=0;i
<n
;i
++,x
++) {
1666 XMesaPutPixel( img
, x
, yy
, XDITHER( x
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1674 * Write a span of 8-bit PF_DITHER pixels to an XImage.
1676 static void write_span_DITHER8_ximage( RGBA_SPAN_ARGS
)
1678 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1680 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1683 for (i
=0;i
<n
;i
++,x
++) {
1685 ptr
[i
] = (GLubyte
) XDITHER( x
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1690 for (i
=0;i
<n
;i
++,x
++) {
1691 ptr
[i
] = (GLubyte
) XDITHER( x
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1697 static void write_span_rgb_DITHER8_ximage( RGB_SPAN_ARGS
)
1699 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1701 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1704 for (i
=0;i
<n
;i
++,x
++) {
1706 ptr
[i
] = (GLubyte
) XDITHER( x
, rgb
[i
][0], rgb
[i
][1], rgb
[i
][2] );
1711 const GLubyte
*data
= (GLubyte
*) rgb
;
1712 for (i
=0;i
<n
;i
++,x
++) {
1713 /*ptr[i] = XDITHER( x, rgb[i][0], rgb[i][1], rgb[i][2] );*/
1714 ptr
[i
] = (GLubyte
) XDITHER( x
, data
[i
+i
+i
], data
[i
+i
+i
+1], data
[i
+i
+i
+2] );
1722 * Write a span of PF_1BIT pixels to an XImage.
1724 static void write_span_1BIT_ximage( RGBA_SPAN_ARGS
)
1726 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1727 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1730 y
= FLIP(xmesa
->xm_buffer
, y
);
1732 for (i
=0;i
<n
;i
++,x
++) {
1734 XMesaPutPixel(img
, x
, y
, DITHER_1BIT(x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]));
1739 for (i
=0;i
<n
;i
++,x
++) {
1740 XMesaPutPixel( img
, x
, y
, DITHER_1BIT(x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]) );
1747 * Write a span of PF_1BIT pixels to an XImage (no alpha).
1749 static void write_span_rgb_1BIT_ximage( RGB_SPAN_ARGS
)
1751 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1752 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1755 y
= FLIP(xmesa
->xm_buffer
, y
);
1757 for (i
=0;i
<n
;i
++,x
++) {
1759 XMesaPutPixel(img
, x
, y
, DITHER_1BIT(x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]));
1764 for (i
=0;i
<n
;i
++,x
++) {
1765 XMesaPutPixel( img
, x
, y
, DITHER_1BIT(x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
]) );
1772 * Write a span of PF_HPCR pixels to an XImage.
1774 static void write_span_HPCR_ximage( RGBA_SPAN_ARGS
)
1776 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1778 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1780 for (i
=0;i
<n
;i
++,x
++) {
1782 ptr
[i
] = DITHER_HPCR( x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1787 /* draw all pixels */
1788 for (i
=0;i
<n
;i
++,x
++) {
1789 ptr
[i
] = DITHER_HPCR( x
, y
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1796 * Write a span of PF_HPCR pixels to an XImage (no alpha).
1798 static void write_span_rgb_HPCR_ximage( RGB_SPAN_ARGS
)
1800 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1802 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1804 for (i
=0;i
<n
;i
++,x
++) {
1806 ptr
[i
] = DITHER_HPCR( x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1811 /* draw all pixels */
1812 for (i
=0;i
<n
;i
++,x
++) {
1813 ptr
[i
] = DITHER_HPCR( x
, y
, rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
1820 * Write a span of PF_LOOKUP pixels to an XImage.
1822 static void write_span_LOOKUP_ximage( RGBA_SPAN_ARGS
)
1824 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1825 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1828 y
= FLIP(xmesa
->xm_buffer
, y
);
1830 for (i
=0;i
<n
;i
++,x
++) {
1832 XMesaPutPixel( img
, x
, y
, LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1837 /* draw all pixels */
1838 for (i
=0;i
<n
;i
++,x
++) {
1839 XMesaPutPixel( img
, x
, y
, LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1846 * Write a span of PF_LOOKUP pixels to an XImage (no alpha).
1848 static void write_span_rgb_LOOKUP_ximage( RGB_SPAN_ARGS
)
1850 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1851 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1854 y
= FLIP(xmesa
->xm_buffer
, y
);
1856 for (i
=0;i
<n
;i
++,x
++) {
1858 XMesaPutPixel( img
, x
, y
, LOOKUP( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1863 /* draw all pixels */
1864 for (i
=0;i
<n
;i
++,x
++) {
1865 XMesaPutPixel( img
, x
, y
, LOOKUP( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1872 * Write a span of 8-bit PF_LOOKUP pixels to an XImage.
1874 static void write_span_LOOKUP8_ximage( RGBA_SPAN_ARGS
)
1876 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1878 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1881 for (i
=0;i
<n
;i
++,x
++) {
1883 ptr
[i
] = (GLubyte
) LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1888 /* draw all pixels */
1889 for (i
=0;i
<n
;i
++,x
++) {
1890 ptr
[i
] = (GLubyte
) LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1896 static void write_rgb_LOOKUP8_ximage( const GLcontext
*ctx
,
1897 GLuint n
, GLint x
, GLint y
,
1898 CONST GLubyte rgb
[][3],
1899 const GLubyte mask
[] )
1901 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1903 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1906 for (i
=0;i
<n
;i
++,x
++) {
1908 ptr
[i
] = (GLubyte
) LOOKUP( rgb
[i
][0], rgb
[i
][1], rgb
[i
][2] );
1913 /* draw all pixels */
1914 const GLubyte
*data
= (GLubyte
*) rgb
;
1915 for (i
=0;i
<n
;i
++,x
++) {
1916 /*ptr[i] = LOOKUP( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );*/
1917 ptr
[i
] = (GLubyte
) LOOKUP( data
[i
+i
+i
], data
[i
+i
+i
+1], data
[i
+i
+i
+2] );
1924 * Write a span of PF_GRAYSCALE pixels to an XImage.
1926 static void write_span_GRAYSCALE_ximage( RGBA_SPAN_ARGS
)
1928 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1929 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1931 y
= FLIP(xmesa
->xm_buffer
, y
);
1933 for (i
=0;i
<n
;i
++,x
++) {
1935 XMesaPutPixel( img
, x
, y
, GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1940 /* draw all pixels */
1941 for (i
=0;i
<n
;i
++,x
++) {
1942 XMesaPutPixel( img
, x
, y
, GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
1949 * Write a span of PF_GRAYSCALE pixels to an XImage (no alpha).
1951 static void write_span_rgb_GRAYSCALE_ximage( RGB_SPAN_ARGS
)
1953 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1954 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
1956 y
= FLIP(xmesa
->xm_buffer
, y
);
1958 for (i
=0;i
<n
;i
++,x
++) {
1960 XMesaPutPixel( img
, x
, y
, GRAY_RGB( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1965 /* draw all pixels */
1966 for (i
=0;i
<n
;i
++,x
++) {
1967 XMesaPutPixel( img
, x
, y
, GRAY_RGB( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] ) );
1974 * Write a span of 8-bit PF_GRAYSCALE pixels to an XImage.
1976 static void write_span_GRAYSCALE8_ximage( RGBA_SPAN_ARGS
)
1978 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
1980 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
1984 ptr
[i
] = (GLubyte
) GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1989 /* draw all pixels */
1991 ptr
[i
] = (GLubyte
) GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
1998 * Write a span of 8-bit PF_GRAYSCALE pixels to an XImage (no alpha).
2000 static void write_span_rgb_GRAYSCALE8_ximage( RGB_SPAN_ARGS
)
2002 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2004 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
, y
);
2008 ptr
[i
] = (GLubyte
) GRAY_RGB( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
2013 /* draw all pixels */
2015 ptr
[i
] = (GLubyte
) GRAY_RGB( rgb
[i
][RCOMP
], rgb
[i
][GCOMP
], rgb
[i
][BCOMP
] );
2023 /**********************************************************************/
2024 /*** Write COLOR PIXEL functions ***/
2025 /**********************************************************************/
2028 #define RGBA_PIXEL_ARGS const GLcontext *ctx, \
2029 GLuint n, const GLint x[], const GLint y[], \
2030 CONST GLubyte rgba[][4], const GLubyte mask[]
2034 * Write an array of PF_TRUECOLOR pixels to a pixmap.
2036 static void write_pixels_TRUECOLOR_pixmap( RGBA_PIXEL_ARGS
)
2038 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2039 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2040 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2041 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2046 PACK_TRUECOLOR( p
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2047 XMesaSetForeground( dpy
, gc
, p
);
2048 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2055 * Write an array of PF_TRUEDITHER pixels to a pixmap.
2057 static void write_pixels_TRUEDITHER_pixmap( RGBA_PIXEL_ARGS
)
2059 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2060 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2061 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2062 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2067 PACK_TRUEDITHER(p
, x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
2068 XMesaSetForeground( dpy
, gc
, p
);
2069 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2076 * Write an array of PF_8A8B8G8R pixels to a pixmap.
2078 static void write_pixels_8A8B8G8R_pixmap( RGBA_PIXEL_ARGS
)
2080 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2081 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2082 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2083 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2087 XMesaSetForeground( dpy
, gc
,
2088 PACK_8A8B8G8R( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
], rgba
[i
][ACOMP
] ));
2089 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2096 * Write an array of PF_8R8G8B pixels to a pixmap.
2098 static void write_pixels_8R8G8B_pixmap( RGBA_PIXEL_ARGS
)
2100 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2101 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2102 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2103 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2107 XMesaSetForeground( dpy
, gc
, PACK_8R8G8B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2108 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2115 * Write an array of PF_8R8G8B24 pixels to a pixmap.
2117 static void write_pixels_8R8G8B24_pixmap( RGBA_PIXEL_ARGS
)
2119 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2120 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2121 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2122 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2126 XMesaSetForeground( dpy
, gc
, PACK_8R8G8B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2127 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2134 * Write an array of PF_5R6G5B pixels to a pixmap.
2136 static void write_pixels_5R6G5B_pixmap( RGBA_PIXEL_ARGS
)
2138 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2139 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2140 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2141 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2145 XMesaSetForeground( dpy
, gc
, PACK_5R6G5B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2146 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2153 * Write an array of PF_DITHER_5R6G5B pixels to a pixmap.
2155 static void write_pixels_DITHER_5R6G5B_pixmap( RGBA_PIXEL_ARGS
)
2157 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2158 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2159 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2160 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2165 PACK_TRUEDITHER(p
, x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2166 XMesaSetForeground( dpy
, gc
, p
);
2167 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2174 * Write an array of PF_DITHER pixels to a pixmap.
2176 static void write_pixels_DITHER_pixmap( RGBA_PIXEL_ARGS
)
2178 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2179 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2180 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2181 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2186 XMesaSetForeground( dpy
, gc
,
2187 DITHER(x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]) );
2188 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2195 * Write an array of PF_1BIT pixels to a pixmap.
2197 static void write_pixels_1BIT_pixmap( RGBA_PIXEL_ARGS
)
2199 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2200 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2201 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2202 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2207 XMesaSetForeground( dpy
, gc
,
2208 DITHER_1BIT( x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ));
2209 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2216 * Write an array of PF_HPCR pixels to a pixmap.
2218 static void write_pixels_HPCR_pixmap( RGBA_PIXEL_ARGS
)
2220 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2221 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2222 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2223 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2227 XMesaSetForeground( dpy
, gc
,
2228 DITHER_HPCR( x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ));
2229 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2236 * Write an array of PF_LOOKUP pixels to a pixmap.
2238 static void write_pixels_LOOKUP_pixmap( RGBA_PIXEL_ARGS
)
2240 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2241 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2242 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2243 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2248 XMesaSetForeground( dpy
, gc
, LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2249 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2256 * Write an array of PF_GRAYSCALE pixels to a pixmap.
2258 static void write_pixels_GRAYSCALE_pixmap( RGBA_PIXEL_ARGS
)
2260 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2261 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2262 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2263 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2267 XMesaSetForeground( dpy
, gc
, GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2268 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2275 * Write an array of PF_TRUECOLOR pixels to an ximage.
2277 static void write_pixels_TRUECOLOR_ximage( RGBA_PIXEL_ARGS
)
2279 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2280 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2285 PACK_TRUECOLOR( p
, rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2286 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), p
);
2293 * Write an array of PF_TRUEDITHER pixels to an XImage.
2295 static void write_pixels_TRUEDITHER_ximage( RGBA_PIXEL_ARGS
)
2297 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2298 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2303 PACK_TRUEDITHER(p
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]);
2304 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), p
);
2311 * Write an array of PF_8A8B8G8R pixels to an ximage.
2313 static void write_pixels_8A8B8G8R_ximage( RGBA_PIXEL_ARGS
)
2315 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2319 GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
[i
], y
[i
] );
2320 *ptr
= PACK_8A8B8G8R( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
], rgba
[i
][ACOMP
] );
2327 * Write an array of PF_8R8G8B pixels to an ximage.
2329 static void write_pixels_8R8G8B_ximage( RGBA_PIXEL_ARGS
)
2331 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2335 GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
[i
], y
[i
] );
2336 *ptr
= PACK_8R8G8B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2343 * Write an array of PF_8R8G8B24 pixels to an ximage.
2345 static void write_pixels_8R8G8B24_ximage( RGBA_PIXEL_ARGS
)
2347 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2351 bgr_t
*ptr
= PIXELADDR3( xmesa
->xm_buffer
, x
[i
], y
[i
] );
2352 ptr
->r
= rgba
[i
][RCOMP
];
2353 ptr
->g
= rgba
[i
][GCOMP
];
2354 ptr
->b
= rgba
[i
][BCOMP
];
2361 * Write an array of PF_5R6G5B pixels to an ximage.
2363 static void write_pixels_5R6G5B_ximage( RGBA_PIXEL_ARGS
)
2365 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2369 GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
[i
], y
[i
] );
2370 *ptr
= PACK_5R6G5B( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2377 * Write an array of PF_DITHER_5R6G5B pixels to an ximage.
2379 static void write_pixels_DITHER_5R6G5B_ximage( RGBA_PIXEL_ARGS
)
2381 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2385 GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
[i
], y
[i
] );
2386 PACK_TRUEDITHER( *ptr
, x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2393 * Write an array of PF_DITHER pixels to an XImage.
2395 static void write_pixels_DITHER_ximage( RGBA_PIXEL_ARGS
)
2397 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2398 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2403 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]),
2404 DITHER( x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2411 * Write an array of 8-bit PF_DITHER pixels to an XImage.
2413 static void write_pixels_DITHER8_ximage( RGBA_PIXEL_ARGS
)
2415 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2420 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
2421 *ptr
= (GLubyte
) DITHER( x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2428 * Write an array of PF_1BIT pixels to an XImage.
2430 static void write_pixels_1BIT_ximage( RGBA_PIXEL_ARGS
)
2432 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2433 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2438 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]),
2439 DITHER_1BIT( x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ));
2446 * Write an array of PF_HPCR pixels to an XImage.
2448 static void write_pixels_HPCR_ximage( RGBA_PIXEL_ARGS
)
2450 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2454 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
2455 *ptr
= (GLubyte
) DITHER_HPCR( x
[i
], y
[i
], rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2462 * Write an array of PF_LOOKUP pixels to an XImage.
2464 static void write_pixels_LOOKUP_ximage( RGBA_PIXEL_ARGS
)
2466 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2467 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2472 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), LOOKUP(rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
]) );
2479 * Write an array of 8-bit PF_LOOKUP pixels to an XImage.
2481 static void write_pixels_LOOKUP8_ximage( RGBA_PIXEL_ARGS
)
2483 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2488 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
2489 *ptr
= (GLubyte
) LOOKUP( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2496 * Write an array of PF_GRAYSCALE pixels to an XImage.
2498 static void write_pixels_GRAYSCALE_ximage( RGBA_PIXEL_ARGS
)
2500 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2501 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2505 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]),
2506 GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] ) );
2513 * Write an array of 8-bit PF_GRAYSCALE pixels to an XImage.
2515 static void write_pixels_GRAYSCALE8_ximage( RGBA_PIXEL_ARGS
)
2517 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2521 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
, x
[i
], y
[i
] );
2522 *ptr
= (GLubyte
) GRAY_RGB( rgba
[i
][RCOMP
], rgba
[i
][GCOMP
], rgba
[i
][BCOMP
] );
2530 /**********************************************************************/
2531 /*** Write MONO COLOR SPAN functions ***/
2532 /**********************************************************************/
2534 #define MONO_SPAN_ARGS const GLcontext *ctx, \
2535 GLuint n, GLint x, GLint y, const GLubyte mask[]
2539 * Write a span of identical pixels to a pixmap. The pixel value is
2540 * the one set by DD.color() or DD.index().
2542 static void write_span_mono_pixmap( MONO_SPAN_ARGS
)
2544 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2545 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2546 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2547 XMesaGC gc
= xmesa
->xm_buffer
->gc1
;
2549 register GLboolean write_all
;
2550 y
= FLIP(xmesa
->xm_buffer
, y
);
2551 write_all
= GL_TRUE
;
2554 write_all
= GL_FALSE
;
2559 XMesaFillRectangle( dpy
, buffer
, gc
, (int) x
, (int) y
, n
, 1 );
2562 for (i
=0;i
<n
;i
++,x
++) {
2564 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
2572 * Write a span of PF_TRUEDITHER pixels to a pixmap. The pixel value is
2573 * the one set by DD.color() or DD.index().
2575 static void write_span_mono_TRUEDITHER_pixmap( MONO_SPAN_ARGS
)
2577 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2578 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2579 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2580 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2582 register GLubyte r
, g
, b
;
2583 int yy
= FLIP(xmesa
->xm_buffer
, y
);
2587 for (i
=0;i
<n
;i
++,x
++) {
2590 PACK_TRUEDITHER(p
, x
, yy
, r
, g
, b
);
2591 XMesaSetForeground( dpy
, gc
, p
);
2592 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) yy
);
2599 * Write a span of PF_DITHER pixels to a pixmap. The pixel value is
2600 * the one set by DD.color() or DD.index().
2602 static void write_span_mono_DITHER_pixmap( MONO_SPAN_ARGS
)
2604 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2605 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2606 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2607 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2609 register GLubyte r
, g
, b
;
2610 int yy
= FLIP(xmesa
->xm_buffer
, y
);
2615 for (i
=0;i
<n
;i
++,x
++) {
2617 XMesaSetForeground( dpy
, gc
, XDITHER( x
, r
, g
, b
) );
2618 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) yy
);
2625 * Write a span of PF_1BIT pixels to a pixmap. The pixel value is
2626 * the one set by DD.color() or DD.index().
2628 static void write_span_mono_1BIT_pixmap( MONO_SPAN_ARGS
)
2630 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2631 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2632 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2633 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2635 register GLubyte r
, g
, b
;
2640 y
= FLIP(xmesa
->xm_buffer
, y
);
2641 for (i
=0;i
<n
;i
++,x
++) {
2643 XMesaSetForeground( dpy
, gc
, DITHER_1BIT( x
, y
, r
, g
, b
) );
2644 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
2651 * Write a span of identical pixels to an XImage. The pixel value is
2652 * the one set by DD.color() or DD.index().
2654 static void write_span_mono_ximage( MONO_SPAN_ARGS
)
2656 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2657 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2659 register unsigned long p
= xmesa
->pixel
;
2660 y
= FLIP(xmesa
->xm_buffer
, y
);
2661 for (i
=0;i
<n
;i
++,x
++) {
2663 XMesaPutPixel( img
, x
, y
, p
);
2670 * Write a span of identical PF_TRUEDITHER pixels to an XImage. The pixel
2671 * value is the one set by DD.color().
2673 static void write_span_mono_TRUEDITHER_ximage( MONO_SPAN_ARGS
)
2675 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2676 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2678 GLint r
= xmesa
->red
;
2679 GLint g
= xmesa
->green
;
2680 GLint b
= xmesa
->blue
;
2681 y
= FLIP(xmesa
->xm_buffer
, y
);
2685 PACK_TRUEDITHER( p
, x
+i
, y
, r
, g
, b
);
2686 XMesaPutPixel( img
, x
+i
, y
, p
);
2693 * Write a span of identical 8A8B8G8R pixels to an XImage. The pixel
2694 * value is the one set by DD.color().
2696 static void write_span_mono_8A8B8G8R_ximage( MONO_SPAN_ARGS
)
2698 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2700 p
= (GLuint
) xmesa
->pixel
;
2701 ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
, y
);
2711 * Write a span of identical 8R8G8B pixels to an XImage. The pixel
2712 * value is the one set by DD.color().
2714 static void write_span_mono_8R8G8B_ximage( MONO_SPAN_ARGS
)
2716 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2718 p
= (GLuint
) xmesa
->pixel
;
2719 ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
, y
);
2729 * Write a span of identical 8R8G8B pixels to an XImage. The pixel
2730 * value is the one set by DD.color().
2732 static void write_span_mono_8R8G8B24_ximage( MONO_SPAN_ARGS
)
2734 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2735 const GLubyte r
= (GLubyte
) ((xmesa
->pixel
>> 16) & 0xff);
2736 const GLubyte g
= (GLubyte
) ((xmesa
->pixel
>> 8 ) & 0xff);
2737 const GLubyte b
= (GLubyte
) ((xmesa
->pixel
) & 0xff);
2739 bgr_t
*ptr
= PIXELADDR3( xmesa
->xm_buffer
, x
, y
);
2751 * Write a span of identical DITHER pixels to an XImage. The pixel
2752 * value is the one set by DD.color().
2754 static void write_span_mono_DITHER_ximage( MONO_SPAN_ARGS
)
2756 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2757 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2759 register GLubyte r
, g
, b
;
2760 int yy
= FLIP(xmesa
->xm_buffer
, y
);
2765 for (i
=0;i
<n
;i
++,x
++) {
2767 XMesaPutPixel( img
, x
, yy
, XDITHER( x
, r
, g
, b
) );
2774 * Write a span of identical 8-bit DITHER pixels to an XImage. The pixel
2775 * value is the one set by DD.color().
2777 static void write_span_mono_DITHER8_ximage( MONO_SPAN_ARGS
)
2779 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2781 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
,y
);
2782 register GLubyte r
, g
, b
;
2787 for (i
=0;i
<n
;i
++,x
++) {
2789 ptr
[i
] = (GLubyte
) XDITHER( x
, r
, g
, b
);
2796 * Write a span of identical 8-bit LOOKUP pixels to an XImage. The pixel
2797 * value is the one set by DD.color().
2799 static void write_span_mono_LOOKUP8_ximage( MONO_SPAN_ARGS
)
2801 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2803 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
,y
);
2804 register GLubyte pixel
= (GLubyte
) xmesa
->pixel
;
2814 * Write a span of identical PF_1BIT pixels to an XImage. The pixel
2815 * value is the one set by DD.color().
2817 static void write_span_mono_1BIT_ximage( MONO_SPAN_ARGS
)
2819 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2820 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
2822 register GLubyte r
, g
, b
;
2827 y
= FLIP(xmesa
->xm_buffer
, y
);
2828 for (i
=0;i
<n
;i
++,x
++) {
2830 XMesaPutPixel( img
, x
, y
, DITHER_1BIT( x
, y
, r
, g
, b
) );
2837 * Write a span of identical HPCR pixels to an XImage. The pixel
2838 * value is the one set by DD.color().
2840 static void write_span_mono_HPCR_ximage( MONO_SPAN_ARGS
)
2842 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2844 register GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
,y
);
2845 register GLubyte r
, g
, b
;
2849 for (i
=0;i
<n
;i
++,x
++) {
2851 ptr
[i
] = DITHER_HPCR( x
, y
, r
, g
, b
);
2858 * Write a span of identical 8-bit GRAYSCALE pixels to an XImage. The pixel
2859 * value is the one set by DD.color().
2861 static void write_span_mono_GRAYSCALE8_ximage( MONO_SPAN_ARGS
)
2863 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2865 GLubyte p
= (GLubyte
) xmesa
->pixel
;
2866 GLubyte
*ptr
= (GLubyte
*) PIXELADDR1( xmesa
->xm_buffer
,x
,y
);
2877 * Write a span of identical PF_DITHER_5R6G5B pixels to an XImage. The pixel
2878 * value is the one set by DD.color().
2880 static void write_span_mono_DITHER_5R6G5B_ximage( MONO_SPAN_ARGS
)
2882 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2883 register GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
, y
);
2885 GLint r
= xmesa
->red
;
2886 GLint g
= xmesa
->green
;
2887 GLint b
= xmesa
->blue
;
2888 y
= FLIP(xmesa
->xm_buffer
, y
);
2891 PACK_TRUEDITHER(ptr
[i
], x
+i
, y
, r
, g
, b
);
2898 /**********************************************************************/
2899 /*** Write MONO COLOR PIXELS functions ***/
2900 /**********************************************************************/
2902 #define MONO_PIXEL_ARGS const GLcontext *ctx, \
2903 GLuint n, const GLint x[], const GLint y[], \
2904 const GLubyte mask[]
2907 * Write an array of identical pixels to a pixmap. The pixel value is
2908 * the one set by DD.color() or DD.index.
2910 static void write_pixels_mono_pixmap( MONO_PIXEL_ARGS
)
2912 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2913 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2914 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2915 XMesaGC gc
= xmesa
->xm_buffer
->gc1
;
2919 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2926 * Write an array of PF_TRUEDITHER pixels to a pixmap. The pixel value is
2927 * the one set by DD.color() or DD.index.
2929 static void write_pixels_mono_TRUEDITHER_pixmap( MONO_PIXEL_ARGS
)
2931 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2932 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2933 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2934 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2936 register GLubyte r
, g
, b
;
2943 PACK_TRUEDITHER(p
, x
[i
], y
[i
], r
, g
, b
);
2944 XMesaSetForeground( dpy
, gc
, p
);
2945 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2952 * Write an array of PF_DITHER pixels to a pixmap. The pixel value is
2953 * the one set by DD.color() or DD.index.
2955 static void write_pixels_mono_DITHER_pixmap( MONO_PIXEL_ARGS
)
2957 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2958 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2959 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2960 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2962 register GLubyte r
, g
, b
;
2969 XMesaSetForeground( dpy
, gc
, DITHER( x
[i
], y
[i
], r
, g
, b
) );
2970 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
2977 * Write an array of PF_1BIT pixels to a pixmap. The pixel value is
2978 * the one set by DD.color() or DD.index.
2980 static void write_pixels_mono_1BIT_pixmap( MONO_PIXEL_ARGS
)
2982 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
2983 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
2984 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
2985 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
2987 register GLubyte r
, g
, b
;
2994 XMesaSetForeground( dpy
, gc
, DITHER_1BIT( x
[i
], y
[i
], r
, g
, b
) );
2995 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
3002 * Write an array of identical pixels to an XImage. The pixel value is
3003 * the one set by DD.color() or DD.index.
3005 static void write_pixels_mono_ximage( MONO_PIXEL_ARGS
)
3007 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3008 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
3010 register unsigned long p
= xmesa
->pixel
;
3013 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), p
);
3020 * Write an array of identical TRUEDITHER pixels to an XImage.
3021 * The pixel value is the one set by DD.color() or DD.index.
3023 static void write_pixels_mono_TRUEDITHER_ximage( MONO_PIXEL_ARGS
)
3025 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3026 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
3029 int g
= xmesa
->green
;
3030 int b
= xmesa
->blue
;
3034 PACK_TRUEDITHER(p
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), r
, g
, b
);
3035 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), p
);
3043 * Write an array of identical 8A8B8G8R pixels to an XImage. The pixel value
3044 * is the one set by DD.color().
3046 static void write_pixels_mono_8A8B8G8R_ximage( MONO_PIXEL_ARGS
)
3048 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3050 register GLuint p
= (GLuint
) xmesa
->pixel
;
3053 GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
[i
], y
[i
] );
3061 * Write an array of identical 8R8G8B pixels to an XImage. The pixel value
3062 * is the one set by DD.color().
3064 static void write_pixels_mono_8R8G8B_ximage( MONO_PIXEL_ARGS
)
3066 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3068 register GLuint p
= (GLuint
) xmesa
->pixel
;
3071 GLuint
*ptr
= PIXELADDR4( xmesa
->xm_buffer
, x
[i
], y
[i
] );
3079 * Write an array of identical 8R8G8B pixels to an XImage. The pixel value
3080 * is the one set by DD.color().
3082 static void write_pixels_mono_8R8G8B24_ximage( MONO_PIXEL_ARGS
)
3084 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3085 const GLubyte r
= (GLubyte
) ((xmesa
->pixel
>> 16) & 0xff);
3086 const GLubyte g
= (GLubyte
) ((xmesa
->pixel
>> 8 ) & 0xff);
3087 const GLubyte b
= (GLubyte
) ((xmesa
->pixel
) & 0xff);
3091 bgr_t
*ptr
= PIXELADDR3( xmesa
->xm_buffer
, x
[i
], y
[i
] );
3101 * Write an array of identical PF_DITHER pixels to an XImage. The pixel
3102 * value is the one set by DD.color().
3104 static void write_pixels_mono_DITHER_ximage( MONO_PIXEL_ARGS
)
3106 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3107 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
3109 register GLubyte r
, g
, b
;
3116 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), DITHER( x
[i
], y
[i
], r
, g
, b
) );
3123 * Write an array of identical 8-bit PF_DITHER pixels to an XImage. The
3124 * pixel value is the one set by DD.color().
3126 static void write_pixels_mono_DITHER8_ximage( MONO_PIXEL_ARGS
)
3128 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3130 register GLubyte r
, g
, b
;
3137 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
3138 *ptr
= (GLubyte
) DITHER( x
[i
], y
[i
], r
, g
, b
);
3145 * Write an array of identical 8-bit PF_LOOKUP pixels to an XImage. The
3146 * pixel value is the one set by DD.color().
3148 static void write_pixels_mono_LOOKUP8_ximage( MONO_PIXEL_ARGS
)
3150 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3152 register GLubyte pixel
= (GLubyte
) xmesa
->pixel
;
3155 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
3164 * Write an array of identical PF_1BIT pixels to an XImage. The pixel
3165 * value is the one set by DD.color().
3167 static void write_pixels_mono_1BIT_ximage( MONO_PIXEL_ARGS
)
3169 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3170 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
3172 register GLubyte r
, g
, b
;
3179 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), DITHER_1BIT( x
[i
], y
[i
], r
, g
, b
));
3186 * Write an array of identical PF_HPCR pixels to an XImage. The
3187 * pixel value is the one set by DD.color().
3189 static void write_pixels_mono_HPCR_ximage( MONO_PIXEL_ARGS
)
3191 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3193 register GLubyte r
, g
, b
;
3199 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
3200 *ptr
= DITHER_HPCR( x
[i
], y
[i
], r
, g
, b
);
3207 * Write an array of identical 8-bit PF_GRAYSCALE pixels to an XImage. The
3208 * pixel value is the one set by DD.color().
3210 static void write_pixels_mono_GRAYSCALE8_ximage( MONO_PIXEL_ARGS
)
3212 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3214 register GLubyte p
= (GLubyte
) xmesa
->pixel
;
3217 GLubyte
*ptr
= PIXELADDR1( xmesa
->xm_buffer
,x
[i
],y
[i
]);
3225 * Write an array of identical PF_DITHER_5R6G5B pixels to an XImage.
3226 * The pixel value is the one set by DD.color() or DD.index.
3228 static void write_pixels_mono_DITHER_5R6G5B_ximage( MONO_PIXEL_ARGS
)
3230 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3233 int g
= xmesa
->green
;
3234 int b
= xmesa
->blue
;
3237 GLushort
*ptr
= PIXELADDR2( xmesa
->xm_buffer
, x
[i
], y
[i
] );
3238 PACK_TRUEDITHER(*ptr
, x
[i
], y
[i
], r
, g
, b
);
3245 /**********************************************************************/
3246 /*** Write INDEX SPAN functions ***/
3247 /**********************************************************************/
3249 #define INDEX_SPAN_ARGS const GLcontext *ctx, \
3250 GLuint n, GLint x, GLint y, const GLuint index[], \
3251 const GLubyte mask[]
3253 #define INDEX8_SPAN_ARGS const GLcontext *ctx, \
3254 GLuint n, GLint x, GLint y, const GLubyte index[], \
3255 const GLubyte mask[]
3259 * Write a span of CI pixels to a Pixmap.
3261 static void write_span_index_pixmap( INDEX_SPAN_ARGS
)
3263 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3264 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
3265 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
3266 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
3268 y
= FLIP(xmesa
->xm_buffer
, y
);
3269 for (i
=0;i
<n
;i
++,x
++) {
3271 XMesaSetForeground( dpy
, gc
, (unsigned long) index
[i
] );
3272 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
3279 * Write a span of 8-bit CI pixels to a Pixmap.
3281 static void write_span_index8_pixmap( INDEX8_SPAN_ARGS
)
3283 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3284 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
3285 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
3286 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
3288 y
= FLIP(xmesa
->xm_buffer
, y
);
3289 for (i
=0;i
<n
;i
++,x
++) {
3291 XMesaSetForeground( dpy
, gc
, (unsigned long) index
[i
] );
3292 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
, (int) y
);
3299 * Write a span of CI pixels to an XImage.
3301 static void write_span_index_ximage( INDEX_SPAN_ARGS
)
3303 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3304 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
3306 y
= FLIP(xmesa
->xm_buffer
, y
);
3307 for (i
=0;i
<n
;i
++,x
++) {
3309 XMesaPutPixel( img
, x
, y
, (unsigned long) index
[i
] );
3316 * Write a span of 8-bit CI pixels to a non 8-bit XImage.
3318 static void write_span_index8_ximage( const GLcontext
*ctx
, GLuint n
,
3319 GLint x
, GLint y
, const GLubyte index
[],
3320 const GLubyte mask
[] )
3322 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3327 XMesaPutPixel(xmesa
->xm_buffer
->backimage
, x
+i
, y
, index
[i
]);
3334 XMesaPutPixel(xmesa
->xm_buffer
->backimage
, x
+i
, y
, index
[i
]);
3340 * Write a span of 8-bit CI pixels to an 8-bit XImage.
3342 static void write_span_index8_ximage8( const GLcontext
*ctx
, GLuint n
,
3343 GLint x
, GLint y
, const GLubyte index
[],
3344 const GLubyte mask
[] )
3346 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3347 GLubyte
*dst
= PIXELADDR1( xmesa
->xm_buffer
,x
,y
);
3357 MEMCPY( dst
, index
, n
);
3363 /**********************************************************************/
3364 /*** Write INDEX PIXELS functions ***/
3365 /**********************************************************************/
3367 #define INDEX_PIXELS_ARGS const GLcontext *ctx, \
3368 GLuint n, const GLint x[], const GLint y[], \
3369 const GLuint index[], const GLubyte mask[]
3373 * Write an array of CI pixels to a Pixmap.
3375 static void write_pixels_index_pixmap( INDEX_PIXELS_ARGS
)
3377 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3378 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
3379 XMesaDrawable buffer
= xmesa
->xm_buffer
->buffer
;
3380 XMesaGC gc
= xmesa
->xm_buffer
->gc2
;
3384 XMesaSetForeground( dpy
, gc
, (unsigned long) index
[i
] );
3385 XMesaDrawPoint( dpy
, buffer
, gc
, (int) x
[i
], (int) FLIP(xmesa
->xm_buffer
, y
[i
]) );
3392 * Write an array of CI pixels to an XImage.
3394 static void write_pixels_index_ximage( INDEX_PIXELS_ARGS
)
3396 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3397 XMesaImage
*img
= xmesa
->xm_buffer
->backimage
;
3401 XMesaPutPixel( img
, x
[i
], FLIP(xmesa
->xm_buffer
, y
[i
]), (unsigned long) index
[i
] );
3409 /**********************************************************************/
3410 /***** Pixel reading *****/
3411 /**********************************************************************/
3416 * Read a horizontal span of color-index pixels.
3418 static void read_index_span( const GLcontext
*ctx
,
3419 GLuint n
, GLint x
, GLint y
, GLuint index
[] )
3421 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3425 if (xmesa
->use_read_buffer
)
3426 source
= xmesa
->xm_read_buffer
;
3428 source
= xmesa
->xm_buffer
;
3430 y
= FLIP(source
, y
);
3432 if (source
->buffer
) {
3433 #ifndef XFree86Server
3434 XMesaImage
*span
= NULL
;
3436 catch_xgetimage_errors( xmesa
->display
);
3437 span
= XGetImage( xmesa
->display
, source
->buffer
,
3438 x
, y
, n
, 1, AllPlanes
, ZPixmap
);
3439 error
= check_xgetimage_errors();
3440 if (span
&& !error
) {
3442 index
[i
] = (GLuint
) XMesaGetPixel( span
, i
, 0 );
3446 /* return 0 pixels */
3452 XMesaDestroyImage( span
);
3455 (*xmesa
->display
->GetImage
)(source
->buffer
,
3456 x
, y
, n
, 1, ZPixmap
,
3457 ~0L, (pointer
)index
);
3460 else if (source
->backimage
) {
3461 XMesaImage
*img
= source
->backimage
;
3462 for (i
=0;i
<n
;i
++,x
++) {
3463 index
[i
] = (GLuint
) XMesaGetPixel( img
, x
, y
);
3471 * Read a horizontal span of color pixels.
3473 static void read_color_span( const GLcontext
*ctx
,
3474 GLuint n
, GLint x
, GLint y
,
3477 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3480 if (xmesa
->use_read_buffer
)
3481 source
= xmesa
->xm_read_buffer
;
3483 source
= xmesa
->xm_buffer
;
3485 if (source
->buffer
) {
3486 /* Read from Pixmap or Window */
3487 XMesaImage
*span
= NULL
;
3489 #ifdef XFree86Server
3490 span
= XMesaCreateImage(xmesa
->xm_visual
->BitsPerPixel
, n
, 1, NULL
);
3491 span
->data
= (char *)MALLOC(span
->height
* span
->bytes_per_line
);
3492 error
= (!span
->data
);
3493 (*xmesa
->display
->GetImage
)(source
->buffer
,
3494 x
, FLIP(source
, y
), n
, 1, ZPixmap
,
3495 ~0L, (pointer
)span
->data
);
3497 catch_xgetimage_errors( xmesa
->display
);
3498 span
= XGetImage( xmesa
->display
, source
->buffer
,
3499 x
, FLIP(source
, y
), n
, 1, AllPlanes
, ZPixmap
);
3500 error
= check_xgetimage_errors();
3502 if (span
&& !error
) {
3503 switch (xmesa
->pixelformat
) {
3507 const GLubyte
*pixelToR
= xmesa
->xm_visual
->PixelToR
;
3508 const GLubyte
*pixelToG
= xmesa
->xm_visual
->PixelToG
;
3509 const GLubyte
*pixelToB
= xmesa
->xm_visual
->PixelToB
;
3510 unsigned long rMask
= GET_REDMASK(xmesa
->xm_visual
);
3511 unsigned long gMask
= GET_GREENMASK(xmesa
->xm_visual
);
3512 unsigned long bMask
= GET_BLUEMASK(xmesa
->xm_visual
);
3513 GLint rShift
= xmesa
->xm_visual
->rshift
;
3514 GLint gShift
= xmesa
->xm_visual
->gshift
;
3515 GLint bShift
= xmesa
->xm_visual
->bshift
;
3519 p
= XMesaGetPixel( span
, i
, 0 );
3520 rgba
[i
][RCOMP
] = pixelToR
[(p
& rMask
) >> rShift
];
3521 rgba
[i
][GCOMP
] = pixelToG
[(p
& gMask
) >> gShift
];
3522 rgba
[i
][BCOMP
] = pixelToB
[(p
& bMask
) >> bShift
];
3523 rgba
[i
][ACOMP
] = 255;
3528 case PF_DITHER_5R6G5B
:
3530 const GLubyte
*pixelToR
= xmesa
->xm_visual
->PixelToR
;
3531 const GLubyte
*pixelToG
= xmesa
->xm_visual
->PixelToG
;
3532 const GLubyte
*pixelToB
= xmesa
->xm_visual
->PixelToB
;
3535 unsigned long p
= XMesaGetPixel( span
, i
, 0 );
3536 /* fast, but not quite accurate
3537 rgba[i][RCOMP] = ((p >> 8) & 0xf8);
3538 rgba[i][GCOMP] = ((p >> 3) & 0xfc);
3539 rgba[i][BCOMP] = ((p << 3) & 0xff);
3541 rgba
[i
][RCOMP
] = pixelToR
[p
>> 11];
3542 rgba
[i
][GCOMP
] = pixelToG
[(p
>> 5) & 0x3f];
3543 rgba
[i
][BCOMP
] = pixelToB
[p
& 0x1f];
3544 rgba
[i
][ACOMP
] = 255;
3550 const GLuint
*ptr4
= (GLuint
*) span
->data
;
3553 GLuint p4
= *ptr4
++;
3554 rgba
[i
][RCOMP
] = (GLubyte
) ( p4
& 0xff);
3555 rgba
[i
][GCOMP
] = (GLubyte
) ((p4
>> 8) & 0xff);
3556 rgba
[i
][BCOMP
] = (GLubyte
) ((p4
>> 16) & 0xff);
3557 rgba
[i
][ACOMP
] = (GLubyte
) ((p4
>> 24) & 0xff);
3563 const GLuint
*ptr4
= (GLuint
*) span
->data
;
3566 GLuint p4
= *ptr4
++;
3567 rgba
[i
][RCOMP
] = (GLubyte
) ((p4
>> 16) & 0xff);
3568 rgba
[i
][GCOMP
] = (GLubyte
) ((p4
>> 8) & 0xff);
3569 rgba
[i
][BCOMP
] = (GLubyte
) ( p4
& 0xff);
3570 rgba
[i
][ACOMP
] = 255;
3576 const bgr_t
*ptr3
= (bgr_t
*) span
->data
;
3579 rgba
[i
][RCOMP
] = ptr3
[i
].r
;
3580 rgba
[i
][GCOMP
] = ptr3
[i
].g
;
3581 rgba
[i
][BCOMP
] = ptr3
[i
].b
;
3582 rgba
[i
][ACOMP
] = 255;
3588 GLubyte
*ptr1
= (GLubyte
*) span
->data
;
3591 GLubyte p
= *ptr1
++;
3592 rgba
[i
][RCOMP
] = p
& 0xE0;
3593 rgba
[i
][GCOMP
] = (p
& 0x1C) << 3;
3594 rgba
[i
][BCOMP
] = (p
& 0x03) << 6;
3595 rgba
[i
][ACOMP
] = 255;
3603 GLubyte
*rTable
= source
->pixel_to_r
;
3604 GLubyte
*gTable
= source
->pixel_to_g
;
3605 GLubyte
*bTable
= source
->pixel_to_b
;
3606 if (GET_VISUAL_DEPTH(xmesa
->xm_visual
)==8) {
3607 const GLubyte
*ptr1
= (GLubyte
*) span
->data
;
3610 unsigned long p
= *ptr1
++;
3611 rgba
[i
][RCOMP
] = rTable
[p
];
3612 rgba
[i
][GCOMP
] = gTable
[p
];
3613 rgba
[i
][BCOMP
] = bTable
[p
];
3614 rgba
[i
][ACOMP
] = 255;
3620 unsigned long p
= XMesaGetPixel( span
, i
, 0 );
3621 rgba
[i
][RCOMP
] = rTable
[p
];
3622 rgba
[i
][GCOMP
] = gTable
[p
];
3623 rgba
[i
][BCOMP
] = bTable
[p
];
3624 rgba
[i
][ACOMP
] = 255;
3631 int bitFlip
= xmesa
->xm_visual
->bitFlip
;
3635 p
= XMesaGetPixel( span
, i
, 0 ) ^ bitFlip
;
3636 rgba
[i
][RCOMP
] = (GLubyte
) (p
* 255);
3637 rgba
[i
][GCOMP
] = (GLubyte
) (p
* 255);
3638 rgba
[i
][BCOMP
] = (GLubyte
) (p
* 255);
3639 rgba
[i
][ACOMP
] = 255;
3644 gl_problem(NULL
,"Problem in DD.read_color_span (1)");
3649 /* return black pixels */
3652 rgba
[i
][RCOMP
] = rgba
[i
][GCOMP
] = rgba
[i
][BCOMP
] = rgba
[i
][ACOMP
] = 0;
3656 XMesaDestroyImage( span
);
3659 else if (source
->backimage
) {
3660 /* Read from XImage back buffer */
3661 switch (xmesa
->pixelformat
) {
3665 const GLubyte
*pixelToR
= xmesa
->xm_visual
->PixelToR
;
3666 const GLubyte
*pixelToG
= xmesa
->xm_visual
->PixelToG
;
3667 const GLubyte
*pixelToB
= xmesa
->xm_visual
->PixelToB
;
3668 unsigned long rMask
= GET_REDMASK(xmesa
->xm_visual
);
3669 unsigned long gMask
= GET_GREENMASK(xmesa
->xm_visual
);
3670 unsigned long bMask
= GET_BLUEMASK(xmesa
->xm_visual
);
3671 GLint rShift
= xmesa
->xm_visual
->rshift
;
3672 GLint gShift
= xmesa
->xm_visual
->gshift
;
3673 GLint bShift
= xmesa
->xm_visual
->bshift
;
3674 XMesaImage
*img
= source
->backimage
;
3676 y
= FLIP(source
, y
);
3679 p
= XMesaGetPixel( img
, x
+i
, y
);
3680 rgba
[i
][RCOMP
] = pixelToR
[(p
& rMask
) >> rShift
];
3681 rgba
[i
][GCOMP
] = pixelToG
[(p
& gMask
) >> gShift
];
3682 rgba
[i
][BCOMP
] = pixelToB
[(p
& bMask
) >> bShift
];
3683 rgba
[i
][ACOMP
] = 255;
3688 case PF_DITHER_5R6G5B
:
3690 const GLubyte
*pixelToR
= xmesa
->xm_visual
->PixelToR
;
3691 const GLubyte
*pixelToG
= xmesa
->xm_visual
->PixelToG
;
3692 const GLubyte
*pixelToB
= xmesa
->xm_visual
->PixelToB
;
3693 const GLushort
*ptr2
= PIXELADDR2( source
, x
, y
);
3694 const GLuint
*ptr4
= (const GLuint
*) ptr2
;
3696 #if defined(__i386__) /* word stores don't have to be on 4-byte boundaries */
3697 GLuint extraPixel
= (n
& 1);
3699 for (i
= 0; i
< n
; i
+= 2) {
3700 const GLuint p
= *ptr4
++;
3701 const GLuint p0
= p
& 0xffff;
3702 const GLuint p1
= p
>> 16;
3703 /* fast, but not quite accurate
3704 rgba[i][RCOMP] = ((p >> 8) & 0xf8);
3705 rgba[i][GCOMP] = ((p >> 3) & 0xfc);
3706 rgba[i][BCOMP] = ((p << 3) & 0xff);
3708 rgba
[i
][RCOMP
] = pixelToR
[p0
>> 11];
3709 rgba
[i
][GCOMP
] = pixelToG
[(p0
>> 5) & 0x3f];
3710 rgba
[i
][BCOMP
] = pixelToB
[p0
& 0x1f];
3711 rgba
[i
][ACOMP
] = 255;
3712 rgba
[i
+1][RCOMP
] = pixelToR
[p1
>> 11];
3713 rgba
[i
+1][GCOMP
] = pixelToG
[(p1
>> 5) & 0x3f];
3714 rgba
[i
+1][BCOMP
] = pixelToB
[p1
& 0x1f];
3715 rgba
[i
+1][ACOMP
] = 255;
3718 GLushort p
= ptr2
[n
];
3719 rgba
[n
][RCOMP
] = pixelToR
[p
>> 11];
3720 rgba
[n
][GCOMP
] = pixelToG
[(p
>> 5) & 0x3f];
3721 rgba
[n
][BCOMP
] = pixelToB
[p
& 0x1f];
3722 rgba
[n
][ACOMP
] = 255;
3725 for (i
= 0; i
< n
; i
++) {
3726 const GLushort p
= ptr2
[i
];
3727 rgba
[i
][RCOMP
] = pixelToR
[p
>> 11];
3728 rgba
[i
][GCOMP
] = pixelToG
[(p
>> 5) & 0x3f];
3729 rgba
[i
][BCOMP
] = pixelToB
[p
& 0x1f];
3730 rgba
[i
][ACOMP
] = 255;
3737 const GLuint
*ptr4
= PIXELADDR4( source
, x
, y
);
3740 GLuint p4
= *ptr4
++;
3741 rgba
[i
][RCOMP
] = (GLubyte
) ( p4
& 0xff);
3742 rgba
[i
][GCOMP
] = (GLubyte
) ((p4
>> 8) & 0xff);
3743 rgba
[i
][BCOMP
] = (GLubyte
) ((p4
>> 16) & 0xff);
3744 rgba
[i
][ACOMP
] = (GLint
) ((p4
>> 24) & 0xff);
3750 const GLuint
*ptr4
= PIXELADDR4( source
, x
, y
);
3753 GLuint p4
= *ptr4
++;
3754 rgba
[i
][RCOMP
] = (GLubyte
) ((p4
>> 16) & 0xff);
3755 rgba
[i
][GCOMP
] = (GLubyte
) ((p4
>> 8) & 0xff);
3756 rgba
[i
][BCOMP
] = (GLubyte
) ( p4
& 0xff);
3757 rgba
[i
][ACOMP
] = 255;
3763 const bgr_t
*ptr3
= PIXELADDR3( source
, x
, y
);
3766 rgba
[i
][RCOMP
] = ptr3
[i
].r
;
3767 rgba
[i
][GCOMP
] = ptr3
[i
].g
;
3768 rgba
[i
][BCOMP
] = ptr3
[i
].b
;
3769 rgba
[i
][ACOMP
] = 255;
3775 const GLubyte
*ptr1
= PIXELADDR1( source
, x
, y
);
3778 GLubyte p
= *ptr1
++;
3779 rgba
[i
][RCOMP
] = p
& 0xE0;
3780 rgba
[i
][GCOMP
] = (p
& 0x1C) << 3;
3781 rgba
[i
][BCOMP
] = (p
& 0x03) << 6;
3782 rgba
[i
][ACOMP
] = 255;
3790 const GLubyte
*rTable
= source
->pixel_to_r
;
3791 const GLubyte
*gTable
= source
->pixel_to_g
;
3792 const GLubyte
*bTable
= source
->pixel_to_b
;
3793 if (GET_VISUAL_DEPTH(xmesa
->xm_visual
)==8) {
3794 GLubyte
*ptr1
= PIXELADDR1( source
, x
, y
);
3797 unsigned long p
= *ptr1
++;
3798 rgba
[i
][RCOMP
] = rTable
[p
];
3799 rgba
[i
][GCOMP
] = gTable
[p
];
3800 rgba
[i
][BCOMP
] = bTable
[p
];
3801 rgba
[i
][ACOMP
] = 255;
3805 XMesaImage
*img
= source
->backimage
;
3807 y
= FLIP(source
, y
);
3808 for (i
=0;i
<n
;i
++,x
++) {
3809 unsigned long p
= XMesaGetPixel( img
, x
, y
);
3810 rgba
[i
][RCOMP
] = rTable
[p
];
3811 rgba
[i
][GCOMP
] = gTable
[p
];
3812 rgba
[i
][BCOMP
] = bTable
[p
];
3813 rgba
[i
][ACOMP
] = 255;
3820 XMesaImage
*img
= source
->backimage
;
3821 int bitFlip
= xmesa
->xm_visual
->bitFlip
;
3823 y
= FLIP(source
, y
);
3824 for (i
=0;i
<n
;i
++,x
++) {
3826 p
= XMesaGetPixel( img
, x
, y
) ^ bitFlip
;
3827 rgba
[i
][RCOMP
] = (GLubyte
) (p
* 255);
3828 rgba
[i
][GCOMP
] = (GLubyte
) (p
* 255);
3829 rgba
[i
][BCOMP
] = (GLubyte
) (p
* 255);
3830 rgba
[i
][ACOMP
] = 255;
3835 gl_problem(NULL
,"Problem in DD.read_color_span (2)");
3844 * Read an array of color index pixels.
3846 static void read_index_pixels( const GLcontext
*ctx
,
3847 GLuint n
, const GLint x
[], const GLint y
[],
3848 GLuint indx
[], const GLubyte mask
[] )
3850 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3854 if (xmesa
->use_read_buffer
)
3855 source
= xmesa
->xm_read_buffer
;
3857 source
= xmesa
->xm_buffer
;
3859 if (source
->buffer
) {
3862 indx
[i
] = (GLuint
) read_pixel( xmesa
->display
,
3864 x
[i
], FLIP(source
, y
[i
]) );
3868 else if (source
->backimage
) {
3869 XMesaImage
*img
= source
->backimage
;
3872 indx
[i
] = (GLuint
) XMesaGetPixel( img
, x
[i
], FLIP(source
, y
[i
]) );
3880 static void read_color_pixels( const GLcontext
*ctx
,
3881 GLuint n
, const GLint x
[], const GLint y
[],
3882 GLubyte rgba
[][4], const GLubyte mask
[] )
3884 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
3885 XMesaDisplay
*dpy
= xmesa
->xm_visual
->display
;
3888 XMesaDrawable buffer
;
3890 if (xmesa
->use_read_buffer
)
3891 source
= xmesa
->xm_read_buffer
;
3893 source
= xmesa
->xm_buffer
;
3895 buffer
= source
->buffer
; /* the X drawable */
3897 if (source
->buffer
) {
3898 switch (xmesa
->pixelformat
) {
3902 case PF_DITHER_5R6G5B
:
3904 unsigned long rMask
= GET_REDMASK(xmesa
->xm_visual
);
3905 unsigned long gMask
= GET_GREENMASK(xmesa
->xm_visual
);
3906 unsigned long bMask
= GET_BLUEMASK(xmesa
->xm_visual
);
3907 GLubyte
*pixelToR
= xmesa
->xm_visual
->PixelToR
;
3908 GLubyte
*pixelToG
= xmesa
->xm_visual
->PixelToG
;
3909 GLubyte
*pixelToB
= xmesa
->xm_visual
->PixelToB
;
3910 GLint rShift
= xmesa
->xm_visual
->rshift
;
3911 GLint gShift
= xmesa
->xm_visual
->gshift
;
3912 GLint bShift
= xmesa
->xm_visual
->bshift
;
3915 unsigned long p
= read_pixel( dpy
, buffer
,
3916 x
[i
], FLIP(source
, y
[i
]) );
3917 rgba
[i
][RCOMP
] = pixelToR
[(p
& rMask
) >> rShift
];
3918 rgba
[i
][GCOMP
] = pixelToG
[(p
& gMask
) >> gShift
];
3919 rgba
[i
][BCOMP
] = pixelToB
[(p
& bMask
) >> bShift
];
3920 rgba
[i
][ACOMP
] = 255;
3928 unsigned long p
= read_pixel( dpy
, buffer
,
3929 x
[i
], FLIP(source
, y
[i
]) );
3930 rgba
[i
][RCOMP
] = (GLubyte
) ( p
& 0xff);
3931 rgba
[i
][GCOMP
] = (GLubyte
) ((p
>> 8) & 0xff);
3932 rgba
[i
][BCOMP
] = (GLubyte
) ((p
>> 16) & 0xff);
3933 rgba
[i
][ACOMP
] = (GLubyte
) ((p
>> 24) & 0xff);
3940 unsigned long p
= read_pixel( dpy
, buffer
,
3941 x
[i
], FLIP(source
, y
[i
]) );
3942 rgba
[i
][RCOMP
] = (GLubyte
) ((p
>> 16) & 0xff);
3943 rgba
[i
][GCOMP
] = (GLubyte
) ((p
>> 8) & 0xff);
3944 rgba
[i
][BCOMP
] = (GLubyte
) ( p
& 0xff);
3945 rgba
[i
][ACOMP
] = 255;
3952 unsigned long p
= read_pixel( dpy
, buffer
,
3953 x
[i
], FLIP(source
, y
[i
]) );
3954 rgba
[i
][RCOMP
] = (GLubyte
) ((p
>> 16) & 0xff);
3955 rgba
[i
][GCOMP
] = (GLubyte
) ((p
>> 8) & 0xff);
3956 rgba
[i
][BCOMP
] = (GLubyte
) ( p
& 0xff);
3957 rgba
[i
][ACOMP
] = 255;
3965 unsigned long p
= read_pixel( dpy
, buffer
,
3966 x
[i
], FLIP(source
, y
[i
]) );
3967 rgba
[i
][RCOMP
] = (GLubyte
) ( p
& 0xE0 );
3968 rgba
[i
][GCOMP
] = (GLubyte
) ((p
& 0x1C) << 3);
3969 rgba
[i
][BCOMP
] = (GLubyte
) ((p
& 0x03) << 6);
3970 rgba
[i
][ACOMP
] = (GLubyte
) 255;
3979 GLubyte
*rTable
= source
->pixel_to_r
;
3980 GLubyte
*gTable
= source
->pixel_to_g
;
3981 GLubyte
*bTable
= source
->pixel_to_b
;
3984 unsigned long p
= read_pixel( dpy
, buffer
,
3985 x
[i
], FLIP(source
, y
[i
]) );
3986 rgba
[i
][RCOMP
] = rTable
[p
];
3987 rgba
[i
][GCOMP
] = gTable
[p
];
3988 rgba
[i
][BCOMP
] = bTable
[p
];
3989 rgba
[i
][ACOMP
] = 255;
3996 int bitFlip
= xmesa
->xm_visual
->bitFlip
;
3999 unsigned long p
= read_pixel( dpy
, buffer
,
4000 x
[i
], FLIP(source
, y
[i
])) ^ bitFlip
;
4001 rgba
[i
][RCOMP
] = (GLubyte
) (p
* 255);
4002 rgba
[i
][GCOMP
] = (GLubyte
) (p
* 255);
4003 rgba
[i
][BCOMP
] = (GLubyte
) (p
* 255);
4004 rgba
[i
][ACOMP
] = 255;
4010 gl_problem(NULL
,"Problem in DD.read_color_pixels (1)");
4014 else if (source
->backimage
) {
4015 switch (xmesa
->pixelformat
) {
4019 case PF_DITHER_5R6G5B
:
4021 unsigned long rMask
= GET_REDMASK(xmesa
->xm_visual
);
4022 unsigned long gMask
= GET_GREENMASK(xmesa
->xm_visual
);
4023 unsigned long bMask
= GET_BLUEMASK(xmesa
->xm_visual
);
4024 GLubyte
*pixelToR
= xmesa
->xm_visual
->PixelToR
;
4025 GLubyte
*pixelToG
= xmesa
->xm_visual
->PixelToG
;
4026 GLubyte
*pixelToB
= xmesa
->xm_visual
->PixelToB
;
4027 GLint rShift
= xmesa
->xm_visual
->rshift
;
4028 GLint gShift
= xmesa
->xm_visual
->gshift
;
4029 GLint bShift
= xmesa
->xm_visual
->bshift
;
4030 XMesaImage
*img
= source
->backimage
;
4034 p
= XMesaGetPixel( img
, x
[i
], FLIP(source
, y
[i
]) );
4035 rgba
[i
][RCOMP
] = pixelToR
[(p
& rMask
) >> rShift
];
4036 rgba
[i
][GCOMP
] = pixelToG
[(p
& gMask
) >> gShift
];
4037 rgba
[i
][BCOMP
] = pixelToB
[(p
& bMask
) >> bShift
];
4038 rgba
[i
][ACOMP
] = 255;
4046 GLuint
*ptr4
= PIXELADDR4( source
, x
[i
], y
[i
] );
4048 rgba
[i
][RCOMP
] = (GLubyte
) ( p4
& 0xff);
4049 rgba
[i
][GCOMP
] = (GLubyte
) ((p4
>> 8) & 0xff);
4050 rgba
[i
][BCOMP
] = (GLubyte
) ((p4
>> 16) & 0xff);
4051 rgba
[i
][ACOMP
] = (GLubyte
) ((p4
>> 24) & 0xff);
4058 GLuint
*ptr4
= PIXELADDR4( source
, x
[i
], y
[i
] );
4060 rgba
[i
][RCOMP
] = (GLubyte
) ((p4
>> 16) & 0xff);
4061 rgba
[i
][GCOMP
] = (GLubyte
) ((p4
>> 8) & 0xff);
4062 rgba
[i
][BCOMP
] = (GLubyte
) ( p4
& 0xff);
4063 rgba
[i
][ACOMP
] = 255;
4070 bgr_t
*ptr3
= PIXELADDR3( source
, x
[i
], y
[i
] );
4071 rgba
[i
][RCOMP
] = ptr3
->r
;
4072 rgba
[i
][GCOMP
] = ptr3
->g
;
4073 rgba
[i
][BCOMP
] = ptr3
->b
;
4074 rgba
[i
][ACOMP
] = 255;
4081 GLubyte
*ptr1
= PIXELADDR1( source
, x
[i
], y
[i
] );
4083 rgba
[i
][RCOMP
] = p
& 0xE0;
4084 rgba
[i
][GCOMP
] = (p
& 0x1C) << 3;
4085 rgba
[i
][BCOMP
] = (p
& 0x03) << 6;
4086 rgba
[i
][ACOMP
] = 255;
4094 GLubyte
*rTable
= source
->pixel_to_r
;
4095 GLubyte
*gTable
= source
->pixel_to_g
;
4096 GLubyte
*bTable
= source
->pixel_to_b
;
4097 XMesaImage
*img
= source
->backimage
;
4101 p
= XMesaGetPixel( img
, x
[i
], FLIP(source
, y
[i
]) );
4102 rgba
[i
][RCOMP
] = rTable
[p
];
4103 rgba
[i
][GCOMP
] = gTable
[p
];
4104 rgba
[i
][BCOMP
] = bTable
[p
];
4105 rgba
[i
][ACOMP
] = 255;
4112 XMesaImage
*img
= source
->backimage
;
4113 int bitFlip
= xmesa
->xm_visual
->bitFlip
;
4117 p
= XMesaGetPixel( img
, x
[i
], FLIP(source
, y
[i
]) ) ^ bitFlip
;
4118 rgba
[i
][RCOMP
] = (GLubyte
) (p
* 255);
4119 rgba
[i
][GCOMP
] = (GLubyte
) (p
* 255);
4120 rgba
[i
][BCOMP
] = (GLubyte
) (p
* 255);
4121 rgba
[i
][ACOMP
] = 255;
4127 gl_problem(NULL
,"Problem in DD.read_color_pixels (1)");
4135 clear_color_HPCR_ximage( GLcontext
*ctx
,
4136 GLubyte r
, GLubyte g
, GLubyte b
, GLubyte a
)
4139 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
4140 xmesa
->clearcolor
[0] = r
;
4141 xmesa
->clearcolor
[1] = g
;
4142 xmesa
->clearcolor
[2] = b
;
4143 xmesa
->clearcolor
[3] = a
;
4145 if (r
== 0 && g
== 0 && b
== 0) {
4146 /* black is black */
4147 MEMSET( xmesa
->xm_visual
->hpcr_clear_ximage_pattern
, 0x0 ,
4148 sizeof(xmesa
->xm_visual
->hpcr_clear_ximage_pattern
));
4151 /* build clear pattern */
4152 for (i
=0; i
<16; i
++) {
4153 xmesa
->xm_visual
->hpcr_clear_ximage_pattern
[0][i
] =
4154 DITHER_HPCR(i
, 0, r
, g
, b
);
4155 xmesa
->xm_visual
->hpcr_clear_ximage_pattern
[1][i
] =
4156 DITHER_HPCR(i
, 1, r
, g
, b
);
4163 clear_color_HPCR_pixmap( GLcontext
*ctx
,
4164 GLubyte r
, GLubyte g
, GLubyte b
, GLubyte a
)
4167 const XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
4168 xmesa
->clearcolor
[0] = r
;
4169 xmesa
->clearcolor
[1] = g
;
4170 xmesa
->clearcolor
[2] = b
;
4171 xmesa
->clearcolor
[3] = a
;
4174 if (0x0==r
&& 0x0==g
&& 0x0==b
) {
4175 /* black is black */
4176 for (i
=0; i
<16; i
++) {
4177 XMesaPutPixel(xmesa
->xm_visual
->hpcr_clear_ximage
, i
, 0, 0);
4178 XMesaPutPixel(xmesa
->xm_visual
->hpcr_clear_ximage
, i
, 1, 0);
4182 for (i
=0; i
<16; i
++) {
4183 XMesaPutPixel(xmesa
->xm_visual
->hpcr_clear_ximage
, i
, 0, DITHER_HPCR(i
, 0, r
, g
, b
));
4184 XMesaPutPixel(xmesa
->xm_visual
->hpcr_clear_ximage
, i
, 1, DITHER_HPCR(i
, 1, r
, g
, b
));
4187 /* change tile pixmap content */
4188 XMesaPutImage(xmesa
->display
,
4189 (XMesaDrawable
)xmesa
->xm_visual
->hpcr_clear_pixmap
,
4190 xmesa
->xm_buffer
->cleargc
,
4191 xmesa
->xm_visual
->hpcr_clear_ximage
, 0, 0, 0, 0, 16, 2);
4196 void xmesa_update_span_funcs( GLcontext
*ctx
)
4198 XMesaContext xmesa
= (XMesaContext
) ctx
->DriverCtx
;
4199 int depth
=GET_VISUAL_DEPTH(xmesa
->xm_visual
);
4202 * These drawing functions depend on color buffer config:
4204 if (xmesa
->xm_buffer
->buffer
!=XIMAGE
) {
4205 /* Writing to window or back pixmap */
4206 switch (xmesa
->pixelformat
) {
4208 ctx
->Driver
.WriteCI32Span
= write_span_index_pixmap
;
4209 ctx
->Driver
.WriteCI8Span
= write_span_index8_pixmap
;
4210 ctx
->Driver
.WriteMonoCISpan
= write_span_mono_pixmap
;
4211 ctx
->Driver
.WriteCI32Pixels
= write_pixels_index_pixmap
;
4212 ctx
->Driver
.WriteMonoCIPixels
= write_pixels_mono_pixmap
;
4215 ctx
->Driver
.WriteRGBASpan
= write_span_TRUECOLOR_pixmap
;
4216 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_TRUECOLOR_pixmap
;
4217 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4218 ctx
->Driver
.WriteRGBAPixels
= write_pixels_TRUECOLOR_pixmap
;
4219 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4222 ctx
->Driver
.WriteRGBASpan
= write_span_TRUEDITHER_pixmap
;
4223 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_TRUEDITHER_pixmap
;
4224 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_TRUEDITHER_pixmap
;
4225 ctx
->Driver
.WriteRGBAPixels
= write_pixels_TRUEDITHER_pixmap
;
4226 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_TRUEDITHER_pixmap
;
4229 ctx
->Driver
.WriteRGBASpan
= write_span_8A8B8G8R_pixmap
;
4230 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_8A8B8G8R_pixmap
;
4231 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4232 ctx
->Driver
.WriteRGBAPixels
= write_pixels_8A8B8G8R_pixmap
;
4233 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4236 ctx
->Driver
.WriteRGBASpan
= write_span_8R8G8B_pixmap
;
4237 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_8R8G8B_pixmap
;
4238 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4239 ctx
->Driver
.WriteRGBAPixels
= write_pixels_8R8G8B_pixmap
;
4240 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4241 ctx
->Driver
.DrawPixels
= NULL
; /*drawpixels_8R8G8B;*/
4244 ctx
->Driver
.WriteRGBASpan
= write_span_8R8G8B24_pixmap
;
4245 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_8R8G8B24_pixmap
;
4246 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4247 ctx
->Driver
.WriteRGBAPixels
= write_pixels_8R8G8B24_pixmap
;
4248 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4251 ctx
->Driver
.WriteRGBASpan
= write_span_5R6G5B_pixmap
;
4252 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_5R6G5B_pixmap
;
4253 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4254 ctx
->Driver
.WriteRGBAPixels
= write_pixels_5R6G5B_pixmap
;
4255 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4257 case PF_DITHER_5R6G5B
:
4258 ctx
->Driver
.WriteRGBASpan
= write_span_DITHER_5R6G5B_pixmap
;
4259 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_DITHER_5R6G5B_pixmap
;
4260 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_TRUEDITHER_pixmap
;
4261 ctx
->Driver
.WriteRGBAPixels
= write_pixels_DITHER_5R6G5B_pixmap
;
4262 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_TRUEDITHER_pixmap
;
4265 ctx
->Driver
.WriteRGBASpan
= write_span_DITHER_pixmap
;
4266 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_DITHER_pixmap
;
4267 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_DITHER_pixmap
;
4268 ctx
->Driver
.WriteRGBAPixels
= write_pixels_DITHER_pixmap
;
4269 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_DITHER_pixmap
;
4272 ctx
->Driver
.WriteRGBASpan
= write_span_1BIT_pixmap
;
4273 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_1BIT_pixmap
;
4274 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_1BIT_pixmap
;
4275 ctx
->Driver
.WriteRGBAPixels
= write_pixels_1BIT_pixmap
;
4276 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_1BIT_pixmap
;
4279 ctx
->Driver
.WriteRGBASpan
= write_span_HPCR_pixmap
;
4280 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_HPCR_pixmap
;
4281 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4282 ctx
->Driver
.WriteRGBAPixels
= write_pixels_HPCR_pixmap
;
4283 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4284 if (xmesa
->xm_visual
->hpcr_clear_flag
) {
4285 ctx
->Driver
.ClearColor
= clear_color_HPCR_pixmap
;
4289 ctx
->Driver
.WriteRGBASpan
= write_span_LOOKUP_pixmap
;
4290 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_LOOKUP_pixmap
;
4291 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4292 ctx
->Driver
.WriteRGBAPixels
= write_pixels_LOOKUP_pixmap
;
4293 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4296 ctx
->Driver
.WriteRGBASpan
= write_span_GRAYSCALE_pixmap
;
4297 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_GRAYSCALE_pixmap
;
4298 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_pixmap
;
4299 ctx
->Driver
.WriteRGBAPixels
= write_pixels_GRAYSCALE_pixmap
;
4300 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_pixmap
;
4303 gl_problem(NULL
,"Bad pixel format in xmesa_update_state (1)");
4307 else if (xmesa
->xm_buffer
->buffer
==XIMAGE
) {
4308 /* Writing to back XImage */
4309 switch (xmesa
->pixelformat
) {
4311 ctx
->Driver
.WriteCI32Span
= write_span_index_ximage
;
4313 ctx
->Driver
.WriteCI8Span
= write_span_index8_ximage8
;
4315 ctx
->Driver
.WriteCI8Span
= write_span_index8_ximage
;
4316 ctx
->Driver
.WriteMonoCISpan
= write_span_mono_ximage
;
4317 ctx
->Driver
.WriteCI32Pixels
= write_pixels_index_ximage
;
4318 ctx
->Driver
.WriteMonoCIPixels
= write_pixels_mono_ximage
;
4322 ctx
->Driver
.WriteRGBASpan
= write_span_TRUECOLOR_ximage
;
4323 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_TRUECOLOR_ximage
;
4324 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_ximage
;
4325 ctx
->Driver
.WriteRGBAPixels
= write_pixels_TRUECOLOR_ximage
;
4326 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_ximage
;
4329 ctx
->Driver
.WriteRGBASpan
= write_span_TRUEDITHER_ximage
;
4330 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_TRUEDITHER_ximage
;
4331 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_TRUEDITHER_ximage
;
4332 ctx
->Driver
.WriteRGBAPixels
= write_pixels_TRUEDITHER_ximage
;
4333 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_TRUEDITHER_ximage
;
4336 ctx
->Driver
.WriteRGBASpan
= write_span_8A8B8G8R_ximage
;
4337 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_8A8B8G8R_ximage
;
4338 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_8A8B8G8R_ximage
;
4339 ctx
->Driver
.WriteRGBAPixels
= write_pixels_8A8B8G8R_ximage
;
4340 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_8A8B8G8R_ximage
;
4343 ctx
->Driver
.WriteRGBASpan
= write_span_8R8G8B_ximage
;
4344 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_8R8G8B_ximage
;
4345 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_8R8G8B_ximage
;
4346 ctx
->Driver
.WriteRGBAPixels
= write_pixels_8R8G8B_ximage
;
4347 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_8R8G8B_ximage
;
4348 ctx
->Driver
.DrawPixels
= NULL
;
4351 ctx
->Driver
.WriteRGBASpan
= write_span_8R8G8B24_ximage
;
4352 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_8R8G8B24_ximage
;
4353 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_8R8G8B24_ximage
;
4354 ctx
->Driver
.WriteRGBAPixels
= write_pixels_8R8G8B24_ximage
;
4355 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_8R8G8B24_ximage
;
4358 ctx
->Driver
.WriteRGBASpan
= write_span_5R6G5B_ximage
;
4359 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_5R6G5B_ximage
;
4360 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_ximage
;
4361 ctx
->Driver
.WriteRGBAPixels
= write_pixels_5R6G5B_ximage
;
4362 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_ximage
;
4364 case PF_DITHER_5R6G5B
:
4365 ctx
->Driver
.WriteRGBASpan
= write_span_DITHER_5R6G5B_ximage
;
4366 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_DITHER_5R6G5B_ximage
;
4367 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_DITHER_5R6G5B_ximage
;
4368 ctx
->Driver
.WriteRGBAPixels
= write_pixels_DITHER_5R6G5B_ximage
;
4369 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_DITHER_5R6G5B_ximage
;
4373 ctx
->Driver
.WriteRGBASpan
= write_span_DITHER8_ximage
;
4374 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_DITHER8_ximage
;
4375 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_DITHER8_ximage
;
4376 ctx
->Driver
.WriteRGBAPixels
= write_pixels_DITHER8_ximage
;
4377 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_DITHER8_ximage
;
4380 ctx
->Driver
.WriteRGBASpan
= write_span_DITHER_ximage
;
4381 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_DITHER_ximage
;
4382 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_DITHER_ximage
;
4383 ctx
->Driver
.WriteRGBAPixels
= write_pixels_DITHER_ximage
;
4384 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_DITHER_ximage
;
4388 ctx
->Driver
.WriteRGBASpan
= write_span_1BIT_ximage
;
4389 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_1BIT_ximage
;
4390 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_1BIT_ximage
;
4391 ctx
->Driver
.WriteRGBAPixels
= write_pixels_1BIT_ximage
;
4392 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_1BIT_ximage
;
4395 ctx
->Driver
.WriteRGBASpan
= write_span_HPCR_ximage
;
4396 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_HPCR_ximage
;
4397 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_HPCR_ximage
;
4398 ctx
->Driver
.WriteRGBAPixels
= write_pixels_HPCR_ximage
;
4399 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_HPCR_ximage
;
4400 if (xmesa
->xm_visual
->hpcr_clear_flag
) {
4401 ctx
->Driver
.ClearColor
= clear_color_HPCR_ximage
;
4406 ctx
->Driver
.WriteRGBASpan
= write_span_LOOKUP8_ximage
;
4407 ctx
->Driver
.WriteRGBSpan
= write_rgb_LOOKUP8_ximage
;
4408 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_LOOKUP8_ximage
;
4409 ctx
->Driver
.WriteRGBAPixels
= write_pixels_LOOKUP8_ximage
;
4410 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_LOOKUP8_ximage
;
4413 ctx
->Driver
.WriteRGBASpan
= write_span_LOOKUP_ximage
;
4414 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_LOOKUP_ximage
;
4415 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_ximage
;
4416 ctx
->Driver
.WriteRGBAPixels
= write_pixels_LOOKUP_ximage
;
4417 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_ximage
;
4422 ctx
->Driver
.WriteRGBASpan
= write_span_GRAYSCALE8_ximage
;
4423 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_GRAYSCALE8_ximage
;
4424 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_GRAYSCALE8_ximage
;
4425 ctx
->Driver
.WriteRGBAPixels
= write_pixels_GRAYSCALE8_ximage
;
4426 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_GRAYSCALE8_ximage
;
4429 ctx
->Driver
.WriteRGBASpan
= write_span_GRAYSCALE_ximage
;
4430 ctx
->Driver
.WriteRGBSpan
= write_span_rgb_GRAYSCALE_ximage
;
4431 ctx
->Driver
.WriteMonoRGBASpan
= write_span_mono_ximage
;
4432 ctx
->Driver
.WriteRGBAPixels
= write_pixels_GRAYSCALE_ximage
;
4433 ctx
->Driver
.WriteMonoRGBAPixels
= write_pixels_mono_ximage
;
4437 gl_problem(NULL
,"Bad pixel format in xmesa_update_state (2)");
4442 /* Pixel/span reading functions: */
4443 ctx
->Driver
.ReadCI32Span
= read_index_span
;
4444 ctx
->Driver
.ReadRGBASpan
= read_color_span
;
4445 ctx
->Driver
.ReadCI32Pixels
= read_index_pixels
;
4446 ctx
->Driver
.ReadRGBAPixels
= read_color_pixels
;