diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 2107 | ||||
-rw-r--r-- | src/mesa/swrast/s_spantemp.h | 321 |
2 files changed, 908 insertions, 1520 deletions
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 88dbb0d0b3..b56ced6b5a 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -148,7 +148,7 @@ static unsigned long read_pixel( XMesaDisplay *dpy, * * The function naming convention is: * - * write_[span|pixels]_[mono]_[format]_[pixmap|ximage] + * [put|get]_[mono]_[row|values]_[format]_[pixmap|ximage] * * New functions optimized for specific cases can be added without too much * trouble. An example might be the 24-bit TrueColor mode 8A8R8G8B which is @@ -163,15 +163,17 @@ static unsigned long read_pixel( XMesaDisplay *dpy, /**********************************************************************/ -#define RGBA_SPAN_ARGS const GLcontext *ctx, \ - struct gl_renderbuffer *rb, \ - GLuint n, GLint x, GLint y, \ - CONST GLubyte rgba[][4], const GLubyte mask[] +#define PUT_ROW_ARGS \ + GLcontext *ctx, \ + struct gl_renderbuffer *rb, \ + GLuint n, GLint x, GLint y, \ + const void *values, const GLubyte mask[] -#define RGB_SPAN_ARGS const GLcontext *ctx, \ - struct gl_renderbuffer *rb, \ - GLuint n, GLint x, GLint y, \ - CONST GLubyte rgb[][3], const GLubyte mask[] +#define RGB_SPAN_ARGS \ + GLcontext *ctx, \ + struct gl_renderbuffer *rb, \ + GLuint n, GLint x, GLint y, \ + const void *values, const GLubyte mask[] /* NOTE: if mask==NULL, draw all pixels */ @@ -180,13 +182,14 @@ static unsigned long read_pixel( XMesaDisplay *dpy, /* * Write a span of PF_TRUECOLOR pixels to a pixmap. */ -static void write_span_TRUECOLOR_pixmap( RGBA_SPAN_ARGS ) +static void put_row_TRUECOLOR_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDisplay *dpy = XMESA_BUFFER(ctx->DrawBuffer)->display; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); @@ -202,7 +205,7 @@ static void write_span_TRUECOLOR_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { unsigned long p; PACK_TRUECOLOR( p, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); @@ -216,13 +219,14 @@ static void write_span_TRUECOLOR_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_TRUECOLOR pixels to a pixmap. */ -static void write_span_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -237,7 +241,7 @@ static void write_span_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { unsigned long p; PACK_TRUECOLOR( p, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); @@ -247,17 +251,17 @@ static void write_span_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS ) } } - /* * Write a span of PF_TRUEDITHER pixels to a pixmap. */ -static void write_span_TRUEDITHER_pixmap( RGBA_SPAN_ARGS ) +static void put_row_TRUEDITHER_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -271,7 +275,7 @@ static void write_span_TRUEDITHER_pixmap( RGBA_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { unsigned long p; PACK_TRUEDITHER(p, x+i, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); @@ -285,13 +289,14 @@ static void write_span_TRUEDITHER_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_TRUEDITHER pixels to a pixmap (no alpha). */ -static void write_span_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -305,7 +310,7 @@ static void write_span_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { unsigned long p; PACK_TRUEDITHER(p, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); @@ -316,17 +321,17 @@ static void write_span_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS ) } - /* * Write a span of PF_8A8B8G8R pixels to a pixmap. */ -static void write_span_8A8B8G8R_pixmap( RGBA_SPAN_ARGS ) +static void put_row_8A8B8G8R_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -340,7 +345,7 @@ static void write_span_8A8B8G8R_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;i<n;i++) { *ptr4++ = PACK_8A8B8G8R( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); @@ -353,13 +358,14 @@ static void write_span_8A8B8G8R_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_8A8B8G8R pixels to a pixmap (no alpha). */ -static void write_span_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -373,7 +379,7 @@ static void write_span_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;i<n;i++) { *ptr4++ = PACK_8B8G8R(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); @@ -385,13 +391,14 @@ static void write_span_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS ) /* * Write a span of PF_8A8R8G8B pixels to a pixmap. */ -static void write_span_8A8R8G8B_pixmap( RGBA_SPAN_ARGS ) +static void put_row_8A8R8G8B_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -405,7 +412,7 @@ static void write_span_8A8R8G8B_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;i<n;i++) { *ptr4++ = PACK_8A8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], rgba[i][ACOMP] ); @@ -418,13 +425,14 @@ static void write_span_8A8R8G8B_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_8A8R8G8B pixels to a pixmap (no alpha). */ -static void write_span_rgb_8A8R8G8B_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_8A8R8G8B_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -438,7 +446,7 @@ static void write_span_rgb_8A8R8G8B_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;i<n;i++) { *ptr4++ = PACK_8R8G8B(rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]); @@ -447,17 +455,17 @@ static void write_span_rgb_8A8R8G8B_pixmap( RGB_SPAN_ARGS ) } } - /* * Write a span of PF_8R8G8B pixels to a pixmap. */ -static void write_span_8R8G8B_pixmap( RGBA_SPAN_ARGS ) +static void put_row_8R8G8B_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -470,7 +478,7 @@ static void write_span_8R8G8B_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;i<n;i++) { *ptr4++ = PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); @@ -483,13 +491,14 @@ static void write_span_8R8G8B_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_8R8G8B24 pixels to a pixmap. */ -static void write_span_8R8G8B24_pixmap( RGBA_SPAN_ARGS ) +static void put_row_8R8G8B24_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; y = YFLIP(xrb, y); if (mask) { register GLuint i; @@ -503,7 +512,7 @@ static void write_span_8R8G8B24_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; register GLuint pixel; static const GLuint shift[4] = {0, 8, 16, 24}; @@ -578,13 +587,14 @@ static void write_span_8R8G8B24_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_8R8G8B pixels to a pixmap (no alpha). */ -static void write_span_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -597,7 +607,7 @@ static void write_span_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; for (i=0;i<n;i++) { *ptr4++ = PACK_8R8G8B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); @@ -606,17 +616,17 @@ static void write_span_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) } } - /* * Write a span of PF_8R8G8B24 pixels to a pixmap (no alpha). */ -static void write_span_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; y = YFLIP(xrb, y); if (mask) { register GLuint i; @@ -630,7 +640,7 @@ static void write_span_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLuint *ptr4 = (GLuint *) rowimg->data; register GLuint pixel; static const GLuint shift[4] = {0, 8, 16, 24}; @@ -710,13 +720,14 @@ static void write_span_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS ) /* * Write a span of PF_5R6G5B pixels to a pixmap. */ -static void write_span_5R6G5B_pixmap( RGBA_SPAN_ARGS ) +static void put_row_5R6G5B_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -729,7 +740,7 @@ static void write_span_5R6G5B_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;i<n;i++) { ptr2[i] = PACK_5R6G5B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); @@ -742,13 +753,14 @@ static void write_span_5R6G5B_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_DITHER_5R6G5B pixels to a pixmap. */ -static void write_span_DITHER_5R6G5B_pixmap( RGBA_SPAN_ARGS ) +static void put_row_DITHER_5R6G5B_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -763,7 +775,7 @@ static void write_span_DITHER_5R6G5B_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;i<n;i++) { PACK_TRUEDITHER( ptr2[i], x+i, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); @@ -776,13 +788,14 @@ static void write_span_DITHER_5R6G5B_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_5R6G5B pixels to a pixmap (no alpha). */ -static void write_span_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -795,7 +808,7 @@ static void write_span_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;i<n;i++) { ptr2[i] = PACK_5R6G5B( rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); @@ -808,13 +821,14 @@ static void write_span_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS ) /* * Write a span of PF_DITHER_5R6G5B pixels to a pixmap (no alpha). */ -static void write_span_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -829,7 +843,7 @@ static void write_span_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; register GLushort *ptr2 = (GLushort *) rowimg->data; for (i=0;i<n;i++) { PACK_TRUEDITHER( ptr2[i], x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); @@ -839,17 +853,17 @@ static void write_span_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) } - /* * Write a span of PF_DITHER pixels to a pixmap. */ -static void write_span_DITHER_pixmap( RGBA_SPAN_ARGS ) +static void put_row_DITHER_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); y = YFLIP(xrb, y); @@ -863,7 +877,7 @@ static void write_span_DITHER_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, XDITHER(x+i, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]) ); } @@ -875,13 +889,14 @@ static void write_span_DITHER_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_DITHER pixels to a pixmap (no alpha). */ -static void write_span_rgb_DITHER_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_DITHER_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XDITHER_SETUP(y); y = YFLIP(xrb, y); @@ -895,7 +910,7 @@ static void write_span_rgb_DITHER_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, XDITHER(x+i, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); } @@ -907,13 +922,14 @@ static void write_span_rgb_DITHER_pixmap( RGB_SPAN_ARGS ) /* * Write a span of PF_1BIT pixels to a pixmap. */ -static void write_span_1BIT_pixmap( RGBA_SPAN_ARGS ) +static void put_row_1BIT_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); @@ -928,7 +944,7 @@ static void write_span_1BIT_pixmap( RGBA_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, DITHER_1BIT( x+i, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) ); @@ -941,13 +957,14 @@ static void write_span_1BIT_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_1BIT pixels to a pixmap (no alpha). */ -static void write_span_rgb_1BIT_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_1BIT_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); @@ -962,7 +979,7 @@ static void write_span_rgb_1BIT_pixmap( RGB_SPAN_ARGS ) } else { /* draw all pixels */ - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, DITHER_1BIT(x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) ); @@ -975,13 +992,14 @@ static void write_span_rgb_1BIT_pixmap( RGB_SPAN_ARGS ) /* * Write a span of PF_HPCR pixels to a pixmap. */ -static void write_span_HPCR_pixmap( RGBA_SPAN_ARGS ) +static void put_row_HPCR_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -994,8 +1012,8 @@ static void write_span_HPCR_pixmap( RGBA_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; - register GLubyte *ptr = (GLubyte *) xmesa->xm_buffer->rowimage->data; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; + register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; for (i=0;i<n;i++) { ptr[i] = DITHER_HPCR( (x+i), y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ); } @@ -1007,13 +1025,14 @@ static void write_span_HPCR_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_HPCR pixels to a pixmap (no alpha). */ -static void write_span_rgb_HPCR_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_HPCR_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1026,8 +1045,8 @@ static void write_span_rgb_HPCR_pixmap( RGB_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; - register GLubyte *ptr = (GLubyte *) xmesa->xm_buffer->rowimage->data; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; + register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; for (i=0;i<n;i++) { ptr[i] = DITHER_HPCR( (x+i), y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] ); } @@ -1035,17 +1054,17 @@ static void write_span_rgb_HPCR_pixmap( RGB_SPAN_ARGS ) } } - /* * Write a span of PF_LOOKUP pixels to a pixmap. */ -static void write_span_LOOKUP_pixmap( RGBA_SPAN_ARGS ) +static void put_row_LOOKUP_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); @@ -1058,7 +1077,7 @@ static void write_span_LOOKUP_pixmap( RGBA_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, LOOKUP(rgba[i][RCOMP],rgba[i][GCOMP],rgba[i][BCOMP]) ); } @@ -1070,13 +1089,14 @@ static void write_span_LOOKUP_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_LOOKUP pixels to a pixmap (no alpha). */ -static void write_span_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); @@ -1089,7 +1109,7 @@ static void write_span_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, LOOKUP(rgb[i][RCOMP],rgb[i][GCOMP],rgb[i][BCOMP]) ); } @@ -1098,17 +1118,17 @@ static void write_span_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ) } - /* * Write a span of PF_GRAYSCALE pixels to a pixmap. */ -static void write_span_GRAYSCALE_pixmap( RGBA_SPAN_ARGS ) +static void put_row_GRAYSCALE_pixmap( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1120,7 +1140,7 @@ static void write_span_GRAYSCALE_pixmap( RGBA_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, GRAY_RGB(rgba[i][RCOMP],rgba[i][GCOMP],rgba[i][BCOMP]) ); } @@ -1132,13 +1152,14 @@ static void write_span_GRAYSCALE_pixmap( RGBA_SPAN_ARGS ) /* * Write a span of PF_GRAYSCALE pixels to a pixmap (no alpha). */ -static void write_span_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ) +static void put_row_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1150,7 +1171,7 @@ static void write_span_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ) } } else { - XMesaImage *rowimg = xmesa->xm_buffer->rowimage; + XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage; for (i=0;i<n;i++) { XMesaPutPixel( rowimg, i, 0, GRAY_RGB(rgb[i][RCOMP],rgb[i][GCOMP],rgb[i][BCOMP]) ); } @@ -1158,15 +1179,15 @@ static void write_span_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ) } } - /* * Write a span of PF_TRUECOLOR pixels to an XImage. */ -static void write_span_TRUECOLOR_ximage( RGBA_SPAN_ARGS ) +static void put_row_TRUECOLOR_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1192,11 +1213,12 @@ static void write_span_TRUECOLOR_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_TRUECOLOR pixels to an XImage (no alpha). */ -static void write_span_rgb_TRUECOLOR_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_TRUECOLOR_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1222,11 +1244,12 @@ static void write_span_rgb_TRUECOLOR_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_TRUEDITHER pixels to an XImage. */ -static void write_span_TRUEDITHER_ximage( RGBA_SPAN_ARGS ) +static void put_row_TRUEDITHER_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1252,11 +1275,12 @@ static void write_span_TRUEDITHER_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_TRUEDITHER pixels to an XImage (no alpha). */ -static void write_span_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -1282,8 +1306,9 @@ static void write_span_rgb_TRUEDITHER_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_8A8B8G8R-format pixels to an ximage. */ -static void write_span_8A8B8G8R_ximage( RGBA_SPAN_ARGS ) +static void put_row_8A8B8G8R_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); @@ -1306,8 +1331,9 @@ static void write_span_8A8B8G8R_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_8A8B8G8R-format pixels to an ximage (no alpha). */ -static void write_span_rgb_8A8B8G8R_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_8A8B8G8R_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); @@ -1329,8 +1355,9 @@ static void write_span_rgb_8A8B8G8R_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_8A8R8G8B-format pixels to an ximage. */ -static void write_span_8A8R8G8B_ximage( RGBA_SPAN_ARGS ) +static void put_row_8A8R8G8B_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); @@ -1353,8 +1380,9 @@ static void write_span_8A8R8G8B_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_8A8R8G8B-format pixels to an ximage (no alpha). */ -static void write_span_rgb_8A8R8G8B_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_8A8R8G8B_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); @@ -1377,8 +1405,9 @@ static void write_span_rgb_8A8R8G8B_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_8R8G8B-format pixels to an ximage. */ -static void write_span_8R8G8B_ximage( RGBA_SPAN_ARGS ) +static void put_row_8R8G8B_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); @@ -1400,8 +1429,9 @@ static void write_span_8R8G8B_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_8R8G8B24-format pixels to an ximage. */ -static void write_span_8R8G8B24_ximage( RGBA_SPAN_ARGS ) +static void put_row_8R8G8B24_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLubyte *ptr = (GLubyte *) PIXEL_ADDR3(xrb, x, y ); @@ -1550,8 +1580,9 @@ static void write_span_8R8G8B24_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_8R8G8B-format pixels to an ximage (no alpha). */ -static void write_span_rgb_8R8G8B_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_8R8G8B_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); @@ -1574,8 +1605,9 @@ static void write_span_rgb_8R8G8B_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_8R8G8B24-format pixels to an ximage (no alpha). */ -static void write_span_rgb_8R8G8B24_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_8R8G8B24_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLubyte *ptr = (GLubyte *) PIXEL_ADDR3(xrb, x, y); @@ -1605,8 +1637,9 @@ static void write_span_rgb_8R8G8B24_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_5R6G5B-format pixels to an ximage. */ -static void write_span_5R6G5B_ximage( RGBA_SPAN_ARGS ) +static void put_row_5R6G5B_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLushort *ptr = PIXEL_ADDR2(xrb, x, y); @@ -1644,14 +1677,14 @@ static void write_span_5R6G5B_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_DITHER_5R6G5B-format pixels to an ximage. */ -static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS ) +static void put_row_DITHER_5R6G5B_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLushort *ptr = PIXEL_ADDR2(xrb, x, y); const GLint y2 = YFLIP(xrb, y); - ASSERT(xrb->ximage); if (mask) { for (i=0;i<n;i++,x++) { if (mask[i]) { @@ -1686,8 +1719,9 @@ static void write_span_DITHER_5R6G5B_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_5R6G5B-format pixels to an ximage (no alpha). */ -static void write_span_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLushort *ptr = PIXEL_ADDR2(xrb, x, y); @@ -1725,8 +1759,9 @@ static void write_span_rgb_5R6G5B_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_DITHER_5R6G5B-format pixels to an ximage (no alpha). */ -static void write_span_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; @@ -1765,11 +1800,11 @@ static void write_span_rgb_DITHER_5R6G5B_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_DITHER pixels to an XImage. */ -static void write_span_DITHER_ximage( RGBA_SPAN_ARGS ) +static void put_row_DITHER_ximage( PUT_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; int yy = YFLIP(xrb, y); XDITHER_SETUP(yy); @@ -1792,11 +1827,11 @@ static void write_span_DITHER_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_DITHER pixels to an XImage (no alpha). */ -static void write_span_rgb_DITHER_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_DITHER_ximage( RGB_SPAN_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; int yy = YFLIP(xrb, y); XDITHER_SETUP(yy); @@ -1820,9 +1855,9 @@ static void write_span_rgb_DITHER_ximage( RGB_SPAN_ARGS ) /* * Write a span of 8-bit PF_DITHER pixels to an XImage. */ -static void write_span_DITHER8_ximage( RGBA_SPAN_ARGS ) +static void put_row_DITHER8_ximage( PUT_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); @@ -1842,9 +1877,9 @@ static void write_span_DITHER8_ximage( RGBA_SPAN_ARGS ) } -static void write_span_rgb_DITHER8_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_DITHER8_ximage( RGB_SPAN_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); @@ -1870,11 +1905,12 @@ static void write_span_rgb_DITHER8_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_1BIT pixels to an XImage. */ -static void write_span_1BIT_ximage( RGBA_SPAN_ARGS ) +static void put_row_1BIT_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); @@ -1896,11 +1932,12 @@ static void write_span_1BIT_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_1BIT pixels to an XImage (no alpha). */ -static void write_span_rgb_1BIT_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_1BIT_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); @@ -1922,8 +1959,9 @@ static void write_span_rgb_1BIT_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_HPCR pixels to an XImage. */ -static void write_span_HPCR_ximage( RGBA_SPAN_ARGS ) +static void put_row_HPCR_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; @@ -1947,8 +1985,9 @@ static void write_span_HPCR_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_HPCR pixels to an XImage (no alpha). */ -static void write_span_rgb_HPCR_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_HPCR_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; @@ -1972,11 +2011,11 @@ static void write_span_rgb_HPCR_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_LOOKUP pixels to an XImage. */ -static void write_span_LOOKUP_ximage( RGBA_SPAN_ARGS ) +static void put_row_LOOKUP_ximage( PUT_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); @@ -1999,11 +2038,11 @@ static void write_span_LOOKUP_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_LOOKUP pixels to an XImage (no alpha). */ -static void write_span_rgb_LOOKUP_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_LOOKUP_ximage( RGB_SPAN_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; LOOKUP_SETUP; y = YFLIP(xrb, y); @@ -2026,10 +2065,10 @@ static void write_span_rgb_LOOKUP_ximage( RGB_SPAN_ARGS ) /* * Write a span of 8-bit PF_LOOKUP pixels to an XImage. */ -static void write_span_LOOKUP8_ximage( RGBA_SPAN_ARGS ) +static void put_row_LOOKUP8_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); LOOKUP_SETUP; @@ -2049,10 +2088,10 @@ static void write_span_LOOKUP8_ximage( RGBA_SPAN_ARGS ) } -static void write_rgb_LOOKUP8_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_LOOKUP8_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); LOOKUP_SETUP; @@ -2077,11 +2116,11 @@ static void write_rgb_LOOKUP8_ximage( RGB_SPAN_ARGS ) /* * Write a span of PF_GRAYSCALE pixels to an XImage. */ -static void write_span_GRAYSCALE_ximage( RGBA_SPAN_ARGS ) +static void put_row_GRAYSCALE_ximage( PUT_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -2103,11 +2142,11 @@ static void write_span_GRAYSCALE_ximage( RGBA_SPAN_ARGS ) /* * Write a span of PF_GRAYSCALE pixels to an XImage (no alpha). */ -static void write_span_rgb_GRAYSCALE_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_GRAYSCALE_ximage( RGB_SPAN_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -2129,10 +2168,10 @@ static void write_span_rgb_GRAYSCALE_ximage( RGB_SPAN_ARGS ) /* * Write a span of 8-bit PF_GRAYSCALE pixels to an XImage. */ -static void write_span_GRAYSCALE8_ximage( RGBA_SPAN_ARGS ) +static void put_row_GRAYSCALE8_ximage( PUT_ROW_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); if (mask) { @@ -2154,10 +2193,10 @@ static void write_span_GRAYSCALE8_ximage( RGBA_SPAN_ARGS ) /* * Write a span of 8-bit PF_GRAYSCALE pixels to an XImage (no alpha). */ -static void write_span_rgb_GRAYSCALE8_ximage( RGB_SPAN_ARGS ) +static void put_row_rgb_GRAYSCALE8_ximage( RGB_SPAN_ARGS ) { + const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); if (mask) { @@ -2183,22 +2222,23 @@ static void write_span_rgb_GRAYSCALE8_ximage( RGB_SPAN_ARGS ) /**********************************************************************/ -#define RGBA_PIXEL_ARGS const GLcontext *ctx, \ - struct gl_renderbuffer *rb, \ - GLuint n, const GLint x[], const GLint y[], \ - CONST GLubyte rgba[][4], const GLubyte mask[] +#define PUT_VALUES_ARGS \ + GLcontext *ctx, struct gl_renderbuffer *rb, \ + GLuint n, const GLint x[], const GLint y[], \ + const void *values, const GLubyte mask[] /* * Write an array of PF_TRUECOLOR pixels to a pixmap. */ -static void write_pixels_TRUECOLOR_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_TRUECOLOR_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2214,13 +2254,14 @@ static void write_pixels_TRUECOLOR_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_TRUEDITHER pixels to a pixmap. */ -static void write_pixels_TRUEDITHER_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_TRUEDITHER_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2236,13 +2277,14 @@ static void write_pixels_TRUEDITHER_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8A8B8G8R pixels to a pixmap. */ -static void write_pixels_8A8B8G8R_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_8A8B8G8R_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2256,13 +2298,14 @@ static void write_pixels_8A8B8G8R_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8A8R8G8B pixels to a pixmap. */ -static void write_pixels_8A8R8G8B_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_8A8R8G8B_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2276,13 +2319,14 @@ static void write_pixels_8A8R8G8B_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8R8G8B pixels to a pixmap. */ -static void write_pixels_8R8G8B_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_8R8G8B_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2296,13 +2340,14 @@ static void write_pixels_8R8G8B_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8R8G8B24 pixels to a pixmap. */ -static void write_pixels_8R8G8B24_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_8R8G8B24_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2316,13 +2361,14 @@ static void write_pixels_8R8G8B24_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_5R6G5B pixels to a pixmap. */ -static void write_pixels_5R6G5B_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_5R6G5B_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2336,13 +2382,14 @@ static void write_pixels_5R6G5B_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_DITHER_5R6G5B pixels to a pixmap. */ -static void write_pixels_DITHER_5R6G5B_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_DITHER_5R6G5B_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2358,13 +2405,14 @@ static void write_pixels_DITHER_5R6G5B_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_DITHER pixels to a pixmap. */ -static void write_pixels_DITHER_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_DITHER_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; DITHER_SETUP; for (i=0;i<n;i++) { @@ -2380,13 +2428,14 @@ static void write_pixels_DITHER_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_1BIT pixels to a pixmap. */ -static void write_pixels_1BIT_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_1BIT_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; SETUP_1BIT; for (i=0;i<n;i++) { @@ -2402,13 +2451,14 @@ static void write_pixels_1BIT_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_HPCR pixels to a pixmap. */ -static void write_pixels_HPCR_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_HPCR_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2423,13 +2473,14 @@ static void write_pixels_HPCR_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_LOOKUP pixels to a pixmap. */ -static void write_pixels_LOOKUP_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_LOOKUP_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; LOOKUP_SETUP; for (i=0;i<n;i++) { @@ -2444,13 +2495,14 @@ static void write_pixels_LOOKUP_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_GRAYSCALE pixels to a pixmap. */ -static void write_pixels_GRAYSCALE_pixmap( RGBA_PIXEL_ARGS ) +static void put_values_GRAYSCALE_pixmap( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2464,11 +2516,12 @@ static void write_pixels_GRAYSCALE_pixmap( RGBA_PIXEL_ARGS ) /* * Write an array of PF_TRUECOLOR pixels to an ximage. */ -static void write_pixels_TRUECOLOR_ximage( RGBA_PIXEL_ARGS ) +static void put_values_TRUECOLOR_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2483,11 +2536,12 @@ static void write_pixels_TRUECOLOR_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_TRUEDITHER pixels to an XImage. */ -static void write_pixels_TRUEDITHER_ximage( RGBA_PIXEL_ARGS ) +static void put_values_TRUEDITHER_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2502,8 +2556,9 @@ static void write_pixels_TRUEDITHER_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8A8B8G8R pixels to an ximage. */ -static void write_pixels_8A8B8G8R_ximage( RGBA_PIXEL_ARGS ) +static void put_values_8A8B8G8R_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; for (i=0;i<n;i++) { @@ -2517,8 +2572,9 @@ static void write_pixels_8A8B8G8R_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8A8R8G8B pixels to an ximage. */ -static void write_pixels_8A8R8G8B_ximage( RGBA_PIXEL_ARGS ) +static void put_values_8A8R8G8B_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; for (i=0;i<n;i++) { @@ -2533,8 +2589,9 @@ static void write_pixels_8A8R8G8B_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8R8G8B pixels to an ximage. */ -static void write_pixels_8R8G8B_ximage( RGBA_PIXEL_ARGS ) +static void put_values_8R8G8B_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; for (i=0;i<n;i++) { @@ -2549,8 +2606,9 @@ static void write_pixels_8R8G8B_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_8R8G8B24 pixels to an ximage. */ -static void write_pixels_8R8G8B24_ximage( RGBA_PIXEL_ARGS ) +static void put_values_8R8G8B24_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; for (i=0;i<n;i++) { @@ -2567,8 +2625,9 @@ static void write_pixels_8R8G8B24_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_5R6G5B pixels to an ximage. */ -static void write_pixels_5R6G5B_ximage( RGBA_PIXEL_ARGS ) +static void put_values_5R6G5B_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; for (i=0;i<n;i++) { @@ -2583,8 +2642,9 @@ static void write_pixels_5R6G5B_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_DITHER_5R6G5B pixels to an ximage. */ -static void write_pixels_DITHER_5R6G5B_ximage( RGBA_PIXEL_ARGS ) +static void put_values_DITHER_5R6G5B_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; @@ -2600,11 +2660,11 @@ static void write_pixels_DITHER_5R6G5B_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_DITHER pixels to an XImage. */ -static void write_pixels_DITHER_ximage( RGBA_PIXEL_ARGS ) +static void put_values_DITHER_ximage( PUT_VALUES_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; DITHER_SETUP; for (i=0;i<n;i++) { @@ -2619,10 +2679,10 @@ static void write_pixels_DITHER_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of 8-bit PF_DITHER pixels to an XImage. */ -static void write_pixels_DITHER8_ximage( RGBA_PIXEL_ARGS ) +static void put_values_DITHER8_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; DITHER_SETUP; for (i=0;i<n;i++) { @@ -2637,11 +2697,12 @@ static void write_pixels_DITHER8_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_1BIT pixels to an XImage. */ -static void write_pixels_1BIT_ximage( RGBA_PIXEL_ARGS ) +static void put_values_1BIT_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; for (i=0;i<n;i++) { @@ -2656,8 +2717,9 @@ static void write_pixels_1BIT_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_HPCR pixels to an XImage. */ -static void write_pixels_HPCR_ximage( RGBA_PIXEL_ARGS ) +static void put_values_HPCR_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; @@ -2673,11 +2735,11 @@ static void write_pixels_HPCR_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_LOOKUP pixels to an XImage. */ -static void write_pixels_LOOKUP_ximage( RGBA_PIXEL_ARGS ) +static void put_values_LOOKUP_ximage( PUT_VALUES_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; LOOKUP_SETUP; for (i=0;i<n;i++) { @@ -2691,10 +2753,10 @@ static void write_pixels_LOOKUP_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of 8-bit PF_LOOKUP pixels to an XImage. */ -static void write_pixels_LOOKUP8_ximage( RGBA_PIXEL_ARGS ) +static void put_values_LOOKUP8_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; LOOKUP_SETUP; for (i=0;i<n;i++) { @@ -2709,11 +2771,11 @@ static void write_pixels_LOOKUP8_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of PF_GRAYSCALE pixels to an XImage. */ -static void write_pixels_GRAYSCALE_ximage( RGBA_PIXEL_ARGS ) +static void put_values_GRAYSCALE_ximage( PUT_VALUES_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2727,10 +2789,10 @@ static void write_pixels_GRAYSCALE_ximage( RGBA_PIXEL_ARGS ) /* * Write an array of 8-bit PF_GRAYSCALE pixels to an XImage. */ -static void write_pixels_GRAYSCALE8_ximage( RGBA_PIXEL_ARGS ) +static void put_values_GRAYSCALE8_ximage( PUT_VALUES_ARGS ) { + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2747,23 +2809,25 @@ static void write_pixels_GRAYSCALE8_ximage( RGBA_PIXEL_ARGS ) /*** Write MONO COLOR SPAN functions ***/ /**********************************************************************/ -#define MONO_SPAN_ARGS const GLcontext *ctx, \ - struct gl_renderbuffer *rb, \ - GLuint n, GLint x, GLint y, const GLchan color[4], \ - const GLubyte mask[] +#define PUT_MONO_ROW_ARGS \ + GLcontext *ctx, struct gl_renderbuffer *rb, \ + GLuint n, GLint x, GLint y, const void *value, \ + const GLubyte mask[] + /* * Write a span of identical pixels to a pixmap. */ -static void write_span_mono_pixmap( MONO_SPAN_ARGS ) +static void put_mono_row_pixmap( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; + XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; - const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); register GLuint i; XMesaSetForeground( xmesa->display, gc, pixel ); @@ -2795,15 +2859,14 @@ static void write_span_mono_pixmap( MONO_SPAN_ARGS ) static void -write_span_mono_index_pixmap( const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, GLuint colorIndex, - const GLubyte mask[] ) +put_mono_row_ci_pixmap( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + GLuint colorIndex = *((GLuint *) value); + XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); y = YFLIP(xrb, y); @@ -2813,7 +2876,7 @@ write_span_mono_index_pixmap( const GLcontext *ctx, struct gl_renderbuffer *rb, /* Identify and emit contiguous rendered pixels */ - while (i < n && mask[i]) + while (i < n && (!mask || mask[i])) i++; if (start < i) @@ -2833,18 +2896,19 @@ write_span_mono_index_pixmap( const GLcontext *ctx, struct gl_renderbuffer *rb, /* * Write a span of PF_TRUEDITHER pixels to a pixmap. */ -static void write_span_mono_TRUEDITHER_pixmap( MONO_SPAN_ARGS ) +static void put_mono_row_TRUEDITHER_pixmap( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; + XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; int yy = YFLIP(xrb, y); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { unsigned long p; PACK_TRUEDITHER(p, x, yy, r, g, b); XMesaSetForeground( dpy, gc, p ); @@ -2857,19 +2921,20 @@ static void write_span_mono_TRUEDITHER_pixmap( MONO_SPAN_ARGS ) /* * Write a span of PF_DITHER pixels to a pixmap. */ -static void write_span_mono_DITHER_pixmap( MONO_SPAN_ARGS ) +static void put_mono_row_DITHER_pixmap( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; + XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; int yy = YFLIP(xrb, y); XDITHER_SETUP(yy); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { XMesaSetForeground( dpy, gc, XDITHER( x, r, g, b ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) yy ); } @@ -2880,19 +2945,20 @@ static void write_span_mono_DITHER_pixmap( MONO_SPAN_ARGS ) /* * Write a span of PF_1BIT pixels to a pixmap. */ -static void write_span_mono_1BIT_pixmap( MONO_SPAN_ARGS ) +static void put_mono_row_1BIT_pixmap( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; + XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { XMesaSetForeground( dpy, gc, DITHER_1BIT( x, y, r, g, b ) ); XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); } @@ -2903,17 +2969,18 @@ static void write_span_mono_1BIT_pixmap( MONO_SPAN_ARGS ) /* * Write a span of identical pixels to an XImage. */ -static void write_span_mono_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_ximage( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaImage *img = xrb->ximage; register GLuint i; - const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); y = YFLIP(xrb, y); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { XMesaPutPixel( img, x, y, pixel ); } } @@ -2921,17 +2988,15 @@ static void write_span_mono_ximage( MONO_SPAN_ARGS ) static void -write_span_mono_index_ximage( const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, GLuint colorIndex, - const GLubyte mask[] ) +put_mono_row_ci_ximage( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLuint colorIndex = *((GLuint *) value); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { XMesaPutPixel( img, x, y, colorIndex ); } } @@ -2941,16 +3006,17 @@ write_span_mono_index_ximage( const GLcontext *ctx, struct gl_renderbuffer *rb, /* * Write a span of identical PF_TRUEDITHER pixels to an XImage. */ -static void write_span_mono_TRUEDITHER_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_TRUEDITHER_ximage( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaImage *img = xrb->ximage; const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; GLuint i; y = YFLIP(xrb, y); for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { unsigned long p; PACK_TRUEDITHER( p, x+i, y, r, g, b); XMesaPutPixel( img, x+i, y, p ); @@ -2962,16 +3028,17 @@ static void write_span_mono_TRUEDITHER_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8A8B8G8R pixels to an XImage. */ -static void write_span_mono_8A8B8G8R_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_8A8B8G8R_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaContext xmesa = XMESA_CONTEXT(ctx); GLuint i, *ptr; - const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i] = pixel; } } @@ -2980,16 +3047,17 @@ static void write_span_mono_8A8B8G8R_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8A8R8G8B pixels to an XImage. */ -static void write_span_mono_8A8R8G8B_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_8A8R8G8B_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); GLuint i, *ptr; - const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + XMesaContext xmesa = XMESA_CONTEXT(ctx); + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i] = pixel; } } @@ -2999,8 +3067,9 @@ static void write_span_mono_8A8R8G8B_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8R8G8B pixels to an XImage. */ -static void write_span_mono_8R8G8B_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_8R8G8B_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLuint pixel = PACK_8R8G8B(color[RCOMP], color[GCOMP], color[BCOMP]); GLuint *ptr = PIXEL_ADDR4(xrb, x, y ); @@ -3016,8 +3085,9 @@ static void write_span_mono_8R8G8B_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8R8G8B pixels to an XImage. */ -static void write_span_mono_8R8G8B24_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_8R8G8B24_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP]; const GLubyte g = color[GCOMP]; @@ -3025,7 +3095,7 @@ static void write_span_mono_8R8G8B24_ximage( MONO_SPAN_ARGS ) GLuint i; bgr_t *ptr = PIXEL_ADDR3(xrb, x, y ); for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i].r = r; ptr[i].g = g; ptr[i].b = b; @@ -3037,17 +3107,17 @@ static void write_span_mono_8R8G8B24_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical DITHER pixels to an XImage. */ -static void write_span_mono_DITHER_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_DITHER_ximage( PUT_MONO_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; int yy = YFLIP(xrb, y); register GLuint i; XDITHER_SETUP(yy); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { XMesaPutPixel( img, x, yy, XDITHER( x, r, g, b ) ); } } @@ -3057,16 +3127,16 @@ static void write_span_mono_DITHER_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8-bit DITHER pixels to an XImage. */ -static void write_span_mono_DITHER8_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_DITHER8_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); register GLuint i; XDITHER_SETUP(y); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i] = (GLubyte) XDITHER( x, r, g, b ); } } @@ -3076,17 +3146,17 @@ static void write_span_mono_DITHER8_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8-bit LOOKUP pixels to an XImage. */ -static void write_span_mono_LOOKUP8_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_LOOKUP8_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); GLubyte pixel; LOOKUP_SETUP; pixel = LOOKUP(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i] = pixel; } } @@ -3096,17 +3166,18 @@ static void write_span_mono_LOOKUP8_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical PF_1BIT pixels to an XImage. */ -static void write_span_mono_1BIT_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_1BIT_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { XMesaPutPixel( img, x, y, DITHER_1BIT( x, y, r, g, b ) ); } } @@ -3116,15 +3187,16 @@ static void write_span_mono_1BIT_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical HPCR pixels to an XImage. */ -static void write_span_mono_HPCR_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_HPCR_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); register GLuint i; for (i=0;i<n;i++,x++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i] = DITHER_HPCR( x, y, r, g, b ); } } @@ -3134,15 +3206,15 @@ static void write_span_mono_HPCR_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical 8-bit GRAYSCALE pixels to an XImage. */ -static void write_span_mono_GRAYSCALE8_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_GRAYSCALE8_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); const GLubyte p = GRAY_RGB(color[RCOMP], color[GCOMP], color[BCOMP]); GLubyte *ptr = (GLubyte *) PIXEL_ADDR1(xrb, x, y); GLuint i; for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { ptr[i] = p; } } @@ -3153,8 +3225,9 @@ static void write_span_mono_GRAYSCALE8_ximage( MONO_SPAN_ARGS ) /* * Write a span of identical PF_DITHER_5R6G5B pixels to an XImage. */ -static void write_span_mono_DITHER_5R6G5B_ximage( MONO_SPAN_ARGS ) +static void put_mono_row_DITHER_5R6G5B_ximage( PUT_MONO_ROW_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLushort *ptr = PIXEL_ADDR2(xrb, x, y ); @@ -3162,7 +3235,7 @@ static void write_span_mono_DITHER_5R6G5B_ximage( MONO_SPAN_ARGS ) GLuint i; y = YFLIP(xrb, y); for (i=0;i<n;i++) { - if (mask[i]) { + if (!mask || mask[i]) { PACK_TRUEDITHER(ptr[i], x+i, y, r, g, b); } } @@ -3174,23 +3247,26 @@ static void write_span_mono_DITHER_5R6G5B_ximage( MONO_SPAN_ARGS ) /*** Write MONO COLOR PIXELS functions ***/ /**********************************************************************/ -#define MONO_PIXEL_ARGS const GLcontext *ctx, \ - struct gl_renderbuffer *rb, \ - GLuint n, const GLint x[], const GLint y[], \ - const GLchan color[4], const GLubyte mask[] +#define PUT_MONO_VALUES_ARGS \ + GLcontext *ctx, struct gl_renderbuffer *rb, \ + GLuint n, const GLint x[], const GLint y[], \ + const void *value, const GLubyte mask[] + + /* * Write an array of identical pixels to a pixmap. */ -static void write_pixels_mono_pixmap( MONO_PIXEL_ARGS ) +static void put_mono_values_pixmap( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); XMesaSetForeground( xmesa->display, gc, pixel ); for (i=0;i<n;i++) { @@ -3203,15 +3279,14 @@ static void write_pixels_mono_pixmap( MONO_PIXEL_ARGS ) static void -write_pixels_mono_index_pixmap(const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - GLuint colorIndex, const GLubyte mask[] ) +put_mono_values_ci_pixmap( PUT_MONO_VALUES_ARGS ) { + const GLuint colorIndex = *((GLuint *) value); const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); for (i=0;i<n;i++) { @@ -3226,13 +3301,14 @@ write_pixels_mono_index_pixmap(const GLcontext *ctx, struct gl_renderbuffer *rb, /* * Write an array of PF_TRUEDITHER pixels to a pixmap. */ -static void write_pixels_mono_TRUEDITHER_pixmap( MONO_PIXEL_ARGS ) +static void put_mono_values_TRUEDITHER_pixmap( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;i<n;i++) { @@ -3250,13 +3326,14 @@ static void write_pixels_mono_TRUEDITHER_pixmap( MONO_PIXEL_ARGS ) /* * Write an array of PF_DITHER pixels to a pixmap. */ -static void write_pixels_mono_DITHER_pixmap( MONO_PIXEL_ARGS ) +static void put_mono_values_DITHER_pixmap( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; DITHER_SETUP; @@ -3272,13 +3349,14 @@ static void write_pixels_mono_DITHER_pixmap( MONO_PIXEL_ARGS ) /* * Write an array of PF_1BIT pixels to a pixmap. */ -static void write_pixels_mono_1BIT_pixmap( MONO_PIXEL_ARGS ) +static void put_mono_values_1BIT_pixmap( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; SETUP_1BIT; @@ -3294,13 +3372,14 @@ static void write_pixels_mono_1BIT_pixmap( MONO_PIXEL_ARGS ) /* * Write an array of identical pixels to an XImage. */ -static void write_pixels_mono_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; - const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); for (i=0;i<n;i++) { if (mask[i]) { @@ -3311,14 +3390,11 @@ static void write_pixels_mono_ximage( MONO_PIXEL_ARGS ) static void -write_pixels_mono_index_ximage(const GLcontext *ctx, - struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - GLuint colorIndex, const GLubyte mask[] ) +put_mono_values_ci_ximage( PUT_MONO_VALUES_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLuint colorIndex = *((GLuint *) value); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -3331,11 +3407,12 @@ write_pixels_mono_index_ximage(const GLcontext *ctx, /* * Write an array of identical TRUEDITHER pixels to an XImage. */ -static void write_pixels_mono_TRUEDITHER_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_TRUEDITHER_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;i<n;i++) { @@ -3352,8 +3429,9 @@ static void write_pixels_mono_TRUEDITHER_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8A8B8G8R pixels to an XImage */ -static void write_pixels_mono_8A8B8G8R_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_8A8B8G8R_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLuint p = PACK_8A8B8G8R(color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP]); @@ -3369,8 +3447,9 @@ static void write_pixels_mono_8A8B8G8R_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8A8R8G8B pixels to an XImage */ -static void write_pixels_mono_8A8R8G8B_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_8A8R8G8B_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLuint p = PACK_8A8R8G8B(color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP]); @@ -3386,8 +3465,9 @@ static void write_pixels_mono_8A8R8G8B_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8R8G8B pixels to an XImage. */ -static void write_pixels_mono_8R8G8B_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_8R8G8B_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; register GLuint i; const GLuint p = PACK_8R8G8B(color[RCOMP], color[GCOMP], color[BCOMP]); @@ -3403,8 +3483,9 @@ static void write_pixels_mono_8R8G8B_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8R8G8B pixels to an XImage. */ -static void write_pixels_mono_8R8G8B24_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_8R8G8B24_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; @@ -3422,12 +3503,12 @@ static void write_pixels_mono_8R8G8B24_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical PF_DITHER pixels to an XImage. */ -static void write_pixels_mono_DITHER_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_DITHER_ximage( PUT_MONO_VALUES_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; DITHER_SETUP; for (i=0;i<n;i++) { @@ -3441,10 +3522,10 @@ static void write_pixels_mono_DITHER_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8-bit PF_DITHER pixels to an XImage. */ -static void write_pixels_mono_DITHER8_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_DITHER8_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; DITHER_SETUP; @@ -3460,10 +3541,10 @@ static void write_pixels_mono_DITHER8_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8-bit PF_LOOKUP pixels to an XImage. */ -static void write_pixels_mono_LOOKUP8_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_LOOKUP8_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; GLubyte pixel; LOOKUP_SETUP; @@ -3481,12 +3562,13 @@ static void write_pixels_mono_LOOKUP8_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical PF_1BIT pixels to an XImage. */ -static void write_pixels_mono_1BIT_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_1BIT_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; for (i=0;i<n;i++) { @@ -3501,8 +3583,9 @@ static void write_pixels_mono_1BIT_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical PF_HPCR pixels to an XImage. */ -static void write_pixels_mono_HPCR_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_HPCR_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; @@ -3519,10 +3602,10 @@ static void write_pixels_mono_HPCR_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical 8-bit PF_GRAYSCALE pixels to an XImage. */ -static void write_pixels_mono_GRAYSCALE8_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_GRAYSCALE8_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; register GLubyte p = GRAY_RGB(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;i<n;i++) { @@ -3537,8 +3620,9 @@ static void write_pixels_mono_GRAYSCALE8_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical PF_DITHER_5R6G5B pixels to an XImage. */ -static void write_pixels_mono_DITHER_5R6G5B_ximage( MONO_PIXEL_ARGS ) +static void put_mono_values_DITHER_5R6G5B_ximage( PUT_MONO_VALUES_ARGS ) { + const GLubyte *color = (const GLubyte *) value; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; @@ -3557,54 +3641,17 @@ static void write_pixels_mono_DITHER_5R6G5B_ximage( MONO_PIXEL_ARGS ) /*** Write INDEX SPAN functions ***/ /**********************************************************************/ -#define INDEX_SPAN_ARGS const GLcontext *ctx, struct gl_renderbuffer *rb, \ - GLuint n, GLint x, GLint y, const GLuint index[], \ - const GLubyte mask[] - -#define INDEX8_SPAN_ARGS const GLcontext *ctx, struct gl_renderbuffer *rb, \ - GLuint n, GLint x, GLint y, const GLubyte index[], \ - const GLubyte mask[] - - /* * Write a span of CI pixels to a Pixmap. */ -static void write_span_index_pixmap( INDEX_SPAN_ARGS ) -{ - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;i<n;i++,x++) { - if (mask[i]) { - XMesaSetForeground( dpy, gc, (unsigned long) index[i] ); - XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); - } - } - } - else { - for (i=0;i<n;i++,x++) { - XMesaSetForeground( dpy, gc, (unsigned long) index[i] ); - XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); - } - } -} - - -/* - * Write a span of 8-bit CI pixels to a Pixmap. - */ -static void write_span_index8_pixmap( INDEX8_SPAN_ARGS ) +static void put_row_ci_pixmap( PUT_ROW_ARGS ) { + const GLuint *index = (GLuint *) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -3627,11 +3674,11 @@ static void write_span_index8_pixmap( INDEX8_SPAN_ARGS ) /* * Write a span of CI pixels to an XImage. */ -static void write_span_index_ximage( INDEX_SPAN_ARGS ) +static void put_row_ci_ximage( PUT_ROW_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLuint *index = (const GLuint *) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); if (mask) { @@ -3649,72 +3696,21 @@ static void write_span_index_ximage( INDEX_SPAN_ARGS ) } -/* - * Write a span of 8-bit CI pixels to a non 8-bit XImage. - */ -static void write_span_index8_ximage( INDEX8_SPAN_ARGS ) -{ - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - y = YFLIP(xrb, y); - if (mask) { - GLuint i; - for (i=0;i<n;i++) { - if (mask[i]) { - XMesaPutPixel(xmesa->xm_buffer->backimage, x+i, y, index[i]); - } - } - } - else { - GLuint i; - for (i=0;i<n;i++) { - XMesaPutPixel(xmesa->xm_buffer->backimage, x+i, y, index[i]); - } - } -} - -/* - * Write a span of 8-bit CI pixels to an 8-bit XImage. - */ -static void write_span_index8_ximage8( INDEX8_SPAN_ARGS ) -{ - struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - GLubyte *dst = PIXEL_ADDR1(xrb, x, y); - if (mask) { - GLuint i; - for (i=0;i<n;i++) { - if (mask[i]) { - dst[i] = index[i]; - } - } - } - else { - MEMCPY( dst, index, n ); - } -} - - - /**********************************************************************/ /*** Write INDEX PIXELS functions ***/ /**********************************************************************/ -#define INDEX_PIXELS_ARGS const GLcontext *ctx, \ - struct gl_renderbuffer *rb, \ - GLuint n, const GLint x[], const GLint y[], \ - const GLuint index[], const GLubyte mask[] - - /* * Write an array of CI pixels to a Pixmap. */ -static void write_pixels_index_pixmap( INDEX_PIXELS_ARGS ) +static void put_values_ci_pixmap( PUT_VALUES_ARGS ) { + const GLuint *index = (const GLuint *) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc; + XMesaDrawable buffer = xrb->pixmap; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -3728,15 +3724,15 @@ static void write_pixels_index_pixmap( INDEX_PIXELS_ARGS ) /* * Write an array of CI pixels to an XImage. */ -static void write_pixels_index_ximage( INDEX_PIXELS_ARGS ) +static void put_values_ci_ximage( PUT_VALUES_ARGS ) { - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLuint *index = (const GLuint *) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaImage *img = xmesa->xm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { - XMesaPutPixel( img, x[i], YFLIP(xrb, y[i]), (unsigned long) index[i] ); + XMesaPutPixel(img, x[i], YFLIP(xrb, y[i]), (unsigned long) index[i]); } } } @@ -3758,16 +3754,17 @@ static void write_pixels_index_ximage( INDEX_PIXELS_ARGS ) * else return number of pixels to skip in the destination array. */ static int -clip_for_xgetimage(XMesaContext xmesa, GLuint *n, GLint *x, GLint *y) +clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y) { - XMesaBuffer source = xmesa->xm_buffer; + XMesaContext xmesa = XMESA_CONTEXT(ctx); + XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); Window rootWin = RootWindow(xmesa->display, 0); Window child; GLint screenWidth = WidthOfScreen(DefaultScreenOfDisplay(xmesa->display)); GLint dx, dy; - if (source->type == PBUFFER || source->type == PIXMAP) + if (source->type == PBUFFER) return 0; - XTranslateCoordinates(xmesa->display, source->frontbuffer, rootWin, + XTranslateCoordinates(xmesa->display, source->frontxrb->pixmap, rootWin, *x, *y, &dx, &dy, &child); if (dx >= screenWidth) { /* totally clipped on right */ @@ -3797,27 +3794,27 @@ clip_for_xgetimage(XMesaContext xmesa, GLuint *n, GLint *x, GLint *y) * Read a horizontal span of color-index pixels. */ static void -read_index_span(const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, GLuint index[]) +get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, void *values) { + GLuint *index = (GLuint *) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaBuffer source = xmesa->xm_buffer; GLuint i; y = YFLIP(xrb, y); - if (source->buffer) { + if (xrb->pixmap) { #ifndef XFree86Server XMesaImage *span = NULL; int error; - int k = clip_for_xgetimage(xmesa, &n, &x, &y); + int k = clip_for_xgetimage(ctx, &n, &x, &y); if (k < 0) return; index += k; catch_xgetimage_errors( xmesa->display ); - span = XGetImage( xmesa->display, source->buffer, + span = XGetImage( xmesa->display, xrb->pixmap, x, y, n, 1, AllPlanes, ZPixmap ); error = check_xgetimage_errors(); if (span && !error) { @@ -3840,8 +3837,8 @@ read_index_span(const GLcontext *ctx, struct gl_renderbuffer *rb, ~0L, (pointer)index); #endif } - else if (source->backimage) { - XMesaImage *img = source->backimage; + else if (xrb->ximage) { + XMesaImage *img = xrb->ximage; for (i=0;i<n;i++,x++) { index[i] = (GLuint) XMesaGetPixel( img, x, y ); } @@ -3854,14 +3851,15 @@ read_index_span(const GLcontext *ctx, struct gl_renderbuffer *rb, * Read a horizontal span of color pixels. */ static void -read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, GLubyte rgba[][4] ) +get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, GLint x, GLint y, void *values) { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - XMesaBuffer source = xmesa->xm_buffer; + XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); - if (source->buffer) { + if (xrb->pixmap) { /* Read from Pixmap or Window */ XMesaImage *span = NULL; int error; @@ -3875,12 +3873,12 @@ read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, #else int k; y = YFLIP(xrb, y); - k = clip_for_xgetimage(xmesa, &n, &x, &y); + k = clip_for_xgetimage(ctx, &n, &x, &y); if (k < 0) return; rgba += k; catch_xgetimage_errors( xmesa->display ); - span = XGetImage( xmesa->display, source->buffer, + span = XGetImage( xmesa->display, xrb->pixmap, x, y, n, 1, AllPlanes, ZPixmap ); error = check_xgetimage_errors(); #endif @@ -4054,7 +4052,7 @@ read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, XMesaDestroyImage( span ); } } - else if (source->backimage) { + else if (xrb->ximage) { /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_Truecolor: @@ -4069,7 +4067,7 @@ read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; - XMesaImage *img = source->backimage; + XMesaImage *img = xrb->ximage; GLuint i; y = YFLIP(xrb, y); for (i=0;i<n;i++) { @@ -4213,7 +4211,7 @@ read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, } } else { - XMesaImage *img = source->backimage; + XMesaImage *img = xrb->ximage; GLuint i; y = YFLIP(xrb, y); for (i=0;i<n;i++,x++) { @@ -4228,7 +4226,7 @@ read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, break; case PF_1Bit: { - XMesaImage *img = source->backimage; + XMesaImage *img = xrb->ximage; int bitFlip = xmesa->xm_visual->bitFlip; GLuint i; y = YFLIP(xrb, y); @@ -4255,30 +4253,23 @@ read_color_span( const GLcontext *ctx, struct gl_renderbuffer *rb, * Read an array of color index pixels. */ static void -read_index_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - GLuint indx[], const GLubyte mask[] ) +get_values_ci(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], void *values) { + GLuint *indx = (GLuint *) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; - register GLuint i; - XMesaBuffer source = xmesa->xm_buffer; - - if (source->buffer) { + GLuint i; + if (xrb->pixmap) { for (i=0;i<n;i++) { - if (mask[i]) { - indx[i] = (GLuint) read_pixel( xmesa->display, - source->buffer, - x[i], YFLIP(xrb, y[i]) ); - } + indx[i] = (GLuint) read_pixel( xmesa->display, xrb->pixmap, + x[i], YFLIP(xrb, y[i]) ); } } - else if (source->backimage) { - XMesaImage *img = source->backimage; + else if (xrb->ximage) { + XMesaImage *img = xrb->ximage; for (i=0;i<n;i++) { - if (mask[i]) { - indx[i] = (GLuint) XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ); - } + indx[i] = (GLuint) XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ); } } } @@ -4286,18 +4277,18 @@ read_index_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, static void -read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - GLubyte rgba[][4], const GLubyte mask[] ) +get_values_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint n, const GLint x[], const GLint y[], void *values) { + GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; struct xmesa_renderbuffer *xrb = (struct xmesa_renderbuffer *) rb; const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); register GLuint i; - XMesaBuffer source = xmesa->xm_buffer; - XMesaDrawable buffer = source->buffer; /* the X drawable */ - if (source->buffer) { + if (xrb->pixmap) { + XMesaDrawable buffer = xrb->pixmap; switch (xmesa->pixelformat) { case PF_Truecolor: case PF_Dither_True: @@ -4314,77 +4305,63 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = pixelToR[(p & rMask) >> rShift]; - rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; - rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; - rgba[i][ACOMP] = 255; - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = pixelToR[(p & rMask) >> rShift]; + rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; + rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; + rgba[i][ACOMP] = 255; } } break; case PF_8A8B8G8R: for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = (GLubyte) ( p & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ((p >> 16) & 0xff); - rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff); - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = (GLubyte) ( p & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ((p >> 16) & 0xff); + rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff); } break; case PF_8A8R8G8B: for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ( p & 0xff); - rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff); - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ( p & 0xff); + rgba[i][ACOMP] = (GLubyte) ((p >> 24) & 0xff); } break; case PF_8R8G8B: for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ( p & 0xff); - rgba[i][ACOMP] = 255; - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ( p & 0xff); + rgba[i][ACOMP] = 255; } break; case PF_8R8G8B24: for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ( p & 0xff); - rgba[i][ACOMP] = 255; - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = (GLubyte) ((p >> 16) & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ( p & 0xff); + rgba[i][ACOMP] = 255; } break; case PF_HPCR: - { - for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = (GLubyte) ( p & 0xE0 ); - rgba[i][GCOMP] = (GLubyte) ((p & 0x1C) << 3); - rgba[i][BCOMP] = (GLubyte) ((p & 0x03) << 6); - rgba[i][ACOMP] = (GLubyte) 255; - } - } + for (i=0;i<n;i++) { + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = (GLubyte) ( p & 0xE0 ); + rgba[i][GCOMP] = (GLubyte) ((p & 0x1C) << 3); + rgba[i][BCOMP] = (GLubyte) ((p & 0x03) << 6); + rgba[i][ACOMP] = (GLubyte) 255; } break; case PF_Dither: @@ -4395,14 +4372,12 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = rTable[p]; - rgba[i][GCOMP] = gTable[p]; - rgba[i][BCOMP] = bTable[p]; - rgba[i][ACOMP] = 255; - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = rTable[p]; + rgba[i][GCOMP] = gTable[p]; + rgba[i][BCOMP] = bTable[p]; + rgba[i][ACOMP] = 255; } } break; @@ -4410,14 +4385,12 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, { int bitFlip = xmesa->xm_visual->bitFlip; for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p = read_pixel( dpy, buffer, - x[i], YFLIP(xrb, y[i])) ^ bitFlip; - rgba[i][RCOMP] = (GLubyte) (p * 255); - rgba[i][GCOMP] = (GLubyte) (p * 255); - rgba[i][BCOMP] = (GLubyte) (p * 255); - rgba[i][ACOMP] = 255; - } + unsigned long p = read_pixel( dpy, buffer, + x[i], YFLIP(xrb, y[i])) ^ bitFlip; + rgba[i][RCOMP] = (GLubyte) (p * 255); + rgba[i][GCOMP] = (GLubyte) (p * 255); + rgba[i][BCOMP] = (GLubyte) (p * 255); + rgba[i][ACOMP] = 255; } } break; @@ -4426,7 +4399,7 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, return; } } - else if (source->backimage) { + else if (xrb->ximage) { /* Read from XImage back buffer */ switch (xmesa->pixelformat) { case PF_Truecolor: @@ -4443,76 +4416,64 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, GLint rShift = xmesa->xm_visual->rshift; GLint gShift = xmesa->xm_visual->gshift; GLint bShift = xmesa->xm_visual->bshift; - XMesaImage *img = source->backimage; + XMesaImage *img = xrb->ximage; for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p; - p = XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = pixelToR[(p & rMask) >> rShift]; - rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; - rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; - rgba[i][ACOMP] = 255; - } + unsigned long p; + p = XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = pixelToR[(p & rMask) >> rShift]; + rgba[i][GCOMP] = pixelToG[(p & gMask) >> gShift]; + rgba[i][BCOMP] = pixelToB[(p & bMask) >> bShift]; + rgba[i][ACOMP] = 255; } } break; case PF_8A8B8G8R: for (i=0;i<n;i++) { - if (mask[i]) { - GLuint *ptr4 = PIXEL_ADDR4(xrb, x[i], y[i]); - GLuint p4 = *ptr4; - rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ((p4 >> 16) & 0xff); - rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); - } + GLuint *ptr4 = PIXEL_ADDR4(xrb, x[i], y[i]); + GLuint p4 = *ptr4; + rgba[i][RCOMP] = (GLubyte) ( p4 & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ((p4 >> 16) & 0xff); + rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); } break; case PF_8A8R8G8B: for (i=0;i<n;i++) { - if (mask[i]) { - GLuint *ptr4 = PIXEL_ADDR4(xrb, x[i], y[i]); - GLuint p4 = *ptr4; - rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); - rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); - } + GLuint *ptr4 = PIXEL_ADDR4(xrb, x[i], y[i]); + GLuint p4 = *ptr4; + rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); + rgba[i][ACOMP] = (GLubyte) ((p4 >> 24) & 0xff); } break; case PF_8R8G8B: for (i=0;i<n;i++) { - if (mask[i]) { - GLuint *ptr4 = PIXEL_ADDR4(xrb, x[i], y[i]); - GLuint p4 = *ptr4; - rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); - rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); - rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); - rgba[i][ACOMP] = 255; - } + GLuint *ptr4 = PIXEL_ADDR4(xrb, x[i], y[i]); + GLuint p4 = *ptr4; + rgba[i][RCOMP] = (GLubyte) ((p4 >> 16) & 0xff); + rgba[i][GCOMP] = (GLubyte) ((p4 >> 8) & 0xff); + rgba[i][BCOMP] = (GLubyte) ( p4 & 0xff); + rgba[i][ACOMP] = 255; } break; case PF_8R8G8B24: for (i=0;i<n;i++) { - if (mask[i]) { - bgr_t *ptr3 = PIXEL_ADDR3(xrb, x[i], y[i]); - rgba[i][RCOMP] = ptr3->r; - rgba[i][GCOMP] = ptr3->g; - rgba[i][BCOMP] = ptr3->b; - rgba[i][ACOMP] = 255; - } + bgr_t *ptr3 = PIXEL_ADDR3(xrb, x[i], y[i]); + rgba[i][RCOMP] = ptr3->r; + rgba[i][GCOMP] = ptr3->g; + rgba[i][BCOMP] = ptr3->b; + rgba[i][ACOMP] = 255; } break; case PF_HPCR: for (i=0;i<n;i++) { - if (mask[i]) { - GLubyte *ptr1 = PIXEL_ADDR1(xrb, x[i], y[i]); - GLubyte p = *ptr1; - rgba[i][RCOMP] = p & 0xE0; - rgba[i][GCOMP] = (p & 0x1C) << 3; - rgba[i][BCOMP] = (p & 0x03) << 6; - rgba[i][ACOMP] = 255; - } + GLubyte *ptr1 = PIXEL_ADDR1(xrb, x[i], y[i]); + GLubyte p = *ptr1; + rgba[i][RCOMP] = p & 0xE0; + rgba[i][GCOMP] = (p & 0x1C) << 3; + rgba[i][BCOMP] = (p & 0x03) << 6; + rgba[i][ACOMP] = 255; } break; case PF_Dither: @@ -4522,32 +4483,28 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, GLubyte *rTable = source->pixel_to_r; GLubyte *gTable = source->pixel_to_g; GLubyte *bTable = source->pixel_to_b; - XMesaImage *img = source->backimage; + XMesaImage *img = xrb->ximage; for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p; - p = XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ); - rgba[i][RCOMP] = rTable[p]; - rgba[i][GCOMP] = gTable[p]; - rgba[i][BCOMP] = bTable[p]; - rgba[i][ACOMP] = 255; - } + unsigned long p; + p = XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ); + rgba[i][RCOMP] = rTable[p]; + rgba[i][GCOMP] = gTable[p]; + rgba[i][BCOMP] = bTable[p]; + rgba[i][ACOMP] = 255; } } break; case PF_1Bit: { - XMesaImage *img = source->backimage; + XMesaImage *img = xrb->ximage; int bitFlip = xmesa->xm_visual->bitFlip; for (i=0;i<n;i++) { - if (mask[i]) { - unsigned long p; - p = XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ) ^ bitFlip; - rgba[i][RCOMP] = (GLubyte) (p * 255); - rgba[i][GCOMP] = (GLubyte) (p * 255); - rgba[i][BCOMP] = (GLubyte) (p * 255); - rgba[i][ACOMP] = 255; - } + unsigned long p; + p = XMesaGetPixel( img, x[i], YFLIP(xrb, y[i]) ) ^ bitFlip; + rgba[i][RCOMP] = (GLubyte) (p * 255); + rgba[i][GCOMP] = (GLubyte) (p * 255); + rgba[i][BCOMP] = (GLubyte) (p * 255); + rgba[i][ACOMP] = 255; } } break; @@ -4559,739 +4516,285 @@ read_color_pixels( const GLcontext *ctx, struct gl_renderbuffer *rb, } -static void -clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) -{ - int i; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); - - if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { - /* black is black */ - MEMSET( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 , - sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern)); - } - else { - /* build clear pattern */ - for (i=0; i<16; i++) { - xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = - DITHER_HPCR(i, 0, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2]); - xmesa->xm_visual->hpcr_clear_ximage_pattern[1][i] = - DITHER_HPCR(i, 1, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2]); - } - } -} - - -static void -clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) -{ - int i; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); - CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); - - if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { - /* black is black */ - for (i=0; i<16; i++) { - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0); - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, 0); - } - } - else { - for (i=0; i<16; i++) { - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, - DITHER_HPCR(i, 0, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2])); - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, - DITHER_HPCR(i, 1, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2])); - } - } - /* change tile pixmap content */ - XMesaPutImage(xmesa->display, - (XMesaDrawable)xmesa->xm_visual->hpcr_clear_pixmap, - xmesa->xm_buffer->cleargc, - xmesa->xm_visual->hpcr_clear_ximage, 0, 0, 0, 0, 16, 2); -} - - - -void xmesa_update_span_funcs( GLcontext *ctx ) -{ - XMesaContext xmesa = XMESA_CONTEXT(ctx); - int depth=GET_VISUAL_DEPTH(xmesa->xm_visual); - struct swrast_device_driver *dd = _swrast_GetDeviceDriverReference( ctx ); - - if (ctx->DrawBuffer->Name != 0) { - /* drawing to user framebuffer */ - dd->WriteCI32Span = NULL; - dd->WriteCI8Span = NULL; - dd->WriteMonoCISpan = NULL; - dd->WriteCI32Pixels = NULL; - dd->WriteMonoCIPixels = NULL; - dd->WriteRGBASpan = NULL; - dd->WriteRGBSpan = NULL; - dd->WriteMonoRGBASpan = NULL; - dd->WriteRGBAPixels = NULL; - dd->WriteMonoRGBAPixels = NULL; - dd->ReadCI32Span = NULL; - dd->ReadRGBASpan = NULL; - dd->ReadCI32Pixels = NULL; - dd->ReadRGBAPixels = NULL; - return; - } - - /* - * These drawing functions depend on color buffer config: - */ - if (xmesa->xm_buffer->buffer!=XIMAGE) { - /* Writing to window or back pixmap */ - switch (xmesa->pixelformat) { - case PF_Index: - dd->WriteCI32Span = write_span_index_pixmap; - dd->WriteCI8Span = write_span_index8_pixmap; - dd->WriteMonoCISpan = write_span_mono_index_pixmap; - dd->WriteCI32Pixels = write_pixels_index_pixmap; - dd->WriteMonoCIPixels = write_pixels_mono_index_pixmap; - break; - case PF_Truecolor: - dd->WriteRGBASpan = write_span_TRUECOLOR_pixmap; - dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_TRUECOLOR_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_Dither_True: - dd->WriteRGBASpan = write_span_TRUEDITHER_pixmap; - dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; - dd->WriteRGBAPixels = write_pixels_TRUEDITHER_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; - break; - case PF_8A8B8G8R: - dd->WriteRGBASpan = write_span_8A8B8G8R_pixmap; - dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_8A8R8G8B: - dd->WriteRGBASpan = write_span_8A8R8G8B_pixmap; - dd->WriteRGBSpan = write_span_rgb_8A8R8G8B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8A8R8G8B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_8R8G8B: - dd->WriteRGBASpan = write_span_8R8G8B_pixmap; - dd->WriteRGBSpan = write_span_rgb_8R8G8B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8R8G8B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_8R8G8B24: - dd->WriteRGBASpan = write_span_8R8G8B24_pixmap; - dd->WriteRGBSpan = write_span_rgb_8R8G8B24_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8R8G8B24_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_5R6G5B: - dd->WriteRGBASpan = write_span_5R6G5B_pixmap; - dd->WriteRGBSpan = write_span_rgb_5R6G5B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_5R6G5B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_Dither_5R6G5B: - dd->WriteRGBASpan = write_span_DITHER_5R6G5B_pixmap; - dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; - dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; - break; - case PF_Dither: - dd->WriteRGBASpan = write_span_DITHER_pixmap; - dd->WriteRGBSpan = write_span_rgb_DITHER_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_DITHER_pixmap; - dd->WriteRGBAPixels = write_pixels_DITHER_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_pixmap; - break; - case PF_1Bit: - dd->WriteRGBASpan = write_span_1BIT_pixmap; - dd->WriteRGBSpan = write_span_rgb_1BIT_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_1BIT_pixmap; - dd->WriteRGBAPixels = write_pixels_1BIT_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_pixmap; - break; - case PF_HPCR: - dd->WriteRGBASpan = write_span_HPCR_pixmap; - dd->WriteRGBSpan = write_span_rgb_HPCR_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_HPCR_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - if (xmesa->xm_visual->hpcr_clear_flag) { - ctx->Driver.ClearColor = clear_color_HPCR_pixmap; - } - break; - case PF_Lookup: - dd->WriteRGBASpan = write_span_LOOKUP_pixmap; - dd->WriteRGBSpan = write_span_rgb_LOOKUP_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_LOOKUP_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - case PF_Grayscale: - dd->WriteRGBASpan = write_span_GRAYSCALE_pixmap; - dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_GRAYSCALE_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - break; - default: - _mesa_problem(ctx, "Bad pixel format in xmesa_update_state (1)"); - return; - } - } - else if (xmesa->xm_buffer->buffer==XIMAGE) { - /* Writing to back XImage */ - switch (xmesa->pixelformat) { - case PF_Index: - dd->WriteCI32Span = write_span_index_ximage; - if (depth==8) - dd->WriteCI8Span = write_span_index8_ximage8; - else - dd->WriteCI8Span = write_span_index8_ximage; - dd->WriteMonoCISpan = write_span_mono_index_ximage; - dd->WriteCI32Pixels = write_pixels_index_ximage; - dd->WriteMonoCIPixels = write_pixels_mono_index_ximage; - break; - case PF_Truecolor: - /* Generic RGB */ - dd->WriteRGBASpan = write_span_TRUECOLOR_ximage; - dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_TRUECOLOR_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; - break; - case PF_Dither_True: - dd->WriteRGBASpan = write_span_TRUEDITHER_ximage; - dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_ximage; - dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_ximage; - dd->WriteRGBAPixels = write_pixels_TRUEDITHER_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_ximage; - break; - case PF_8A8B8G8R: - dd->WriteRGBASpan = write_span_8A8B8G8R_ximage; - dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8A8B8G8R_ximage; - dd->WriteRGBAPixels = write_pixels_8A8B8G8R_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage; - break; - case PF_8A8R8G8B: - dd->WriteRGBASpan = write_span_8A8R8G8B_ximage; - dd->WriteRGBSpan = write_span_rgb_8A8R8G8B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8A8R8G8B_ximage; - dd->WriteRGBAPixels = write_pixels_8A8R8G8B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8A8R8G8B_ximage; - break; - case PF_8R8G8B: - dd->WriteRGBASpan = write_span_8R8G8B_ximage; - dd->WriteRGBSpan = write_span_rgb_8R8G8B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage; - dd->WriteRGBAPixels = write_pixels_8R8G8B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B_ximage; - break; - case PF_8R8G8B24: - dd->WriteRGBASpan = write_span_8R8G8B24_ximage; - dd->WriteRGBSpan = write_span_rgb_8R8G8B24_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8R8G8B24_ximage; - dd->WriteRGBAPixels = write_pixels_8R8G8B24_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B24_ximage; - break; - case PF_5R6G5B: - dd->WriteRGBASpan = write_span_5R6G5B_ximage; - dd->WriteRGBSpan = write_span_rgb_5R6G5B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_5R6G5B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; - break; - case PF_Dither_5R6G5B: - dd->WriteRGBASpan = write_span_DITHER_5R6G5B_ximage; - dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_DITHER_5R6G5B_ximage; - dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_5R6G5B_ximage; - break; - case PF_Dither: - if (depth==8) { - dd->WriteRGBASpan = write_span_DITHER8_ximage; - dd->WriteRGBSpan = write_span_rgb_DITHER8_ximage; - dd->WriteMonoRGBASpan = write_span_mono_DITHER8_ximage; - dd->WriteRGBAPixels = write_pixels_DITHER8_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER8_ximage; - } - else { - dd->WriteRGBASpan = write_span_DITHER_ximage; - dd->WriteRGBSpan = write_span_rgb_DITHER_ximage; - dd->WriteMonoRGBASpan = write_span_mono_DITHER_ximage; - dd->WriteRGBAPixels = write_pixels_DITHER_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_ximage; - } - break; - case PF_1Bit: - dd->WriteRGBASpan = write_span_1BIT_ximage; - dd->WriteRGBSpan = write_span_rgb_1BIT_ximage; - dd->WriteMonoRGBASpan = write_span_mono_1BIT_ximage; - dd->WriteRGBAPixels = write_pixels_1BIT_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_ximage; - break; - case PF_HPCR: - dd->WriteRGBASpan = write_span_HPCR_ximage; - dd->WriteRGBSpan = write_span_rgb_HPCR_ximage; - dd->WriteMonoRGBASpan = write_span_mono_HPCR_ximage; - dd->WriteRGBAPixels = write_pixels_HPCR_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_HPCR_ximage; - if (xmesa->xm_visual->hpcr_clear_flag) { - ctx->Driver.ClearColor = clear_color_HPCR_ximage; - } - break; - case PF_Lookup: - if (depth==8) { - dd->WriteRGBASpan = write_span_LOOKUP8_ximage; - dd->WriteRGBSpan = write_rgb_LOOKUP8_ximage; - dd->WriteMonoRGBASpan = write_span_mono_LOOKUP8_ximage; - dd->WriteRGBAPixels = write_pixels_LOOKUP8_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_LOOKUP8_ximage; - } - else { - dd->WriteRGBASpan = write_span_LOOKUP_ximage; - dd->WriteRGBSpan = write_span_rgb_LOOKUP_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_LOOKUP_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; - } - break; - case PF_Grayscale: - if (depth==8) { - dd->WriteRGBASpan = write_span_GRAYSCALE8_ximage; - dd->WriteRGBSpan = write_span_rgb_GRAYSCALE8_ximage; - dd->WriteMonoRGBASpan = write_span_mono_GRAYSCALE8_ximage; - dd->WriteRGBAPixels = write_pixels_GRAYSCALE8_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_GRAYSCALE8_ximage; - } - else { - dd->WriteRGBASpan = write_span_GRAYSCALE_ximage; - dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_GRAYSCALE_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; - } - break; - default: - _mesa_problem(ctx, "Bad pixel format in xmesa_update_state (2)"); - return; - } - } - - /* Pixel/span reading functions: */ - dd->ReadCI32Span = read_index_span; - dd->ReadRGBASpan = read_color_span; - dd->ReadCI32Pixels = read_index_pixels; - dd->ReadRGBAPixels = read_color_pixels; -} - - -#if 000 /** - * Initialize the renderbuffer's PutRow, GetRow, etc. functions + * Initialize the renderbuffer's PutRow, GetRow, etc. functions. + * This would generally only need to be called once when the renderbuffer + * is created. However, we can change pixel formats on the fly if dithering + * is enabled/disabled. Therefore, we may call this more often than that. */ -static void -xmesa_set_renderbuffer_funcs(GLcontext *ctx, struct xmesa_renderbuffer *xrb, - GLboolean pixmap, enum pixel_format pixelformat) +void +xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, + enum pixel_format pixelformat, GLint depth) { -#if 0 - XMesaContext xmesa = XMESA_CONTEXT(ctx); - int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); - -#endif + const GLboolean pixmap = xrb->pixmap ? GL_TRUE : GL_FALSE; switch (pixelformat) { case PF_Index: + ASSERT(xrb->Base.DataType == GL_UNSIGNED_INT); if (pixmap) { - /* - dd->WriteCI32Span = write_span_index_pixmap; - dd->WriteCI8Span = write_span_index8_pixmap; - dd->WriteMonoCISpan = write_span_mono_index_pixmap; - dd->WriteCI32Pixels = write_pixels_index_pixmap; - dd->WriteMonoCIPixels = write_pixels_mono_index_pixmap; - */ + xrb->Base.PutRow = put_row_ci_pixmap; + xrb->Base.PutRowRGB = NULL; + xrb->Base.PutMonoRow = put_mono_row_ci_pixmap; + xrb->Base.PutValues = put_values_ci_pixmap; + xrb->Base.PutMonoValues = put_mono_values_ci_pixmap; } else { + xrb->Base.PutRow = put_row_ci_ximage; + xrb->Base.PutRowRGB = NULL; + xrb->Base.PutMonoRow = put_mono_row_ci_ximage; + xrb->Base.PutValues = put_values_ci_ximage; + xrb->Base.PutMonoValues = put_mono_values_ci_ximage; } break; case PF_Truecolor: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_TRUECOLOR_pixmap; - dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_TRUECOLOR_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_TRUECOLOR_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_TRUECOLOR_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + xrb->Base.PutRow = put_row_TRUECOLOR_ximage; + xrb->Base.PutRowRGB = put_row_rgb_TRUECOLOR_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_TRUECOLOR_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_True: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_TRUEDITHER_pixmap; - dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; - dd->WriteRGBAPixels = write_pixels_TRUEDITHER_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; - */ + xrb->Base.PutRow = put_row_TRUEDITHER_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_pixmap; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; + xrb->Base.PutValues = put_values_TRUEDITHER_pixmap; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { + xrb->Base.PutRow = put_row_TRUEDITHER_ximage; + xrb->Base.PutRowRGB = put_row_rgb_TRUEDITHER_ximage; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_ximage; + xrb->Base.PutValues = put_values_TRUEDITHER_ximage; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_ximage; } break; case PF_8A8B8G8R: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_8A8B8G8R_pixmap; - dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8A8B8G8R_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_8A8B8G8R_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8A8B8G8R_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + xrb->Base.PutRow = put_row_8A8B8G8R_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8A8B8G8R_ximage; + xrb->Base.PutMonoRow = put_mono_row_8A8B8G8R_ximage; + xrb->Base.PutValues = put_values_8A8B8G8R_ximage; + xrb->Base.PutMonoValues = put_mono_values_8A8B8G8R_ximage; } break; case PF_8A8R8G8B: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_8A8R8G8B_pixmap; - dd->WriteRGBSpan = write_span_rgb_8A8R8G8B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8A8R8G8B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_8A8R8G8B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8A8R8G8B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + xrb->Base.PutRow = put_row_8A8R8G8B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8A8R8G8B_ximage; + xrb->Base.PutMonoRow = put_mono_row_8A8R8G8B_ximage; + xrb->Base.PutValues = put_values_8A8R8G8B_ximage; + xrb->Base.PutMonoValues = put_mono_values_8A8R8G8B_ximage; } break; case PF_8R8G8B: - /* - dd->WriteRGBASpan = write_span_8R8G8B_pixmap; - dd->WriteRGBSpan = write_span_rgb_8R8G8B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8R8G8B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ if (pixmap) { - xrb->Base.PutRow = put_row_8R8G8B_pixmap; - xrb->Base.PutMonoRow = put_mono_row_pixmap; - xrb->Base.PutValues = put_values_8R8G8B_pixmap; + xrb->Base.PutRow = put_row_8R8G8B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8R8G8B_pixmap; xrb->Base.PutMonoValues = put_mono_values_pixmap; } + else { + xrb->Base.PutRow = put_row_8R8G8B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B_ximage; + xrb->Base.PutMonoRow = put_mono_row_8R8G8B_ximage; + xrb->Base.PutValues = put_values_8R8G8B_ximage; + xrb->Base.PutMonoValues = put_mono_values_8R8G8B_ximage; + } break; case PF_8R8G8B24: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_8R8G8B24_pixmap; - dd->WriteRGBSpan = write_span_rgb_8R8G8B24_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_8R8G8B24_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_8R8G8B24_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_8R8G8B24_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + xrb->Base.PutRow = put_row_8R8G8B24_ximage; + xrb->Base.PutRowRGB = put_row_rgb_8R8G8B24_ximage; + xrb->Base.PutMonoRow = put_mono_row_8R8G8B24_ximage; + xrb->Base.PutValues = put_values_8R8G8B24_ximage; + xrb->Base.PutMonoValues = put_mono_values_8R8G8B24_ximage; } break; case PF_5R6G5B: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_5R6G5B_pixmap; - dd->WriteRGBSpan = write_span_rgb_5R6G5B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_5R6G5B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_5R6G5B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_5R6G5B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + xrb->Base.PutRow = put_row_5R6G5B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_5R6G5B_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_5R6G5B_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; } break; case PF_Dither_5R6G5B: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_DITHER_5R6G5B_pixmap; - dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_pixmap; - dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_pixmap; - */ + xrb->Base.PutRow = put_row_DITHER_5R6G5B_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_pixmap; + xrb->Base.PutMonoRow = put_mono_row_TRUEDITHER_pixmap; + xrb->Base.PutValues = put_values_DITHER_5R6G5B_pixmap; + xrb->Base.PutMonoValues = put_mono_values_TRUEDITHER_pixmap; } else { + xrb->Base.PutRow = put_row_DITHER_5R6G5B_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_5R6G5B_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER_5R6G5B_ximage; + xrb->Base.PutValues = put_values_DITHER_5R6G5B_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; } break; case PF_Dither: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_DITHER_pixmap; - dd->WriteRGBSpan = write_span_rgb_DITHER_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_DITHER_pixmap; - dd->WriteRGBAPixels = write_pixels_DITHER_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_pixmap; - */ + xrb->Base.PutRow = put_row_DITHER_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_pixmap; + xrb->Base.PutMonoRow = put_mono_row_DITHER_pixmap; + xrb->Base.PutValues = put_values_DITHER_pixmap; + xrb->Base.PutMonoValues = put_mono_values_DITHER_pixmap; } else { + if (depth == 8) { + xrb->Base.PutRow = put_row_DITHER8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER8_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER8_ximage; + xrb->Base.PutValues = put_values_DITHER8_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER8_ximage; + } + else { + xrb->Base.PutRow = put_row_DITHER_ximage; + xrb->Base.PutRowRGB = put_row_rgb_DITHER_ximage; + xrb->Base.PutMonoRow = put_mono_row_DITHER_ximage; + xrb->Base.PutValues = put_values_DITHER_ximage; + xrb->Base.PutMonoValues = put_mono_values_DITHER_ximage; + } } break; case PF_1Bit: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_1BIT_pixmap; - dd->WriteRGBSpan = write_span_rgb_1BIT_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_1BIT_pixmap; - dd->WriteRGBAPixels = write_pixels_1BIT_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_pixmap; - */ + xrb->Base.PutRow = put_row_1BIT_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_1BIT_pixmap; + xrb->Base.PutMonoRow = put_mono_row_1BIT_pixmap; + xrb->Base.PutValues = put_values_1BIT_pixmap; + xrb->Base.PutMonoValues = put_mono_values_1BIT_pixmap; } else { + xrb->Base.PutRow = put_row_1BIT_ximage; + xrb->Base.PutRowRGB = put_row_rgb_1BIT_ximage; + xrb->Base.PutMonoRow = put_mono_row_1BIT_ximage; + xrb->Base.PutValues = put_values_1BIT_ximage; + xrb->Base.PutMonoValues = put_mono_values_1BIT_ximage; } break; case PF_HPCR: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_HPCR_pixmap; - dd->WriteRGBSpan = write_span_rgb_HPCR_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_HPCR_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_HPCR_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_HPCR_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_HPCR_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { - } - ctx->Driver.ClearColor = clear_color_HPCR_pixmap; + xrb->Base.PutRow = put_row_HPCR_ximage; + xrb->Base.PutRowRGB = put_row_rgb_HPCR_ximage; + xrb->Base.PutMonoRow = put_mono_row_HPCR_ximage; + xrb->Base.PutValues = put_values_HPCR_ximage; + xrb->Base.PutMonoValues = put_mono_values_HPCR_ximage; } break; case PF_Lookup: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_LOOKUP_pixmap; - dd->WriteRGBSpan = write_span_rgb_LOOKUP_pixmap; - dd->WriteRGBAPixels = write_pixels_LOOKUP_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_LOOKUP_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_LOOKUP_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + if (depth==8) { + xrb->Base.PutRow = put_row_LOOKUP8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP8_ximage; + xrb->Base.PutMonoRow = put_mono_row_LOOKUP8_ximage; + xrb->Base.PutValues = put_values_LOOKUP8_ximage; + xrb->Base.PutMonoValues = put_mono_values_LOOKUP8_ximage; + } + else { + xrb->Base.PutRow = put_row_LOOKUP_ximage; + xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_LOOKUP_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; + } } break; case PF_Grayscale: if (pixmap) { - /* - dd->WriteRGBASpan = write_span_GRAYSCALE_pixmap; - dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_pixmap; - dd->WriteMonoRGBASpan = write_span_mono_pixmap; - dd->WriteRGBAPixels = write_pixels_GRAYSCALE_pixmap; - dd->WriteMonoRGBAPixels = write_pixels_mono_pixmap; - */ + xrb->Base.PutRow = put_row_GRAYSCALE_pixmap; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; + xrb->Base.PutMonoRow = put_mono_row_pixmap; + xrb->Base.PutValues = put_values_GRAYSCALE_pixmap; + xrb->Base.PutMonoValues = put_mono_values_pixmap; } else { + if (depth == 8) { + xrb->Base.PutRow = put_row_GRAYSCALE8_ximage; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; + xrb->Base.PutMonoRow = put_mono_row_GRAYSCALE8_ximage; + xrb->Base.PutValues = put_values_GRAYSCALE8_ximage; + xrb->Base.PutMonoValues = put_mono_values_GRAYSCALE8_ximage; + } + else { + xrb->Base.PutRow = put_row_GRAYSCALE_ximage; + xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_ximage; + xrb->Base.PutMonoRow = put_mono_row_ximage; + xrb->Base.PutValues = put_values_GRAYSCALE_ximage; + xrb->Base.PutMonoValues = put_mono_values_ximage; + } } break; default: - _mesa_problem(ctx, "Bad pixel format in xmesa_update_state (1)"); + _mesa_problem(NULL, "Bad pixel format in xmesa_update_state (1)"); return; } -#if 0000 -#if 0 - /* Generic RGB */ - dd->WriteRGBASpan = write_span_TRUECOLOR_ximage; - dd->WriteRGBSpan = write_span_rgb_TRUECOLOR_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_TRUECOLOR_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; -#endif - break; - case PF_Dither_True: -#if 0 - dd->WriteRGBASpan = write_span_TRUEDITHER_ximage; - dd->WriteRGBSpan = write_span_rgb_TRUEDITHER_ximage; - dd->WriteMonoRGBASpan = write_span_mono_TRUEDITHER_ximage; - dd->WriteRGBAPixels = write_pixels_TRUEDITHER_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_TRUEDITHER_ximage; -#endif - break; - case PF_8A8B8G8R: -#if 0 - dd->WriteRGBASpan = write_span_8A8B8G8R_ximage; - dd->WriteRGBSpan = write_span_rgb_8A8B8G8R_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8A8B8G8R_ximage; - dd->WriteRGBAPixels = write_pixels_8A8B8G8R_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8A8B8G8R_ximage; -#endif - break; - case PF_8A8R8G8B: -#if 0 - dd->WriteRGBASpan = write_span_8A8R8G8B_ximage; - dd->WriteRGBSpan = write_span_rgb_8A8R8G8B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8A8R8G8B_ximage; - dd->WriteRGBAPixels = write_pixels_8A8R8G8B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8A8R8G8B_ximage; -#endif - break; - case PF_8R8G8B: -#if 0 - dd->WriteRGBASpan = write_span_8R8G8B_ximage; - dd->WriteRGBSpan = write_span_rgb_8R8G8B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8R8G8B_ximage; - dd->WriteRGBAPixels = write_pixels_8R8G8B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B_ximage; -#endif - break; - case PF_8R8G8B24: -#if 0 - dd->WriteRGBASpan = write_span_8R8G8B24_ximage; - dd->WriteRGBSpan = write_span_rgb_8R8G8B24_ximage; - dd->WriteMonoRGBASpan = write_span_mono_8R8G8B24_ximage; - dd->WriteRGBAPixels = write_pixels_8R8G8B24_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_8R8G8B24_ximage; -#endif - break; - case PF_5R6G5B: -#if 0 - dd->WriteRGBASpan = write_span_5R6G5B_ximage; - dd->WriteRGBSpan = write_span_rgb_5R6G5B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_5R6G5B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; -#endif - break; - case PF_Dither_5R6G5B: -#if 0 - dd->WriteRGBASpan = write_span_DITHER_5R6G5B_ximage; - dd->WriteRGBSpan = write_span_rgb_DITHER_5R6G5B_ximage; - dd->WriteMonoRGBASpan = write_span_mono_DITHER_5R6G5B_ximage; - dd->WriteRGBAPixels = write_pixels_DITHER_5R6G5B_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_5R6G5B_ximage; -#endif - break; - case PF_Dither: -#if 0 - if (depth==8) { - dd->WriteRGBASpan = write_span_DITHER8_ximage; - dd->WriteRGBSpan = write_span_rgb_DITHER8_ximage; - dd->WriteMonoRGBASpan = write_span_mono_DITHER8_ximage; - dd->WriteRGBAPixels = write_pixels_DITHER8_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER8_ximage; - } - else { - dd->WriteRGBASpan = write_span_DITHER_ximage; - dd->WriteRGBSpan = write_span_rgb_DITHER_ximage; - dd->WriteMonoRGBASpan = write_span_mono_DITHER_ximage; - dd->WriteRGBAPixels = write_pixels_DITHER_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_DITHER_ximage; - } -#endif - break; - case PF_1Bit: -#if 0 - dd->WriteRGBASpan = write_span_1BIT_ximage; - dd->WriteRGBSpan = write_span_rgb_1BIT_ximage; - dd->WriteMonoRGBASpan = write_span_mono_1BIT_ximage; - dd->WriteRGBAPixels = write_pixels_1BIT_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_1BIT_ximage; -#endif - break; - case PF_HPCR: -#if 0 - dd->WriteRGBASpan = write_span_HPCR_ximage; - dd->WriteRGBSpan = write_span_rgb_HPCR_ximage; - dd->WriteMonoRGBASpan = write_span_mono_HPCR_ximage; - dd->WriteRGBAPixels = write_pixels_HPCR_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_HPCR_ximage; - if (xmesa->xm_visual->hpcr_clear_flag) { - ctx->Driver.ClearColor = clear_color_HPCR_ximage; - } -#endif - break; - case PF_Lookup: -#if 0 - if (depth==8) { - dd->WriteRGBASpan = write_span_LOOKUP8_ximage; - dd->WriteRGBSpan = write_rgb_LOOKUP8_ximage; - dd->WriteMonoRGBASpan = write_span_mono_LOOKUP8_ximage; - dd->WriteRGBAPixels = write_pixels_LOOKUP8_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_LOOKUP8_ximage; - } - else { - dd->WriteRGBASpan = write_span_LOOKUP_ximage; - dd->WriteRGBSpan = write_span_rgb_LOOKUP_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_LOOKUP_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; - } -#endif - break; - case PF_Grayscale: -#if 0 - if (depth==8) { - dd->WriteRGBASpan = write_span_GRAYSCALE8_ximage; - dd->WriteRGBSpan = write_span_rgb_GRAYSCALE8_ximage; - dd->WriteMonoRGBASpan = write_span_mono_GRAYSCALE8_ximage; - dd->WriteRGBAPixels = write_pixels_GRAYSCALE8_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_GRAYSCALE8_ximage; - } - else { - dd->WriteRGBASpan = write_span_GRAYSCALE_ximage; - dd->WriteRGBSpan = write_span_rgb_GRAYSCALE_ximage; - dd->WriteMonoRGBASpan = write_span_mono_ximage; - dd->WriteRGBAPixels = write_pixels_GRAYSCALE_ximage; - dd->WriteMonoRGBAPixels = write_pixels_mono_ximage; - } -#endif - break; - default: - _mesa_problem(ctx, "Bad pixel format in xmesa_update_state (2)"); - return; - } - } -#endif - - /* Pixel/span reading functions: */ -#if 0 - rb->ReadCI32Span = read_index_span; - dd->ReadRGBASpan = read_color_span; - dd->ReadCI32Pixels = read_index_pixels; - dd->ReadRGBAPixels = read_color_pixels; -#else - rb->GetRow = get_row_color; - rb->GetValues = get_values_color; -#endif + /* Get functions */ + if (pixelformat == PF_Index) { + xrb->Base.GetRow = get_row_ci; + xrb->Base.GetValues = get_values_ci; + } + else { + xrb->Base.GetRow = get_row_rgba; + xrb->Base.GetValues = get_values_rgba; + } } -#endif - diff --git a/src/mesa/swrast/s_spantemp.h b/src/mesa/swrast/s_spantemp.h index 5c67758035..a60d45fb90 100644 --- a/src/mesa/swrast/s_spantemp.h +++ b/src/mesa/swrast/s_spantemp.h @@ -25,340 +25,225 @@ /* * Templates for the span/pixel-array write/read functions called via - * swrast. This is intended for memory-based framebuffers (like OSMesa). + * the gl_renderbuffer's GetRow, GetValues, PutRow, PutMonoRow, PutValues + * and PutMonoValues functions. * * Define the following macros before including this file: * NAME(PREFIX) to generate the function name + * FORMAT must be either GL_RGBA, GL_RGBA8 or GL_COLOR_INDEX8_EXT * SPAN_VARS to declare any local variables * INIT_PIXEL_PTR(P, X, Y) to initialize a pointer to a pixel * INC_PIXEL_PTR(P) to increment a pixel pointer by one pixel - * STORE_RGB_PIXEL(P, X, Y, R, G, B) to store RGB values in pixel P - * STORE_RGBA_PIXEL(P, X, Y, R, G, B, A) to store RGBA values in pixel P - * FETCH_RGBA_PIXEL(R, G, B, A, P) to fetch RGBA values from pixel P + * STORE_PIXEL(DST, X, Y, VALUE) to store pixel values in buffer + * FETCH_PIXEL(DST, SRC) to fetch pixel values from buffer * - * Note that in the above STORE_RGBx_PIXEL macros, we also pass in the (X,Y) - * coordinates for the pixels to be stored, which enables dithering in 8-bit - * and 15/16-bit display modes. Most undithered modes or 24/32-bit display - * modes will simply ignore the passed in (X,Y) values. - * - * For color index mode: - * STORE_CI_PIXEL(P, CI) to store a color index in pixel P - * FETCH_CI_PIXEL(CI, P) to fetch a pixel index from pixel P + * Note that in the STORE_PIXEL macros, we also pass in the (X,Y) coordinates + * for the pixels to be stored. This is useful when dithering and probably + * ignored otherwise. */ #include "macros.h" -#ifdef STORE_RGBA_PIXEL static void -NAME(write_rgba_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, - const void *values, const GLubyte mask[] ) +NAME(get_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, void *values ) { #ifdef SPAN_VARS SPAN_VARS #endif - const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; +#if FORMAT == GL_RGBA + GLchan (*dest)[4] = (GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + GLubyte (*dest)[4] = (GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + GLubyte *dest = (GLubyte *) values; +#else +#error FORMAT must be set!!!! +#endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); - if (mask) { - for (i = 0; i < n; i++) { - if (mask[i]) { - STORE_RGBA_PIXEL(pixel, x+i, y, rgba[i][RCOMP], rgba[i][GCOMP], - rgba[i][BCOMP], rgba[i][ACOMP]); - } - INC_PIXEL_PTR(pixel); - } - } - else { - for (i = 0; i < n; i++) { - STORE_RGBA_PIXEL(pixel, x+i, y, rgba[i][RCOMP], rgba[i][GCOMP], - rgba[i][BCOMP], rgba[i][ACOMP]); - INC_PIXEL_PTR(pixel); - } + for (i = 0; i < count; i++) { + FETCH_PIXEL(dest[i], pixel); + INC_PIXEL_PTR(pixel); } } static void -NAME(write_rgb_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, - const void *values, const GLubyte mask[] ) +NAME(get_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], void *values ) { #ifdef SPAN_VARS SPAN_VARS #endif - const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values; +#if FORMAT == GL_RGBA + GLchan (*dest)[4] = (GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + GLubyte (*dest)[4] = (GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + GLubyte *dest = (GLubyte *) values; +#endif GLuint i; - INIT_PIXEL_PTR(pixel, x, y); - if (mask) { - for (i = 0; i < n; i++) { - if (mask[i]) { - STORE_RGB_PIXEL(pixel, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], - rgb[i][BCOMP]); - } - INC_PIXEL_PTR(pixel); - } - } - else { - for (i = 0; i < n; i++) { - STORE_RGB_PIXEL(pixel, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], - rgb[i][BCOMP]); - INC_PIXEL_PTR(pixel); - } + for (i = 0; i < count; i++) { + INIT_PIXEL_PTR(pixel, x[i], y[i]); + FETCH_PIXEL(dest[i], pixel); } } + static void -NAME(write_monorgba_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, - const void *value, const GLubyte mask[] ) +NAME(put_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *values, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif - const GLubyte *color = (const GLubyte *) value; +#if FORMAT == GL_RGBA + const GLchan (*src)[4] = (const GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + const GLubyte (*src)[4] = (const GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte (*src)[1] = (const GLubyte (*)[1]) values; +#endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); if (mask) { - for (i = 0; i < n; i++) { + for (i = 0; i < count; i++) { if (mask[i]) { - STORE_RGBA_PIXEL(pixel, x+i, y, color[RCOMP], color[GCOMP], - color[BCOMP], color[ACOMP]); + STORE_PIXEL(pixel, x + i, y, src[i]); } INC_PIXEL_PTR(pixel); } } else { - for (i = 0; i < n; i++) { - STORE_RGBA_PIXEL(pixel, x+i, y, color[RCOMP], color[GCOMP], - color[BCOMP], color[ACOMP]); + for (i = 0; i < count; i++) { + STORE_PIXEL(pixel, x + i, y, src[i]); INC_PIXEL_PTR(pixel); } } } +#if 00 static void -NAME(write_rgba_pixels)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - const void *values, const GLubyte mask[] ) -{ -#ifdef SPAN_VARS - SPAN_VARS -#endif - const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; - GLuint i; - ASSERT(mask); - for (i = 0; i < n; i++) { - if (mask[i]) { - INIT_PIXEL_PTR(pixel, x[i], y[i]); - STORE_RGBA_PIXEL(pixel, x[i], y[i], rgba[i][RCOMP], rgba[i][GCOMP], - rgba[i][BCOMP], rgba[i][ACOMP]); - } - } -} - -static void -NAME(write_monorgba_pixels)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - const void *value, const GLubyte mask[] ) -{ -#ifdef SPAN_VARS - SPAN_VARS -#endif - const GLubyte *color = (const GLubyte *) value; - GLuint i; - ASSERT(mask); - for (i = 0; i < n; i++) { - if (mask[i]) { - INIT_PIXEL_PTR(pixel, x[i], y[i]); - STORE_RGBA_PIXEL(pixel, x[i], y[i], color[RCOMP], color[GCOMP], - color[BCOMP], color[ACOMP]); - } - } -} - -static void -NAME(read_rgba_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, void *values ) -{ -#ifdef SPAN_VARS - SPAN_VARS -#endif - GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; - GLuint i; - INIT_PIXEL_PTR(pixel, x, y); - for (i = 0; i < n; i++) { - FETCH_RGBA_PIXEL(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], - rgba[i][ACOMP], pixel); - INC_PIXEL_PTR(pixel); - } -} - -static void -NAME(read_rgba_pixels)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - void *values) -{ -#ifdef SPAN_VARS - SPAN_VARS -#endif - GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; - GLuint i; - ASSERT(mask); - for (i = 0; i < n; i++) { - INIT_PIXEL_PTR(pixel, x[i], y[i]); - FETCH_RGBA_PIXEL(rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP], - rgba[i][ACOMP], pixel); - } -} - - -#endif /* STORE_RGBA_PIXEL */ - - - -#ifdef STORE_CI_PIXEL - -static void -NAME(write_index_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, - const void *values, const GLubyte mask[] ) +NAME(write_rgb_span)( const GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + CONST GLchan rgb[][3], const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif - const GLuint *index = (const GLuint *) values; GLuint i; INIT_PIXEL_PTR(pixel, x, y); if (mask) { - for (i = 0; i < n; i++) { + for (i = 0; i < count; i++) { if (mask[i]) { - STORE_CI_PIXEL(pixel, index[i]); + STORE_RGB_PIXEL(pixel, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], + rgb[i][BCOMP]); } INC_PIXEL_PTR(pixel); } } else { - for (i = 0; i < n; i++) { - STORE_CI_PIXEL(pixel, index[i]); + for (i = 0; i < count; i++) { + STORE_RGB_PIXEL(pixel, x+i, y, rgb[i][RCOMP], rgb[i][GCOMP], + rgb[i][BCOMP]); INC_PIXEL_PTR(pixel); } } } - +#endif static void -NAME(write_monoindex_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, - const void *value, const GLubyte mask[] ) +NAME(put_mono_row)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, GLint x, GLint y, + const void *value, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif - GLuint colorIndex = *((GLuint *) value); +#if FORMAT == GL_RGBA + const GLchan *src = (const GLchan *) value; +#elif FORMAT == GL_RGBA8 + const GLubyte *src = (const GLubyte *) value; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte *src = (const GLubyte *) value; +#endif GLuint i; INIT_PIXEL_PTR(pixel, x, y); if (mask) { - for (i = 0; i < n; i++) { + for (i = 0; i < count; i++) { if (mask[i]) { - STORE_CI_PIXEL(pixel, colorIndex); + STORE_PIXEL(pixel, x + i, y, src); } INC_PIXEL_PTR(pixel); } - } + } else { - for (i = 0; i < n; i++) { - STORE_CI_PIXEL(pixel, colorIndex); + for (i = 0; i < count; i++) { + STORE_PIXEL(pixel, x + i, y, src); INC_PIXEL_PTR(pixel); } - } + } } static void -NAME(write_index_pixels)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - const void *values, const GLubyte mask[] ) +NAME(put_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *values, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif - const GLuint *index = (const GLuint *) values; +#if FORMAT == GL_RGBA + const GLchan (*src)[4] = (const GLchan (*)[4]) values; +#elif FORMAT == GL_RGBA8 + const GLubyte (*src)[4] = (const GLubyte (*)[4]) values; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte (*src)[1] = (const GLubyte (*)[1]) values; +#endif GLuint i; ASSERT(mask); - for (i = 0; i < n; i++) { + for (i = 0; i < count; i++) { if (mask[i]) { INIT_PIXEL_PTR(pixel, x[i], y[i]); - STORE_CI_PIXEL(pixel, index[i]); + STORE_PIXEL(pixel, x[i], y[i], src[i]); } } } static void -NAME(write_monoindex_pixels)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - const void *value, const GLubyte mask[] ) +NAME(put_mono_values)( GLcontext *ctx, struct gl_renderbuffer *rb, + GLuint count, const GLint x[], const GLint y[], + const void *value, const GLubyte mask[] ) { #ifdef SPAN_VARS SPAN_VARS #endif - GLuint colorIndex = *((GLuint *) value); +#if FORMAT == GL_RGBA + const GLchan *src = (const GLchan *) value; +#elif FORMAT == GL_RGBA8 + const GLubyte *src = (const GLubyte *) value; +#elif FORMAT == GL_COLOR_INDEX8_EXT + const GLubyte *src = (const GLubyte *) value; +#endif GLuint i; ASSERT(mask); - for (i = 0; i < n; i++) { + for (i = 0; i < count; i++) { if (mask[i]) { INIT_PIXEL_PTR(pixel, x[i], y[i]); - STORE_CI_PIXEL(pixel, colorIndex); + STORE_PIXEL(pixel, x[i], y[i], src); } } } -static void -NAME(read_index_span)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, GLint x, GLint y, void *values ) -{ -#ifdef SPAN_VARS - SPAN_VARS -#endif - GLuint *index = (GLuint *) values; - GLuint i; - INIT_PIXEL_PTR(pixel, x, y); - for (i = 0; i < n; i++) { - FETCH_CI_PIXEL(index[i], pixel); - INC_PIXEL_PTR(pixel); - } -} - - -static void -NAME(read_index_pixels)( GLcontext *ctx, struct gl_renderbuffer *rb, - GLuint n, const GLint x[], const GLint y[], - void *values ) -{ -#ifdef SPAN_VARS - SPAN_VARS -#endif - GLuint *index = (GLuint *) values; - GLuint i; - ASSERT(mask); - for (i = 0; i < n; i++) { - INIT_PIXEL_PTR(pixel, x[i], y[i]); - FETCH_CI_PIXEL(index[i], pixel); - } -} - -#endif /* STORE_CI_PIXEL */ - - - #undef NAME #undef SPAN_VARS #undef INIT_PIXEL_PTR #undef INC_PIXEL_PTR -#undef STORE_RGB_PIXEL -#undef STORE_RGBA_PIXEL -#undef FETCH_RGBA_PIXEL -#undef STORE_CI_PIXEL -#undef FETCH_CI_PIXEL +#undef STORE_PIXEL +#undef FETCH_PIXEL +#undef FORMAT |