From: Brian Paul Date: Wed, 4 May 2005 20:18:23 +0000 (+0000) Subject: FBO changes X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=79c0bb5264dd1f036b354c8eb4dc463594dd4150;p=mesa.git FBO changes --- diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 88dbb0d0b30..b56ced6b5a6 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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_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;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; DITHER_SETUP; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; LOOKUP_SETUP; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;ixm_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;ixm_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;ixm_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;ixm_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;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; y = YFLIP(xrb, y); for (i=0;ixm_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;ipixelformat); ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;ipixelformat); ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; int yy = YFLIP(xrb, y); register GLuint i; XDITHER_SETUP(yy); for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; y = YFLIP(xrb, y); for (i=0;ixm_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;ixm_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;ixm_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;ixm_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;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; DITHER_SETUP; for (i=0;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; SETUP_1BIT; for (i=0;ixm_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;ixm_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;ixm_buffer->backimage, x+i, y, index[i]); - } - } - } - else { - GLuint i; - for (i=0;ixm_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;ixm_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;ixm_buffer->backimage; + XMesaImage *img = xrb->ximage; register GLuint i; for (i=0;ixm_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;ixm_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;ibackimage; + XMesaImage *img = xrb->ximage; GLuint i; y = YFLIP(xrb, y); for (i=0;ibackimage; + 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;idisplay, - 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;ixm_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> 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> 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> 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> 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> 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;ipixel_to_g; GLubyte *bTable = source->pixel_to_b; for (i=0;ixm_visual->bitFlip; for (i=0;ibackimage) { + 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> 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> 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> 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> 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;ir; - 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;ipixel_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;ibackimage; + XMesaImage *img = xrb->ximage; int bitFlip = xmesa->xm_visual->bitFlip; for (i=0;iclearcolor[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 5c67758035f..a60d45fb901 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