diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2000-11-14 17:40:13 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2000-11-14 17:40:13 +0000 |
commit | c19d783e0715ac01ad4d3fd0705500d2bf6f7039 (patch) | |
tree | 68e28470e87358b225e07477a4900d79f8e47b0b /src/mesa | |
parent | 1e1aac034c986a08248861363c0baa27dc2ae2d5 (diff) |
Removed Driver.Color() and Driver.Index() functions.
Pass color or color index directly to WriteMono*() span functions.
Updated current s/w drivers accordingly.
Clean-up of X gc handling in XMesa driver.
Diffstat (limited to 'src/mesa')
24 files changed, 419 insertions, 590 deletions
diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index 24dd9946a3..e70be6cd6b 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -981,8 +981,10 @@ void fxSetupDDPointers(GLcontext *ctx) ctx->Driver.ClearColor=fxDDClearColor; ctx->Driver.Clear=fxDDClear; +#if 0 ctx->Driver.Index=NULL; ctx->Driver.Color=fxDDSetColor; +#endif ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer; ctx->Driver.SetReadBuffer=fxDDSetReadBuffer; diff --git a/src/mesa/drivers/glide/fxddspan.c b/src/mesa/drivers/glide/fxddspan.c index 1c195000a7..7eb8591ae6 100644 --- a/src/mesa/drivers/glide/fxddspan.c +++ b/src/mesa/drivers/glide/fxddspan.c @@ -223,12 +223,13 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx, static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; GLint bottom=fxMesa->height-1; GLuint data[MAX_WIDTH]; + GrColor_t gColor = FXCOLOR4(color); if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n"); @@ -239,7 +240,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, for (i=0;i<n;i++) { if (mask[i]) { - data[span] = (GLuint) fxMesa->color; + data[span] = (GLuint) gColor; ++span; } else { if (span > 0) { @@ -257,7 +258,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, (void *) data ); } else { for (i=0;i<n;i++) { - data[i]=(GLuint) fxMesa->color; + data[i]=(GLuint) gColor; } writeRegionClipped(fxMesa, fxMesa->currentFB, x, bottom-y, GR_LFB_SRC_FMT_8888, @@ -372,11 +373,12 @@ static void fxDDWriteRGBAPixels(const GLcontext *ctx, static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; GLuint i; GLint bottom=fxMesa->height-1; + GrColor_t gColor = FXCOLOR4(color); if (MESA_VERBOSE&VERBOSE_DRIVER) { fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n"); @@ -385,7 +387,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx, for(i=0;i<n;i++) if(mask[i]) writeRegionClipped(fxMesa, fxMesa->currentFB,x[i],bottom-y[i], - GR_LFB_SRC_FMT_8888,1,1,0,(void *) &fxMesa->color); + GR_LFB_SRC_FMT_8888,1,1,0,(void *) &gColor); } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index b3c91048cc..f52a4cfe2e 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -1,4 +1,4 @@ -/* $Id: osmesa.c,v 1.28 2000/11/06 17:28:51 brianp Exp $ */ +/* $Id: osmesa.c,v 1.29 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -92,6 +92,10 @@ static void osmesa_register_swrast_functions( GLcontext *ctx ); +#define OSMESA_CONTEXT(ctx) ((OSMesaContext) (ctx->DriverCtx)) + + + /**********************************************************************/ /***** Public Functions *****/ /**********************************************************************/ @@ -637,7 +641,7 @@ static void set_read_buffer( GLcontext *ctx, GLframebuffer *buffer, GLenum mode static void clear_index( GLcontext *ctx, GLuint index ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); osmesa->clearpixel = index; } @@ -646,7 +650,7 @@ static void clear_index( GLcontext *ctx, GLuint index ) static void clear_color( GLcontext *ctx, GLchan r, GLchan g, GLchan b, GLchan a ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); osmesa->clearpixel = PACK_RGBA( r, g, b, a ); } @@ -655,7 +659,7 @@ static void clear_color( GLcontext *ctx, static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; /* we can't handle color or index masking */ @@ -751,7 +755,7 @@ static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all, static void set_index( GLcontext *ctx, GLuint index ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); osmesa->pixel = index; } @@ -760,7 +764,7 @@ static void set_index( GLcontext *ctx, GLuint index ) static void set_color( GLcontext *ctx, GLchan r, GLchan g, GLchan b, GLchan a ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); osmesa->pixel = PACK_RGBA( r, g, b, a ); } @@ -768,7 +772,7 @@ static void set_color( GLcontext *ctx, static void buffer_size( GLcontext *ctx, GLuint *width, GLuint *height ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); *width = osmesa->width; *height = osmesa->height; } @@ -783,7 +787,7 @@ static void write_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, CONST GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint *ptr4 = PIXELADDR4( x, y ); GLuint i; GLint rshift = osmesa->rshift; @@ -811,7 +815,7 @@ static void write_rgba_span_rgba( const GLcontext *ctx, CONST GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint *ptr4 = PIXELADDR4( x, y ); const GLuint *rgba4 = (const GLuint *) rgba; GLuint i; @@ -833,7 +837,7 @@ static void write_rgb_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, CONST GLchan rgb[][3], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint *ptr4 = PIXELADDR4( x, y ); GLuint i; GLint rshift = osmesa->rshift; @@ -858,14 +862,16 @@ static void write_rgb_span( const GLcontext *ctx, static void write_monocolor_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[] ) + const GLchan color[4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); + const GLuint pixel = PACK_RGBA(color[RCOMP], color[GCOMP], + color[BCOMP], color[ACOMP]); GLuint *ptr4 = PIXELADDR4(x,y); GLuint i; for (i=0;i<n;i++,ptr4++) { if (mask[i]) { - *ptr4 = osmesa->pixel; + *ptr4 = pixel; } } } @@ -876,7 +882,7 @@ static void write_rgba_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; GLint rshift = osmesa->rshift; GLint gshift = osmesa->gshift; @@ -894,14 +900,17 @@ static void write_rgba_pixels( const GLcontext *ctx, static void write_monocolor_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLchan color[4], + const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); + const GLuint pixel = PACK_RGBA(color[RCOMP], color[GCOMP], + color[BCOMP], color[ACOMP]); GLuint i; for (i=0;i<n;i++) { if (mask[i]) { GLuint *ptr4 = PIXELADDR4(x[i],y[i]); - *ptr4 = osmesa->pixel; + *ptr4 = pixel; } } } @@ -910,7 +919,7 @@ static void write_monocolor_pixels( const GLcontext *ctx, static void read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; GLuint *ptr4 = PIXELADDR4(x,y); for (i=0;i<n;i++) { @@ -928,7 +937,7 @@ static void read_rgba_span_rgba( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint *ptr4 = PIXELADDR4(x,y); MEMCPY( rgba, ptr4, n * 4 * sizeof(GLchan) ); } @@ -938,7 +947,7 @@ static void read_rgba_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -961,7 +970,7 @@ static void write_rgba_span3( const GLcontext *ctx, GLuint n, GLint x, GLint y, CONST GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLubyte *ptr3 = PIXELADDR3( x, y); GLuint i; GLint rind = osmesa->rind; @@ -990,12 +999,12 @@ static void write_rgb_span3( const GLcontext *ctx, GLuint n, GLint x, GLint y, CONST GLchan rgb[][3], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); + const GLint rind = osmesa->rind; + const GLint gind = osmesa->gind; + const GLint bind = osmesa->bind; GLubyte *ptr3 = PIXELADDR3( x, y); GLuint i; - GLint rind = osmesa->rind; - GLint gind = osmesa->gind; - GLint bind = osmesa->bind; if (mask) { for (i=0;i<n;i++,ptr3+=3) { if (mask[i]) { @@ -1016,17 +1025,16 @@ static void write_rgb_span3( const GLcontext *ctx, static void write_monocolor_span3( const GLcontext *ctx, - GLuint n, GLint x, GLint y, - const GLubyte mask[] ) + GLuint n, GLint x, GLint y, + const GLchan color[4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; - - GLubyte rval = UNPACK_RED(osmesa->pixel); - GLubyte gval = UNPACK_GREEN(osmesa->pixel); - GLubyte bval = UNPACK_BLUE(osmesa->pixel); - GLint rind = osmesa->rind; - GLint gind = osmesa->gind; - GLint bind = osmesa->bind; + const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); + const GLubyte rval = color[RCOMP]; + const GLubyte gval = color[GCOMP]; + const GLubyte bval = color[BCOMP]; + const GLint rind = osmesa->rind; + const GLint gind = osmesa->gind; + const GLint bind = osmesa->bind; GLubyte *ptr3 = PIXELADDR3( x, y); GLuint i; for (i=0;i<n;i++,ptr3+=3) { @@ -1042,7 +1050,7 @@ static void write_rgba_pixels3( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], CONST GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + const OSMesaContext osmesa = (const OSMesaContext) ctx; GLuint i; GLint rind = osmesa->rind; GLint gind = osmesa->gind; @@ -1058,17 +1066,19 @@ static void write_rgba_pixels3( const GLcontext *ctx, } static void write_monocolor_pixels3( const GLcontext *ctx, - GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + GLuint n, const GLint x[], + const GLint y[], + const GLchan color[4], + const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + const OSMesaContext osmesa = OSMESA_CONTEXT(ctx); + const GLint rind = osmesa->rind; + const GLint gind = osmesa->gind; + const GLint bind = osmesa->bind; + const GLubyte rval = color[RCOMP]; + const GLubyte gval = color[GCOMP]; + const GLubyte bval = color[BCOMP]; GLuint i; - GLint rind = osmesa->rind; - GLint gind = osmesa->gind; - GLint bind = osmesa->bind; - GLubyte rval = UNPACK_RED(osmesa->pixel); - GLubyte gval = UNPACK_GREEN(osmesa->pixel); - GLubyte bval = UNPACK_BLUE(osmesa->pixel); for (i=0;i<n;i++) { if (mask[i]) { GLubyte *ptr3 = PIXELADDR3(x[i],y[i]); @@ -1083,7 +1093,7 @@ static void read_rgba_span3( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan rgba[][4] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; GLint rind = osmesa->rind; GLint gind = osmesa->gind; @@ -1101,7 +1111,7 @@ static void read_rgba_pixels3( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLchan rgba[][4], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; GLint rind = osmesa->rind; GLint gind = osmesa->gind; @@ -1127,7 +1137,7 @@ static void write_index32_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLubyte *ptr1 = PIXELADDR1(x,y); GLuint i; if (mask) { @@ -1150,7 +1160,7 @@ static void write_index8_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLubyte *ptr1 = PIXELADDR1(x,y); GLuint i; if (mask) { @@ -1168,14 +1178,14 @@ static void write_index8_span( const GLcontext *ctx, static void write_monoindex_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[] ) + GLuint colorIndex, const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLubyte *ptr1 = PIXELADDR1(x,y); GLuint i; for (i=0;i<n;i++,ptr1++) { if (mask[i]) { - *ptr1 = (GLubyte) osmesa->pixel; + *ptr1 = (GLubyte) colorIndex; } } } @@ -1185,7 +1195,7 @@ static void write_index_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -1198,14 +1208,14 @@ static void write_index_pixels( const GLcontext *ctx, static void write_monoindex_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + GLuint colorIndex, const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; for (i=0;i<n;i++) { if (mask[i]) { GLubyte *ptr1 = PIXELADDR1(x[i],y[i]); - *ptr1 = (GLubyte) osmesa->pixel; + *ptr1 = (GLubyte) colorIndex; } } } @@ -1214,7 +1224,7 @@ static void write_monoindex_pixels( const GLcontext *ctx, static void read_index_span( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; const GLubyte *ptr1 = PIXELADDR1(x,y); for (i=0;i<n;i++,ptr1++) { @@ -1227,7 +1237,7 @@ static void read_index_pixels( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint index[], const GLubyte mask[] ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLuint i; for (i=0;i<n;i++) { if (mask[i] ) { @@ -1250,7 +1260,7 @@ static void read_index_pixels( const GLcontext *ctx, static void flat_rgba_line( GLcontext *ctx, SWvertex *vert0, SWvertex *vert1 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLubyte *color = vert0->color; unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); @@ -1272,7 +1282,7 @@ static void flat_rgba_line( GLcontext *ctx, static void flat_rgba_z_line( GLcontext *ctx, SWvertex *vert0, SWvertex *vert1 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLubyte *color = vert0->color; unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); @@ -1301,7 +1311,7 @@ static void flat_rgba_z_line( GLcontext *ctx, static void flat_blend_rgba_line( GLcontext *ctx, SWvertex *vert0, SWvertex *vert1 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLint rshift = osmesa->rshift; GLint gshift = osmesa->gshift; GLint bshift = osmesa->bshift; @@ -1336,7 +1346,7 @@ static void flat_blend_rgba_line( GLcontext *ctx, static void flat_blend_rgba_z_line( GLcontext *ctx, SWvertex *vert0, SWvertex *vert1 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLint rshift = osmesa->rshift; GLint gshift = osmesa->gshift; GLint bshift = osmesa->bshift; @@ -1374,7 +1384,7 @@ static void flat_blend_rgba_z_line( GLcontext *ctx, static void flat_blend_rgba_z_line_write( GLcontext *ctx, SWvertex *vert0, SWvertex *vert1 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLint rshift = osmesa->rshift; GLint gshift = osmesa->gshift; GLint bshift = osmesa->bshift; @@ -1414,7 +1424,7 @@ static void flat_blend_rgba_z_line_write( GLcontext *ctx, static swrast_line_func osmesa_choose_line_function( GLcontext *ctx ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx); if (ctx->RenderMode != GL_RENDER) return NULL; @@ -1520,7 +1530,7 @@ osmesa_choose_line_function( GLcontext *ctx ) static void smooth_rgba_z_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); GLint rshift = osmesa->rshift; GLint gshift = osmesa->gshift; GLint bshift = osmesa->bshift; @@ -1562,7 +1572,7 @@ static void smooth_rgba_z_triangle( GLcontext *ctx, static void flat_rgba_z_triangle( GLcontext *ctx, SWvertex *v0, SWvertex *v1, SWvertex *v2 ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define SETUP_CODE \ @@ -1601,7 +1611,7 @@ static void flat_rgba_z_triangle( GLcontext *ctx, static swrast_tri_func osmesa_choose_triangle_function( GLcontext *ctx ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx); if ((osmesa->format==OSMESA_RGB)||(osmesa->format==OSMESA_BGR)) @@ -1694,7 +1704,7 @@ static const GLubyte *get_string( GLcontext *ctx, GLenum name ) static void osmesa_update_state( GLcontext *ctx ) { - OSMesaContext osmesa = (OSMesaContext) ctx; + OSMesaContext osmesa = OSMESA_CONTEXT(ctx); ASSERT((void *) osmesa == (void *) ctx->DriverCtx); @@ -1704,8 +1714,10 @@ static void osmesa_update_state( GLcontext *ctx ) ctx->Driver.SetDrawBuffer = set_draw_buffer; ctx->Driver.SetReadBuffer = set_read_buffer; +#if 000 ctx->Driver.Color = set_color; ctx->Driver.Index = set_index; +#endif ctx->Driver.ClearIndex = clear_index; ctx->Driver.ClearColor = clear_color; ctx->Driver.Clear = clear; diff --git a/src/mesa/drivers/svga/svgamesa.c b/src/mesa/drivers/svga/svgamesa.c index 0d7fa158db..daa660e434 100644 --- a/src/mesa/drivers/svga/svgamesa.c +++ b/src/mesa/drivers/svga/svgamesa.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa.c,v 1.6 2000/09/26 20:54:12 brianp Exp $ */ +/* $Id: svgamesa.c,v 1.7 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -291,7 +291,6 @@ static void svgamesa_update_state( GLcontext *ctx ) switch (SVGABuffer.Depth) { case 8: ctx->Driver.ClearIndex = __clear_index8; ctx->Driver.Clear = __clear8; - ctx->Driver.Index = __set_index8; ctx->Driver.ReadCI32Span = __read_ci32_span8; ctx->Driver.ReadCI32Pixels = __read_ci32_pixels8; @@ -307,7 +306,6 @@ static void svgamesa_update_state( GLcontext *ctx ) break; case 15: ctx->Driver.ClearColor = __clear_color15; ctx->Driver.Clear = __clear15; - ctx->Driver.Color = __set_color15; ctx->Driver.ReadRGBASpan = __read_rgba_span15; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels15; @@ -321,7 +319,6 @@ static void svgamesa_update_state( GLcontext *ctx ) break; case 16: ctx->Driver.ClearColor = __clear_color16; ctx->Driver.Clear = __clear16; - ctx->Driver.Color = __set_color16; ctx->Driver.ReadRGBASpan = __read_rgba_span16; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels16; @@ -335,7 +332,6 @@ static void svgamesa_update_state( GLcontext *ctx ) #endif case 24: ctx->Driver.ClearColor = __clear_color24; ctx->Driver.Clear = __clear24; - ctx->Driver.Color = __set_color24; ctx->Driver.ReadRGBASpan = __read_rgba_span24; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels24; @@ -349,7 +345,6 @@ static void svgamesa_update_state( GLcontext *ctx ) #endif case 32: ctx->Driver.ClearColor = __clear_color32; ctx->Driver.Clear = __clear32; - ctx->Driver.Color = __set_color32; ctx->Driver.ReadRGBASpan = __read_rgba_span32; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels32; @@ -429,9 +424,6 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer ) ctx->gl_vis->AccumRedBits > 0, ctx->gl_vis->AlphaBits > 0 ); - ctx->index = 1; - ctx->red = ctx->green = ctx->blue = 255; - ctx->width = ctx->height = 0; /* temporary until first "make-current" */ #endif return ctx; diff --git a/src/mesa/drivers/svga/svgamesa15.c b/src/mesa/drivers/svga/svgamesa15.c index 28cd7a4264..3332503d2b 100644 --- a/src/mesa/drivers/svga/svgamesa15.c +++ b/src/mesa/drivers/svga/svgamesa15.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa15.c,v 1.6 2000/06/14 21:59:07 brianp Exp $ */ +/* $Id: svgamesa15.c,v 1.7 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -54,14 +54,6 @@ static unsigned long __svga_getpixel15(int x, int y) return shortBuffer[offset]; } -void __set_color15( GLcontext *ctx, - GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha ) -{ - SVGAMesa->hicolor=(red>>3)<<10 | (green>>3)<<5 | (blue>>3); -/* SVGAMesa->hicolor=(red)<<10 | (green)<<5 | (blue); */ -} - void __clear_color15( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) @@ -134,12 +126,15 @@ void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, void __write_mono_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { + GLushort hicolor = (color[RCOMP] >> 3) << 10 | + (color[GCOMP] >> 3) << 5 | + (color[BCOMP] >> 3); int i; for (i=0; i<n; i++, x++) { if (mask[i]) { - __svga_drawpixel15( x, y, SVGAMesa->hicolor); + __svga_drawpixel15( x, y, hicolor); } } } @@ -174,13 +169,16 @@ void __write_rgba_pixels15( const GLcontext *ctx, void __write_mono_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLchan color[4], const GLubyte mask[] ) { + GLushort hicolor = (color[RCOMP] >> 3) << 10 | + (color[GCOMP] >> 3) << 5 | + (color[BCOMP] >> 3); int i; /* use current rgb color */ for (i=0; i<n; i++) { if (mask[i]) { - __svga_drawpixel15( x[i], y[i], SVGAMesa->hicolor ); + __svga_drawpixel15( x[i], y[i], hicolor ); } } } diff --git a/src/mesa/drivers/svga/svgamesa15.h b/src/mesa/drivers/svga/svgamesa15.h index ad04489f8e..83591a610f 100644 --- a/src/mesa/drivers/svga/svgamesa15.h +++ b/src/mesa/drivers/svga/svgamesa15.h @@ -1,4 +1,4 @@ -/* $Id: svgamesa15.h,v 1.3 2000/01/25 00:03:02 brianp Exp $ */ +/* $Id: svgamesa15.h,v 1.4 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,14 +31,13 @@ #ifndef SVGA_MESA_15_H #define SVGA_MESA_15_H -extern void __set_color15( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern void __clear_color15( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern GLbitfield __clear15( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); extern void __write_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]); +extern void __write_mono_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); extern void __read_rgba_span15( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); extern void __write_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); +extern void __write_mono_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); extern void __read_rgba_pixels15( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); #endif /* SVGA_MESA_15_H */ diff --git a/src/mesa/drivers/svga/svgamesa16.c b/src/mesa/drivers/svga/svgamesa16.c index 817d4bb606..02d1251665 100644 --- a/src/mesa/drivers/svga/svgamesa16.c +++ b/src/mesa/drivers/svga/svgamesa16.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa16.c,v 1.6 2000/06/14 21:59:07 brianp Exp $ */ +/* $Id: svgamesa16.c,v 1.7 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -56,14 +56,6 @@ static unsigned long __svga_getpixel16(int x, int y) return shortBuffer[offset]; } -void __set_color16( GLcontext *ctx, - GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha ) -{ - SVGAMesa->hicolor=(red>>3)<<11 | (green>>2)<<5 | (blue>>3); -/* SVGAMesa->hicolor=(red)<<11 | (green)<<5 | (blue); */ -} - void __clear_color16( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) @@ -136,12 +128,13 @@ void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, void __write_mono_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { + GLushort hicolor=(color[RCOMP]>>3)<<11 | (color[GCOMP]>>2)<<5 | (color[BCOMP]>>3); int i; for (i=0; i<n; i++, x++) { if (mask[i]) { - __svga_drawpixel16( x, y, SVGAMesa->hicolor); + __svga_drawpixel16( x, y, hicolor); } } } @@ -176,13 +169,13 @@ void __write_rgba_pixels16( const GLcontext *ctx, void __write_mono_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLchan color[4], const GLubyte mask[] ) { + GLushort hicolor=(color[RCOMP]>>3)<<11 | (color[GCOMP]>>2)<<5 | (color[BCOMP]>>3); int i; - /* use current rgb color */ for (i=0; i<n; i++) { if (mask[i]) { - __svga_drawpixel16( x[i], y[i], SVGAMesa->hicolor ); + __svga_drawpixel16( x[i], y[i], hicolor ); } } } diff --git a/src/mesa/drivers/svga/svgamesa16.h b/src/mesa/drivers/svga/svgamesa16.h index 114defdd7c..94ddcf3a19 100644 --- a/src/mesa/drivers/svga/svgamesa16.h +++ b/src/mesa/drivers/svga/svgamesa16.h @@ -1,4 +1,4 @@ -/* $Id: svgamesa16.h,v 1.2 2000/01/22 20:08:36 brianp Exp $ */ +/* $Id: svgamesa16.h,v 1.3 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,14 +31,13 @@ #ifndef SVGA_MESA_16_H #define SVGA_MESA_16_H -extern void __set_color16( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern void __clear_color16( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern GLbitfield __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); extern void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]); +extern void __write_mono_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); extern void __read_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); extern void __write_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); +extern void __write_mono_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); extern void __read_rgba_pixels16( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); #endif /* SVGA_MESA_16_H */ diff --git a/src/mesa/drivers/svga/svgamesa24.c b/src/mesa/drivers/svga/svgamesa24.c index 6f7cc9c221..aa174df4cc 100644 --- a/src/mesa/drivers/svga/svgamesa24.c +++ b/src/mesa/drivers/svga/svgamesa24.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa24.c,v 1.7 2000/06/14 21:59:07 brianp Exp $ */ +/* $Id: svgamesa24.c,v 1.8 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -78,16 +78,6 @@ static unsigned long __svga_getpixel24(int x, int y) return rgbBuffer[offset].r<<16 | rgbBuffer[offset].g<<8 | rgbBuffer[offset].b; } -void __set_color24( GLcontext *ctx, - GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha ) -{ - SVGAMesa->red = red; - SVGAMesa->green = green; - SVGAMesa->blue = blue; -/* SVGAMesa->truecolor = red<<16 | green<<8 | blue; */ -} - void __clear_color24( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) @@ -172,14 +162,12 @@ void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, void __write_mono_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { int i; for (i=0; i<n; i++, x++) { if (mask[i]) { - __svga_drawpixel24( x, y, SVGAMesa->red, - SVGAMesa->green, - SVGAMesa->blue); + __svga_drawpixel24( x, y, color[RCOMP], color[GCOMP], color[BCOMP]); } } } @@ -210,15 +198,13 @@ void __write_rgba_pixels24( const GLcontext *ctx, void __write_mono_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLchan color[4], const GLubyte mask[] ) { int i; - /* use current rgb color */ for (i=0; i<n; i++) { if (mask[i]) { - __svga_drawpixel24( x[i], y[i], SVGAMesa->red, - SVGAMesa->green, - SVGAMesa->blue); + __svga_drawpixel24( x[i], y[i], + color[RCOMP], color[GCOMP], color[BCOMP] ); } } } diff --git a/src/mesa/drivers/svga/svgamesa24.h b/src/mesa/drivers/svga/svgamesa24.h index 9ec4e2dbac..dc9382034b 100644 --- a/src/mesa/drivers/svga/svgamesa24.h +++ b/src/mesa/drivers/svga/svgamesa24.h @@ -1,4 +1,4 @@ -/* $Id: svgamesa24.h,v 1.2 2000/01/22 20:08:36 brianp Exp $ */ +/* $Id: svgamesa24.h,v 1.3 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,14 +31,13 @@ #ifndef SVGA_MESA_24_H #define SVGA_MESA_24_H -extern void __set_color24( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern void __clear_color24( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern GLbitfield __clear24( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); extern void __write_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]); +extern void __write_mono_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); extern void __read_rgba_span24( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); extern void __write_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); +extern void __write_mono_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); extern void __read_rgba_pixels24( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); #endif /* SVGA_MESA_24_H */ diff --git a/src/mesa/drivers/svga/svgamesa32.c b/src/mesa/drivers/svga/svgamesa32.c index 1fbef3d26d..a56afdc86c 100644 --- a/src/mesa/drivers/svga/svgamesa32.c +++ b/src/mesa/drivers/svga/svgamesa32.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa32.c,v 1.7 2000/06/14 21:59:07 brianp Exp $ */ +/* $Id: svgamesa32.c,v 1.8 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -74,16 +74,6 @@ static unsigned long __svga_getpixel32(int x, int y) return intBuffer[offset]; } -void __set_color32( GLcontext *ctx, - GLubyte red, GLubyte green, - GLubyte blue, GLubyte alpha ) -{ - SVGAMesa->red = red; - SVGAMesa->green = green; - SVGAMesa->blue = blue; - SVGAMesa->truecolor = red<<16 | green<<8 | blue; -} - void __clear_color32( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) @@ -151,12 +141,13 @@ void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, void __write_mono_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { int i; + GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP]; for (i=0; i<n; i++, x++) { if (mask[i]) { - __svga_drawpixel32( x, y, SVGAMesa->truecolor); + __svga_drawpixel32( x, y, truecolor); } } } @@ -185,13 +176,13 @@ void __write_rgba_pixels32( const GLcontext *ctx, void __write_mono_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + const GLchan color[4], const GLubyte mask[] ) { + GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP]; int i; - /* use current rgb color */ for (i=0; i<n; i++) { if (mask[i]) { - __svga_drawpixel32( x[i], y[i], SVGAMesa->truecolor ); + __svga_drawpixel32( x[i], y[i], truecolor ); } } } diff --git a/src/mesa/drivers/svga/svgamesa32.h b/src/mesa/drivers/svga/svgamesa32.h index 5029ea06a6..3640624972 100644 --- a/src/mesa/drivers/svga/svgamesa32.h +++ b/src/mesa/drivers/svga/svgamesa32.h @@ -1,4 +1,4 @@ -/* $Id: svgamesa32.h,v 1.2 2000/01/22 20:08:36 brianp Exp $ */ +/* $Id: svgamesa32.h,v 1.3 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,14 +31,13 @@ #ifndef SVGA_MESA_32_H #define SVGA_MESA_32_H -extern void __set_color32( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern void __clear_color32( GLcontext *ctx, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); extern GLbitfield __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); extern void __write_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[]); +extern void __write_mono_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLchan color[4], const GLubyte mask[]); extern void __read_rgba_span32( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLubyte rgba[][4] ); extern void __write_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte rgba[][4], const GLubyte mask[] ); -extern void __write_mono_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); +extern void __write_mono_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLchan color[4], const GLubyte mask[] ); extern void __read_rgba_pixels32( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLubyte rgba[][4], const GLubyte mask[] ); #endif /* SVGA_MESA_32_H */ diff --git a/src/mesa/drivers/svga/svgamesa8.c b/src/mesa/drivers/svga/svgamesa8.c index 2578428178..a829063520 100644 --- a/src/mesa/drivers/svga/svgamesa8.c +++ b/src/mesa/drivers/svga/svgamesa8.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa8.c,v 1.6 2000/06/14 21:59:07 brianp Exp $ */ +/* $Id: svgamesa8.c,v 1.7 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -53,11 +53,6 @@ static unsigned long __svga_getpixel8(int x, int y) return SVGABuffer.ReadBuffer[offset]; } -void __set_index8( GLcontext *ctx, GLuint index ) -{ - SVGAMesa->index = index; -} - void __clear_index8( GLcontext *ctx, GLuint index ) { SVGAMesa->clear_index = index; @@ -121,12 +116,13 @@ void __write_ci8_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, } void __write_mono_ci_span8( const GLcontext *ctx, GLuint n, - GLint x, GLint y, const GLubyte mask[] ) + GLint x, GLint y, + GLuint colorIndex, const GLubyte mask[] ) { int i; for (i=0;i<n;i++,x++) { if (mask[i]) { - __svga_drawpixel8( x, y, SVGAMesa->index); + __svga_drawpixel8( x, y, colorIndex); } } } @@ -155,12 +151,12 @@ void __write_ci32_pixels8( const GLcontext *ctx, void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + GLuint colorIndex, const GLubyte mask[] ) { int i; for (i=0; i<n; i++) { if (mask[i]) { - __svga_drawpixel8( x[i], y[i], SVGAMesa->index); + __svga_drawpixel8( x[i], y[i], colorIndex); } } } diff --git a/src/mesa/drivers/svga/svgamesa8.h b/src/mesa/drivers/svga/svgamesa8.h index a8a175b2e9..c77e10244d 100644 --- a/src/mesa/drivers/svga/svgamesa8.h +++ b/src/mesa/drivers/svga/svgamesa8.h @@ -1,4 +1,4 @@ -/* $Id: svgamesa8.h,v 1.2 2000/01/22 20:08:36 brianp Exp $ */ +/* $Id: svgamesa8.h,v 1.3 2000/11/14 17:40:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -31,15 +31,14 @@ #ifndef SVGA_MESA_8_H #define SVGA_MESA_8_H -extern void __set_index8( GLcontext *ctx, GLuint index ); extern void __clear_index8( GLcontext *ctx, GLuint index ); extern GLbitfield __clear8( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ); extern void __write_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLuint index[], const GLubyte mask[] ); extern void __write_ci8_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte index[], const GLubyte mask[] ); -extern void __write_mono_ci_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, const GLubyte mask[] ); +extern void __write_mono_ci_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ); extern void __read_ci32_span8( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint index[]); extern void __write_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLuint index[], const GLubyte mask[] ); -extern void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], const GLubyte mask[] ); +extern void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint colorIndex, const GLubyte mask[] ); extern void __read_ci32_pixels8( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLuint index[], const GLubyte mask[] ); #endif /* SVGA_MESA_15_H */ diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c index aa0f58c5fc..55c5c402af 100644 --- a/src/mesa/drivers/windows/wmesa.c +++ b/src/mesa/drivers/windows/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.10 2000/11/05 18:41:00 keithw Exp $ */ +/* $Id: wmesa.c,v 1.11 2000/11/14 17:40:15 brianp Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 @@ -488,25 +488,6 @@ static GLbitfield clear(GLcontext* ctx, GLbitfield mask, -/* Set the current color index. */ -static void set_index(GLcontext* ctx, GLuint index) -{ - STARTPROFILE - Current->pixel=index; - ENDPROFILE(set_index) -} - - - -/* Set the current RGBA color. */ -static void set_color( GLcontext* ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) -{ - STARTPROFILE - Current->pixel = RGB( r, g, b ); - ENDPROFILE(set_color) -} - - static void enable( GLcontext* ctx, GLenum pname, GLboolean enable ) { if (!Current) @@ -766,7 +747,7 @@ static void write_ci8_span( const GLcontext* ctx, */ static void write_mono_ci_span(const GLcontext* ctx, GLuint n,GLint x,GLint y, - const GLubyte mask[]) + GLuint colorIndex, const GLubyte mask[]) { STARTPROFILE GLuint i; @@ -774,7 +755,7 @@ static void write_mono_ci_span(const GLcontext* ctx, assert(Current->rgb_flag==GL_FALSE); for (i=0; i<n; i++) if (mask[i]) - Mem[i]=Current->pixel; + Mem[i]=colorIndex; ENDPROFILE(write_mono_ci_span) } @@ -874,8 +855,9 @@ static void write_rgb_span( const GLcontext* ctx, */ static void write_mono_rgba_span( const GLcontext* ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[]) + const GLchan color[4], const GLubyte mask[]) { + ULONG pixel = RGB( color[RCOMP], color[GCOMP], color[BCOMP] ); STARTPROFILE GLuint i; HDC DC=DD_GETDC; @@ -886,12 +868,12 @@ static void write_mono_rgba_span( const GLcontext* ctx, for (i=0; i<n; i++) if (mask[i]) // Trying - wmSetPixel(pwc,y,x+i,GetRValue(Current->pixel), GetGValue(Current->pixel), GetBValue(Current->pixel)); + wmSetPixel(pwc,y,x+i,color[RCOMP], color[GCOMP], color[BCOMP]); } else { for (i=0; i<n; i++) if (mask[i]) - SetPixel(DC, y, x+i, Current->pixel); + SetPixel(DC, y, x+i, pixel); } DD_RELEASEDC; ENDPROFILE(write_mono_rgba_span) @@ -930,7 +912,7 @@ static void write_ci32_pixels( const GLcontext* ctx, static void write_mono_ci_pixels( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ) + GLuint colorIndex, const GLubyte mask[] ) { STARTPROFILE GLuint i; @@ -938,7 +920,7 @@ static void write_mono_ci_pixels( const GLcontext* ctx, for (i=0; i<n; i++) { if (mask[i]) { BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]; - *Mem = Current->pixel; + *Mem = colorIndex; } } ENDPROFILE(write_mono_ci_pixels) @@ -958,7 +940,8 @@ static void write_rgba_pixels( const GLcontext* ctx, assert(Current->rgb_flag==GL_TRUE); for (i=0; i<n; i++) if (mask[i]) - wmSetPixel(pwc, FLIP(y[i]),x[i],rgba[i][RCOMP],rgba[i][GCOMP],rgba[i][BCOMP]); + wmSetPixel(pwc, FLIP(y[i]), x[i], + rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP]); DD_RELEASEDC; ENDPROFILE(write_rgba_pixels) } @@ -972,6 +955,7 @@ static void write_rgba_pixels( const GLcontext* ctx, static void write_mono_rgba_pixels( const GLcontext* ctx, GLuint n, const GLint x[], const GLint y[], + const GLchan color[4], const GLubyte mask[] ) { STARTPROFILE @@ -981,8 +965,8 @@ static void write_mono_rgba_pixels( const GLcontext* ctx, assert(Current->rgb_flag==GL_TRUE); for (i=0; i<n; i++) if (mask[i]) - wmSetPixel(pwc, FLIP(y[i]),x[i],GetRValue(Current->pixel), - GetGValue(Current->pixel), GetBValue(Current->pixel)); + wmSetPixel(pwc, FLIP(y[i]),x[i],color[RCOMP], + color[GCOMP], color[BCOMP]); DD_RELEASEDC; ENDPROFILE(write_mono_rgba_pixels) } @@ -1109,9 +1093,6 @@ void setup_DD_pointers( GLcontext* ctx ) ctx->Driver.ClearColor = clear_color; ctx->Driver.Clear = clear; - ctx->Driver.Index = set_index; - ctx->Driver.Color = set_color; - ctx->Driver.Enable = enable; ctx->Driver.SetDrawBuffer = set_draw_buffer; diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 3120b24a5e..9fa029cd48 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1,4 +1,4 @@ -/* $Id: xm_api.c,v 1.6 2000/11/05 18:26:12 keithw Exp $ */ +/* $Id: xm_api.c,v 1.7 2000/11/14 17:40:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1295,14 +1295,11 @@ static GLboolean initialize_visual_and_buffer( int client, /* X11 graphics contexts */ #ifdef XFree86Server - b->gc1 = CreateScratchGC(v->display, window->depth); - b->gc2 = CreateScratchGC(v->display, window->depth); + b->gc = CreateScratchGC(v->display, window->depth); #else - b->gc1 = XCreateGC( v->display, window, 0, NULL ); - b->gc2 = XCreateGC( v->display, window, 0, NULL ); + b->gc = XCreateGC( v->display, window, 0, NULL ); #endif - XMesaSetFunction( v->display, b->gc1, GXcopy ); - XMesaSetFunction( v->display, b->gc2, GXcopy ); + XMesaSetFunction( v->display, b->gc, GXcopy ); /* * Don't generate Graphics Expose/NoExpose events in swapbuffers(). @@ -1993,8 +1990,7 @@ void XMesaDestroyBuffer( XMesaBuffer b ) client = CLIENT_ID(b->frontbuffer->id); #endif - if (b->gc1) XMesaFreeGC( b->xm_visual->display, b->gc1 ); - if (b->gc2) XMesaFreeGC( b->xm_visual->display, b->gc2 ); + if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc ); if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc ); if (b->backimage) { @@ -2099,9 +2095,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer, * Must recompute and set these pixel values because colormap * can be different for different windows. */ - c->pixel = xmesa_color_to_pixel( c, c->red, c->green, - c->blue, c->alpha, c->pixelformat ); - XMesaSetForeground( c->display, c->xm_buffer->gc1, c->pixel ); c->clearpixel = xmesa_color_to_pixel( c, c->clearcolor[0], c->clearcolor[1], diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 179178e258..81700b5a52 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1,4 +1,4 @@ -/* $Id: xm_dd.c,v 1.4 2000/11/13 20:02:57 keithw Exp $ */ +/* $Id: xm_dd.c,v 1.5 2000/11/14 17:40:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -245,33 +245,6 @@ clear_color( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) -/* Set current color index */ -static void -set_index( GLcontext *ctx, GLuint index ) -{ - const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - unsigned long p = (unsigned long) index; - xmesa->pixel = p; - XMesaSetForeground( xmesa->display, xmesa->xm_buffer->gc1, p ); -} - - - -/* Set current drawing color */ -static void -set_color( GLcontext *ctx, GLubyte r, GLubyte g, GLubyte b, GLubyte a ) -{ - const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - xmesa->red = r; - xmesa->green = g; - xmesa->blue = b; - xmesa->alpha = a; - xmesa->pixel = xmesa_color_to_pixel( xmesa, r, g, b, a, xmesa->pixelformat );; - XMesaSetForeground( xmesa->display, xmesa->xm_buffer->gc1, xmesa->pixel ); -} - - - /* Set index mask ala glIndexMask */ static void index_mask( GLcontext *ctx, GLuint mask ) @@ -807,7 +780,7 @@ drawpixels_8R8G8B( GLcontext *ctx, const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc1; + XMesaGC gc = xmesa->xm_buffer->gc; assert(dpy); assert(buffer); assert(gc); @@ -952,8 +925,6 @@ void xmesa_init_pointers( GLcontext *ctx ) ctx->Driver.SetDrawBuffer = set_draw_buffer; ctx->Driver.SetReadBuffer = set_read_buffer; - ctx->Driver.Index = set_index; - ctx->Driver.Color = set_color; ctx->Driver.ClearIndex = clear_index; ctx->Driver.ClearColor = clear_color; ctx->Driver.Clear = clear_buffers; diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 4c09187add..9b5386caa6 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -1,4 +1,4 @@ -/* $Id: xm_line.c,v 1.8 2000/11/06 17:28:20 brianp Exp $ */ +/* $Id: xm_line.c,v 1.9 2000/11/14 17:40:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -60,7 +60,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, SWvertex *vert ) XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; if (xmesa->xm_visual->gl_visual->RGBAflag) { register int x, y; @@ -114,38 +114,6 @@ void xmesa_choose_point( GLcontext *ctx ) /**********************************************************************/ -#if 0 -/* - * Render a line into a pixmap, any pixel format. - */ -static void flat_pixmap_line( GLcontext *ctx, - SWvertex *vert0, SWvertex *vert1 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - register int x0, y0, x1, y1; - XMesaGC gc; - unsigned long pixel; - if (xmesa->xm_visual->gl_visual->RGBAflag) { - const GLubyte *color = vert0->color; - pixel = xmesa_color_to_pixel( xmesa, color[0], color[1], color[2], color[3], - xmesa->pixelformat ); - } - else { - pixel = vert0->index; - } - gc = xmesa->xm_buffer->gc2; - XMesaSetForeground( xmesa->display, gc, pixel ); - - x0 = (GLint) vert0->win[0]; - y0 = FLIP( xmesa->xm_buffer, (GLint) vert0->win[1] ); - x1 = (GLint) vert1->win[0]; - y1 = FLIP( xmesa->xm_buffer, (GLint) vert1->win[1] ); - XMesaDrawLine( xmesa->display, xmesa->xm_buffer->buffer, gc, - x0, y0, x1, y1 ); -} -#endif - - /* * Draw a flat-shaded, PF_TRUECOLOR line into an XImage. */ diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 3542f9275a..18f7de4f38 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -1,4 +1,4 @@ -/* $Id: xm_span.c,v 1.1 2000/09/07 15:40:30 brianp Exp $ */ +/* $Id: xm_span.c,v 1.2 2000/11/14 17:40:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -185,7 +185,7 @@ static void write_span_TRUECOLOR_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -219,7 +219,7 @@ static void write_span_rgb_TRUECOLOR_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -253,7 +253,7 @@ static void write_span_TRUEDITHER_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -286,7 +286,7 @@ static void write_span_rgb_TRUEDITHER_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -320,7 +320,7 @@ static void write_span_8A8B8G8R_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -352,7 +352,7 @@ static void write_span_rgb_8A8B8G8R_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -384,7 +384,7 @@ static void write_span_8R8G8B_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -415,7 +415,7 @@ static void write_span_8R8G8B24_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; y = FLIP(xmesa->xm_buffer, y); if (mask) { register GLuint i; @@ -509,7 +509,7 @@ static void write_span_rgb_8R8G8B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -540,7 +540,7 @@ static void write_span_rgb_8R8G8B24_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; y = FLIP(xmesa->xm_buffer, y); if (mask) { register GLuint i; @@ -639,7 +639,7 @@ static void write_span_5R6G5B_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -670,7 +670,7 @@ static void write_span_DITHER_5R6G5B_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -703,7 +703,7 @@ static void write_span_rgb_5R6G5B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -734,7 +734,7 @@ static void write_span_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -768,7 +768,7 @@ static void write_span_DITHER_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; XDITHER_SETUP(y); y = FLIP(xmesa->xm_buffer, y); @@ -799,7 +799,7 @@ static void write_span_rgb_DITHER_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; XDITHER_SETUP(y); y = FLIP(xmesa->xm_buffer, y); @@ -830,7 +830,7 @@ static void write_span_1BIT_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; SETUP_1BIT; y = FLIP(xmesa->xm_buffer, y); @@ -863,7 +863,7 @@ static void write_span_rgb_1BIT_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; SETUP_1BIT; y = FLIP(xmesa->xm_buffer, y); @@ -896,7 +896,7 @@ static void write_span_HPCR_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -927,7 +927,7 @@ static void write_span_rgb_HPCR_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -958,7 +958,7 @@ static void write_span_LOOKUP_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; LOOKUP_SETUP; y = FLIP(xmesa->xm_buffer, y); @@ -988,7 +988,7 @@ static void write_span_rgb_LOOKUP_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; LOOKUP_SETUP; y = FLIP(xmesa->xm_buffer, y); @@ -1019,7 +1019,7 @@ static void write_span_GRAYSCALE_pixmap( RGBA_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -1048,7 +1048,7 @@ static void write_span_rgb_GRAYSCALE_pixmap( RGB_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); if (mask) { @@ -2038,7 +2038,7 @@ static void write_pixels_TRUECOLOR_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2059,7 +2059,7 @@ static void write_pixels_TRUEDITHER_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2080,7 +2080,7 @@ static void write_pixels_8A8B8G8R_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2100,7 +2100,7 @@ static void write_pixels_8R8G8B_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2119,7 +2119,7 @@ static void write_pixels_8R8G8B24_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2138,7 +2138,7 @@ static void write_pixels_5R6G5B_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2157,7 +2157,7 @@ static void write_pixels_DITHER_5R6G5B_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2178,7 +2178,7 @@ static void write_pixels_DITHER_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; DITHER_SETUP; for (i=0;i<n;i++) { @@ -2199,7 +2199,7 @@ static void write_pixels_1BIT_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; SETUP_1BIT; for (i=0;i<n;i++) { @@ -2220,7 +2220,7 @@ static void write_pixels_HPCR_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2240,7 +2240,7 @@ static void write_pixels_LOOKUP_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; LOOKUP_SETUP; for (i=0;i<n;i++) { @@ -2260,7 +2260,7 @@ static void write_pixels_GRAYSCALE_pixmap( RGBA_PIXEL_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -2532,21 +2532,56 @@ static void write_pixels_GRAYSCALE8_ximage( RGBA_PIXEL_ARGS ) /**********************************************************************/ #define MONO_SPAN_ARGS const GLcontext *ctx, \ - GLuint n, GLint x, GLint y, const GLubyte mask[] + GLuint n, GLint x, GLint y, const GLchan color[4], \ + const GLubyte mask[] /* - * Write a span of identical pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index(). + * Write a span of identical pixels to a pixmap. */ static void write_span_mono_pixmap( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc1; + XMesaGC gc = xmesa->xm_buffer->gc; + const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); + register GLboolean write_all; register GLuint i; + XMesaSetForeground( xmesa->display, gc, pixel ); + y = FLIP(xmesa->xm_buffer, y); + write_all = GL_TRUE; + for (i=0;i<n;i++) { + if (!mask[i]) { + write_all = GL_FALSE; + break; + } + } + if (write_all) { + XMesaFillRectangle( dpy, buffer, gc, (int) x, (int) y, n, 1 ); + } + else { + for (i=0;i<n;i++,x++) { + if (mask[i]) { + XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); + } + } + } +} + + +static void write_span_mono_index_pixmap( const GLcontext *ctx, GLuint n, + GLint x, GLint y, GLuint colorIndex, + const GLubyte mask[] ) +{ + const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaDrawable buffer = xmesa->xm_buffer->buffer; + XMesaGC gc = xmesa->xm_buffer->gc; register GLboolean write_all; + register GLuint i; + XMesaSetForeground( xmesa->display, gc, colorIndex ); y = FLIP(xmesa->xm_buffer, y); write_all = GL_TRUE; for (i=0;i<n;i++) { @@ -2568,22 +2603,19 @@ static void write_span_mono_pixmap( MONO_SPAN_ARGS ) } + /* - * Write a span of PF_TRUEDITHER pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index(). + * Write a span of PF_TRUEDITHER pixels to a pixmap. */ static void write_span_mono_TRUEDITHER_pixmap( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - register GLubyte r, g, b; int yy = FLIP(xmesa->xm_buffer, y); - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++,x++) { if (mask[i]) { unsigned long p; @@ -2596,22 +2628,18 @@ static void write_span_mono_TRUEDITHER_pixmap( MONO_SPAN_ARGS ) /* - * Write a span of PF_DITHER pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index(). + * Write a span of PF_DITHER pixels to a pixmap. */ static void write_span_mono_DITHER_pixmap( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - register GLubyte r, g, b; int yy = FLIP(xmesa->xm_buffer, y); XDITHER_SETUP(yy); - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaSetForeground( dpy, gc, XDITHER( x, r, g, b ) ); @@ -2622,21 +2650,17 @@ static void write_span_mono_DITHER_pixmap( MONO_SPAN_ARGS ) /* - * Write a span of PF_1BIT pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index(). + * Write a span of PF_1BIT pixels to a pixmap. */ static void write_span_mono_1BIT_pixmap( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - register GLubyte r, g, b; SETUP_1BIT; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++,x++) { if (mask[i]) { @@ -2648,36 +2672,50 @@ static void write_span_mono_1BIT_pixmap( MONO_SPAN_ARGS ) /* - * Write a span of identical pixels to an XImage. The pixel value is - * the one set by DD.color() or DD.index(). + * Write a span of identical pixels to an XImage. */ static void write_span_mono_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; register GLuint i; - register unsigned long p = xmesa->pixel; + const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); + y = FLIP(xmesa->xm_buffer, y); + for (i=0;i<n;i++,x++) { + if (mask[i]) { + XMesaPutPixel( img, x, y, pixel ); + } + } +} + + +static void write_span_mono_index_ximage( const GLcontext *ctx, GLuint n, + GLint x, GLint y, + GLuint colorIndex, + const GLubyte mask[] ) +{ + const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + XMesaImage *img = xmesa->xm_buffer->backimage; + register GLuint i; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++,x++) { if (mask[i]) { - XMesaPutPixel( img, x, y, p ); + XMesaPutPixel( img, x, y, colorIndex ); } } } /* - * Write a span of identical PF_TRUEDITHER pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical PF_TRUEDITHER pixels to an XImage. */ static void write_span_mono_TRUEDITHER_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; + const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; GLuint i; - GLint r = xmesa->red; - GLint g = xmesa->green; - GLint b = xmesa->blue; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++) { if (mask[i]) { @@ -2690,51 +2728,49 @@ static void write_span_mono_TRUEDITHER_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical 8A8B8G8R pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical 8A8B8G8R pixels to an XImage. */ static void write_span_mono_8A8B8G8R_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - GLuint i, p, *ptr; - p = (GLuint) xmesa->pixel; + GLuint i, *ptr; + const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); ptr = PIXELADDR4( xmesa->xm_buffer, x, y ); for (i=0;i<n;i++) { if (mask[i]) { - ptr[i] = p; + ptr[i] = pixel; } } } /* - * Write a span of identical 8R8G8B pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical 8R8G8B pixels to an XImage. */ static void write_span_mono_8R8G8B_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - GLuint i, p, *ptr; - p = (GLuint) xmesa->pixel; - ptr = PIXELADDR4( xmesa->xm_buffer, x, y ); + const GLuint pixel = PACK_8R8G8B(color[RCOMP], color[GCOMP], color[BCOMP]); + GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x, y ); + GLuint i; for (i=0;i<n;i++) { if (mask[i]) { - ptr[i] = p; + ptr[i] = pixel; } } } /* - * Write a span of identical 8R8G8B pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical 8R8G8B pixels to an XImage. */ static void write_span_mono_8R8G8B24_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte r = (GLubyte) ((xmesa->pixel >> 16) & 0xff); - const GLubyte g = (GLubyte) ((xmesa->pixel >> 8 ) & 0xff); - const GLubyte b = (GLubyte) ((xmesa->pixel ) & 0xff); + const GLubyte r = color[RCOMP]; + const GLubyte g = color[GCOMP]; + const GLubyte b = color[BCOMP]; GLuint i; bgr_t *ptr = PIXELADDR3( xmesa->xm_buffer, x, y ); for (i=0;i<n;i++) { @@ -2748,20 +2784,16 @@ static void write_span_mono_8R8G8B24_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical DITHER pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical DITHER pixels to an XImage. */ static void write_span_mono_DITHER_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; XMesaImage *img = xmesa->xm_buffer->backimage; - register GLuint i; - register GLubyte r, g, b; int yy = FLIP(xmesa->xm_buffer, y); + register GLuint i; XDITHER_SETUP(yy); - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++,x++) { if (mask[i]) { XMesaPutPixel( img, x, yy, XDITHER( x, r, g, b ) ); @@ -2771,19 +2803,15 @@ static void write_span_mono_DITHER_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical 8-bit DITHER pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical 8-bit DITHER pixels to an XImage. */ static void write_span_mono_DITHER8_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - register GLuint i; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x,y); - register GLubyte r, g, b; + register GLuint i; XDITHER_SETUP(y); - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++,x++) { if (mask[i]) { ptr[i] = (GLubyte) XDITHER( x, r, g, b ); @@ -2793,15 +2821,16 @@ static void write_span_mono_DITHER8_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical 8-bit LOOKUP pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical 8-bit LOOKUP pixels to an XImage. */ static void write_span_mono_LOOKUP8_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; register GLuint i; register GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x,y); - register GLubyte pixel = (GLubyte) xmesa->pixel; + GLubyte pixel; + LOOKUP_SETUP; + pixel = LOOKUP(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;i<n;i++) { if (mask[i]) { ptr[i] = pixel; @@ -2811,19 +2840,15 @@ static void write_span_mono_LOOKUP8_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical PF_1BIT pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical PF_1BIT pixels to an XImage. */ static void write_span_mono_1BIT_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; XMesaImage *img = xmesa->xm_buffer->backimage; register GLuint i; - register GLubyte r, g, b; SETUP_1BIT; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++,x++) { if (mask[i]) { @@ -2834,18 +2859,14 @@ static void write_span_mono_1BIT_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical HPCR pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical HPCR pixels to an XImage. */ static void write_span_mono_HPCR_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - register GLuint i; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x,y); - register GLubyte r, g, b; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; + register GLuint i; for (i=0;i<n;i++,x++) { if (mask[i]) { ptr[i] = DITHER_HPCR( x, y, r, g, b ); @@ -2855,15 +2876,14 @@ static void write_span_mono_HPCR_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical 8-bit GRAYSCALE pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical 8-bit GRAYSCALE pixels to an XImage. */ static void write_span_mono_GRAYSCALE8_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - GLuint i; - GLubyte p = (GLubyte) xmesa->pixel; + const GLubyte p = GRAY_RGB(color[RCOMP], color[GCOMP], color[BCOMP]); GLubyte *ptr = (GLubyte *) PIXELADDR1( xmesa->xm_buffer,x,y); + GLuint i; for (i=0;i<n;i++) { if (mask[i]) { ptr[i] = p; @@ -2874,17 +2894,14 @@ static void write_span_mono_GRAYSCALE8_ximage( MONO_SPAN_ARGS ) /* - * Write a span of identical PF_DITHER_5R6G5B pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write a span of identical PF_DITHER_5R6G5B pixels to an XImage. */ static void write_span_mono_DITHER_5R6G5B_ximage( MONO_SPAN_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; register GLushort *ptr = PIXELADDR2( xmesa->xm_buffer, x, y ); + const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; GLuint i; - GLint r = xmesa->red; - GLint g = xmesa->green; - GLint b = xmesa->blue; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++) { if (mask[i]) { @@ -2901,69 +2918,86 @@ static void write_span_mono_DITHER_5R6G5B_ximage( MONO_SPAN_ARGS ) #define MONO_PIXEL_ARGS const GLcontext *ctx, \ GLuint n, const GLint x[], const GLint y[], \ - const GLubyte mask[] + const GLchan color[4], const GLubyte mask[] /* - * Write an array of identical pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index. + * Write an array of identical pixels to a pixmap. */ static void write_pixels_mono_pixmap( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc1; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; + const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); + XMesaSetForeground( xmesa->display, gc, pixel ); for (i=0;i<n;i++) { if (mask[i]) { - XMesaDrawPoint( dpy, buffer, gc, (int) x[i], (int) FLIP(xmesa->xm_buffer, y[i]) ); + XMesaDrawPoint( dpy, buffer, gc, + (int) x[i], (int) FLIP(xmesa->xm_buffer, y[i]) ); + } + } +} + + +static void write_pixels_mono_index_pixmap(const GLcontext *ctx, + GLuint n, + const GLint x[], const GLint y[], + GLuint colorIndex, + const GLubyte mask[] ) +{ + const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaDrawable buffer = xmesa->xm_buffer->buffer; + XMesaGC gc = xmesa->xm_buffer->gc; + register GLuint i; + XMesaSetForeground( xmesa->display, gc, colorIndex ); + for (i=0;i<n;i++) { + if (mask[i]) { + XMesaDrawPoint( dpy, buffer, gc, + (int) x[i], (int) FLIP(xmesa->xm_buffer, y[i]) ); } } } /* - * Write an array of PF_TRUEDITHER pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index. + * Write an array of PF_TRUEDITHER pixels to a pixmap. */ static void write_pixels_mono_TRUEDITHER_pixmap( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; - register GLubyte r, g, b; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;i<n;i++) { if (mask[i]) { unsigned long p; PACK_TRUEDITHER(p, x[i], y[i], r, g, b); XMesaSetForeground( dpy, gc, p ); - XMesaDrawPoint( dpy, buffer, gc, (int) x[i], (int) FLIP(xmesa->xm_buffer, y[i]) ); + XMesaDrawPoint( dpy, buffer, gc, + (int) x[i], (int) FLIP(xmesa->xm_buffer, y[i]) ); } } } /* - * Write an array of PF_DITHER pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index. + * Write an array of PF_DITHER pixels to a pixmap. */ static void write_pixels_mono_DITHER_pixmap( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; - register GLubyte r, g, b; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; DITHER_SETUP; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { XMesaSetForeground( dpy, gc, DITHER( x[i], y[i], r, g, b ) ); @@ -2974,21 +3008,17 @@ static void write_pixels_mono_DITHER_pixmap( MONO_PIXEL_ARGS ) /* - * Write an array of PF_1BIT pixels to a pixmap. The pixel value is - * the one set by DD.color() or DD.index. + * Write an array of PF_1BIT pixels to a pixmap. */ static void write_pixels_mono_1BIT_pixmap( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; - register GLubyte r, g, b; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; SETUP_1BIT; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { XMesaSetForeground( dpy, gc, DITHER_1BIT( x[i], y[i], r, g, b ) ); @@ -2999,18 +3029,34 @@ static void write_pixels_mono_1BIT_pixmap( MONO_PIXEL_ARGS ) /* - * Write an array of identical pixels to an XImage. The pixel value is - * the one set by DD.color() or DD.index. + * Write an array of identical pixels to an XImage. */ static void write_pixels_mono_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; register GLuint i; - register unsigned long p = xmesa->pixel; + const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); for (i=0;i<n;i++) { if (mask[i]) { - XMesaPutPixel( img, x[i], FLIP(xmesa->xm_buffer, y[i]), p ); + XMesaPutPixel( img, x[i], FLIP(xmesa->xm_buffer, y[i]), pixel ); + } + } +} + + +static void write_pixels_mono_index_ximage( const GLcontext *ctx, GLuint n, + const GLint x[], const GLint y[], + GLuint colorIndex, + const GLubyte mask[] ) +{ + const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + XMesaImage *img = xmesa->xm_buffer->backimage; + register GLuint i; + for (i=0;i<n;i++) { + if (mask[i]) { + XMesaPutPixel( img, x[i], FLIP(xmesa->xm_buffer, y[i]), colorIndex ); } } } @@ -3018,16 +3064,13 @@ static void write_pixels_mono_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical TRUEDITHER pixels to an XImage. - * The pixel value is the one set by DD.color() or DD.index. */ static void write_pixels_mono_TRUEDITHER_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaImage *img = xmesa->xm_buffer->backimage; register GLuint i; - int r = xmesa->red; - int g = xmesa->green; - int b = xmesa->blue; + const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;i<n;i++) { if (mask[i]) { unsigned long p; @@ -3040,14 +3083,14 @@ static void write_pixels_mono_TRUEDITHER_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical 8A8B8G8R pixels to an XImage. The pixel value - * is the one set by DD.color(). + * Write an array of identical 8A8B8G8R pixels to an XImage */ static void write_pixels_mono_8A8B8G8R_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLuint p = PACK_8A8B8G8R(color[RCOMP], color[GCOMP], + color[BCOMP], color[ACOMP]); register GLuint i; - register GLuint p = (GLuint) xmesa->pixel; for (i=0;i<n;i++) { if (mask[i]) { GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x[i], y[i] ); @@ -3058,14 +3101,13 @@ static void write_pixels_mono_8A8B8G8R_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical 8R8G8B pixels to an XImage. The pixel value - * is the one set by DD.color(). + * Write an array of identical 8R8G8B pixels to an XImage. */ static void write_pixels_mono_8R8G8B_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; register GLuint i; - register GLuint p = (GLuint) xmesa->pixel; + const GLuint p = PACK_8R8G8B(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;i<n;i++) { if (mask[i]) { GLuint *ptr = PIXELADDR4( xmesa->xm_buffer, x[i], y[i] ); @@ -3076,15 +3118,12 @@ static void write_pixels_mono_8R8G8B_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical 8R8G8B pixels to an XImage. The pixel value - * is the one set by DD.color(). + * Write an array of identical 8R8G8B pixels to an XImage. */ static void write_pixels_mono_8R8G8B24_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - const GLubyte r = (GLubyte) ((xmesa->pixel >> 16) & 0xff); - const GLubyte g = (GLubyte) ((xmesa->pixel >> 8 ) & 0xff); - const GLubyte b = (GLubyte) ((xmesa->pixel ) & 0xff); + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -3098,19 +3137,15 @@ static void write_pixels_mono_8R8G8B24_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical PF_DITHER pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write an array of identical PF_DITHER pixels to an XImage. */ static void write_pixels_mono_DITHER_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; XMesaImage *img = xmesa->xm_buffer->backimage; register GLuint i; - register GLubyte r, g, b; DITHER_SETUP; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { XMesaPutPixel( img, x[i], FLIP(xmesa->xm_buffer, y[i]), DITHER( x[i], y[i], r, g, b ) ); @@ -3120,18 +3155,14 @@ static void write_pixels_mono_DITHER_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical 8-bit PF_DITHER pixels to an XImage. The - * pixel value is the one set by DD.color(). + * Write an array of identical 8-bit PF_DITHER pixels to an XImage. */ static void write_pixels_mono_DITHER8_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - register GLubyte r, g, b; DITHER_SETUP; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x[i],y[i]); @@ -3142,14 +3173,15 @@ static void write_pixels_mono_DITHER8_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical 8-bit PF_LOOKUP pixels to an XImage. The - * pixel value is the one set by DD.color(). + * Write an array of identical 8-bit PF_LOOKUP pixels to an XImage. */ static void write_pixels_mono_LOOKUP8_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; register GLuint i; - register GLubyte pixel = (GLubyte) xmesa->pixel; + GLubyte pixel; + LOOKUP_SETUP; + pixel = LOOKUP(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;i<n;i++) { if (mask[i]) { GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x[i],y[i]); @@ -3161,39 +3193,32 @@ static void write_pixels_mono_LOOKUP8_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical PF_1BIT pixels to an XImage. The pixel - * value is the one set by DD.color(). + * Write an array of identical PF_1BIT pixels to an XImage. */ static void write_pixels_mono_1BIT_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; XMesaImage *img = xmesa->xm_buffer->backimage; register GLuint i; - register GLubyte r, g, b; SETUP_1BIT; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { - XMesaPutPixel( img, x[i], FLIP(xmesa->xm_buffer, y[i]), DITHER_1BIT( x[i], y[i], r, g, b )); + XMesaPutPixel( img, x[i], FLIP(xmesa->xm_buffer, y[i]), + DITHER_1BIT( x[i], y[i], r, g, b )); } } } /* - * Write an array of identical PF_HPCR pixels to an XImage. The - * pixel value is the one set by DD.color(). + * Write an array of identical PF_HPCR pixels to an XImage. */ static void write_pixels_mono_HPCR_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - register GLubyte r, g, b; - r = xmesa->red; - g = xmesa->green; - b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x[i],y[i]); @@ -3204,14 +3229,13 @@ static void write_pixels_mono_HPCR_ximage( MONO_PIXEL_ARGS ) /* - * Write an array of identical 8-bit PF_GRAYSCALE pixels to an XImage. The - * pixel value is the one set by DD.color(). + * Write an array of identical 8-bit PF_GRAYSCALE pixels to an XImage. */ static void write_pixels_mono_GRAYSCALE8_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; register GLuint i; - register GLubyte p = (GLubyte) xmesa->pixel; + register GLubyte p = GRAY_RGB(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;i<n;i++) { if (mask[i]) { GLubyte *ptr = PIXELADDR1( xmesa->xm_buffer,x[i],y[i]); @@ -3223,15 +3247,12 @@ static void write_pixels_mono_GRAYSCALE8_ximage( MONO_PIXEL_ARGS ) /* * Write an array of identical PF_DITHER_5R6G5B pixels to an XImage. - * The pixel value is the one set by DD.color() or DD.index. */ static void write_pixels_mono_DITHER_5R6G5B_ximage( MONO_PIXEL_ARGS ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; + const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - int r = xmesa->red; - int g = xmesa->green; - int b = xmesa->blue; for (i=0;i<n;i++) { if (mask[i]) { GLushort *ptr = PIXELADDR2( xmesa->xm_buffer, x[i], y[i] ); @@ -3263,7 +3284,7 @@ static void write_span_index_pixmap( INDEX_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++,x++) { @@ -3283,7 +3304,7 @@ static void write_span_index8_pixmap( INDEX8_SPAN_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; y = FLIP(xmesa->xm_buffer, y); for (i=0;i<n;i++,x++) { @@ -3377,7 +3398,7 @@ static void write_pixels_index_pixmap( INDEX_PIXELS_ARGS ) const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; - XMesaGC gc = xmesa->xm_buffer->gc2; + XMesaGC gc = xmesa->xm_buffer->gc; register GLuint i; for (i=0;i<n;i++) { if (mask[i]) { @@ -4207,9 +4228,9 @@ void xmesa_update_span_funcs( GLcontext *ctx ) case PF_INDEX: ctx->Driver.WriteCI32Span = write_span_index_pixmap; ctx->Driver.WriteCI8Span = write_span_index8_pixmap; - ctx->Driver.WriteMonoCISpan = write_span_mono_pixmap; + ctx->Driver.WriteMonoCISpan = write_span_mono_index_pixmap; ctx->Driver.WriteCI32Pixels = write_pixels_index_pixmap; - ctx->Driver.WriteMonoCIPixels = write_pixels_mono_pixmap; + ctx->Driver.WriteMonoCIPixels = write_pixels_mono_index_pixmap; break; case PF_TRUECOLOR: ctx->Driver.WriteRGBASpan = write_span_TRUECOLOR_pixmap; @@ -4313,9 +4334,9 @@ void xmesa_update_span_funcs( GLcontext *ctx ) ctx->Driver.WriteCI8Span = write_span_index8_ximage8; else ctx->Driver.WriteCI8Span = write_span_index8_ximage; - ctx->Driver.WriteMonoCISpan = write_span_mono_ximage; + ctx->Driver.WriteMonoCISpan = write_span_mono_index_ximage; ctx->Driver.WriteCI32Pixels = write_pixels_index_ximage; - ctx->Driver.WriteMonoCIPixels = write_pixels_mono_ximage; + ctx->Driver.WriteMonoCIPixels = write_pixels_mono_index_ximage; break; case PF_TRUECOLOR: /* Generic RGB */ diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index b152e5c8bb..a25d58092b 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1,4 +1,4 @@ -/* $Id: xm_tri.c,v 1.8 2000/11/06 17:28:20 brianp Exp $ */ +/* $Id: xm_tri.c,v 1.9 2000/11/14 17:40:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -53,46 +53,6 @@ /**********************************************************************/ -#if 0 -/* - * Render a triangle into a pixmap, any pixel format, flat shaded and - * no raster ops. - */ -static void flat_pixmap_triangle( GLcontext *ctx, - SWvertex *v0, - SWvertex *v1, - SWvertex *v2 ) -{ - XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - XMesaPoint p[3]; - XMesaGC gc; - - { - unsigned long pixel; - if (xmesa->xm_visual->gl_visual->RGBAflag) { - pixel = xmesa_color_to_pixel( xmesa, - v0->color[0], v0->color[1], - v0->color[2], v0->color[3], - xmesa->pixelformat ); - } - else { - pixel = v0->index; - } - gc = xmesa->xm_buffer->gc2; - XMesaSetForeground( xmesa->display, gc, pixel ); - } - p[0].x = (GLint) (v0->win[0] + 0.5f); - p[0].y = FLIP( xmesa->xm_buffer, (GLint) (v0->win[1] - 0.5f) ); - p[1].x = (GLint) (v1->win[0] + 0.5f); - p[1].y = FLIP( xmesa->xm_buffer, (GLint) (v1->win[1] - 0.5f) ); - p[2].x = (GLint) (v2->win[0] + 0.5f); - p[2].y = FLIP( xmesa->xm_buffer, (GLint) (v2->win[1] - 0.5f) ); - XMesaFillPolygon( xmesa->display, xmesa->xm_buffer->buffer, gc, - p, 3, Convex, CoordModeOrigin ); -} -#endif - - /* * XImage, smooth, depth-buffered, PF_TRUECOLOR triangle. */ @@ -563,7 +523,7 @@ static void flat_8R8G8B_z_triangle( GLcontext *ctx, #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, len = RIGHT-LEFT; \ - (void) fffog; \ + (void) fffog; \ for (i=0;i<len;i++) { \ GLdepth z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ @@ -595,7 +555,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx, #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ GLint i, len = RIGHT-LEFT; \ - (void) fffog; \ + (void) fffog; \ for (i=0;i<len;i++) { \ GLdepth z = FixedToDepth(ffz); \ if (z < zRow[i]) { \ diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 00787b470b..4f7cfdeefc 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -1,4 +1,4 @@ -/* $Id: xmesaP.h,v 1.14 2000/11/05 18:26:12 keithw Exp $ */ +/* $Id: xmesaP.h,v 1.15 2000/11/14 17:40:15 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -142,9 +142,6 @@ struct xmesa_context { GLuint pixelformat; /* Current pixel format */ - GLubyte red, green, blue, alpha; /* current drawing color */ - unsigned long pixel; /* current drawing pixel value */ - GLubyte clearcolor[4]; /* current clearing color */ unsigned long clearpixel; /* current clearing pixel value */ @@ -209,8 +206,7 @@ struct xmesa_buffer { XMesaPixmap stipple_pixmap; /* For polygon stippling */ XMesaGC stipple_gc; /* For polygon stippling */ - XMesaGC gc1; /* GC for infrequent color changes */ - XMesaGC gc2; /* GC for frequent color changes */ + XMesaGC gc; /* scratch GC for span, line, tri drawing */ XMesaGC cleargc; /* GC for clearing the color buffer */ /* The following are here instead of in the XMesaVisual diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index da6aefbdca..9452a0e86c 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,4 +1,4 @@ -/* $Id: dd.h,v 1.40 2000/11/13 20:02:56 keithw Exp $ */ +/* $Id: dd.h,v 1.41 2000/11/14 17:40:13 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -177,19 +177,6 @@ struct dd_function_table { * settings! Software Mesa can do masked clears if the device driver can't. */ - void (*Index)( GLcontext *ctx, GLuint index ); - /* - * Sets current color index for drawing flat-shaded primitives. - * This index should also be used in the "mono" drawing functions. - */ - - void (*Color)( GLcontext *ctx, - GLchan red, GLchan green, GLchan glue, GLchan alpha ); - /* - * Sets current color for drawing flat-shaded primitives. - * This color should also be used in the "mono" drawing functions. - */ - GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer ); /* * Specifies the current buffer for writing. @@ -243,9 +230,8 @@ struct dd_function_table { */ void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[] ); - /* Write a horizontal run of RGBA pixels all with the color last - * specified by the Color function. + const GLchan color[4], const GLubyte mask[] ); + /* Write a horizontal run of RGBA pixels all with the same color. */ void (*WriteRGBAPixels)( const GLcontext *ctx, @@ -256,7 +242,7 @@ struct dd_function_table { void (*WriteMonoRGBAPixels)( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ); + const GLchan color[4], const GLubyte mask[] ); /* Write an array of mono-RGBA pixels at random locations. */ @@ -270,7 +256,7 @@ struct dd_function_table { */ void (*WriteMonoCISpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y, - const GLubyte mask[] ); + GLuint colorIndex, const GLubyte mask[] ); /* Write a horizontal run of color index pixels using the color index * last specified by the Index() function. */ @@ -284,7 +270,7 @@ struct dd_function_table { void (*WriteMonoCIPixels)( const GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], - const GLubyte mask[] ); + GLuint colorIndex, const GLubyte mask[] ); /* Write a random array of color index pixels using the color index * last specified by the Index() function. */ diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 019534710e..591d7d93a4 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,4 +1,4 @@ -/* $Id: s_span.c,v 1.3 2000/11/13 20:02:57 keithw Exp $ */ +/* $Id: s_span.c,v 1.4 2000/11/14 17:40:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -364,7 +364,7 @@ void gl_write_monoindex_span( GLcontext *ctx, } else { /* normal situation: draw to exactly one buffer */ - (*ctx->Driver.WriteMonoCISpan)( ctx, n, x, y, mask ); + (*ctx->Driver.WriteMonoCISpan)( ctx, n, x, y, index, mask ); } } } @@ -713,7 +713,7 @@ void gl_write_monocolor_span( GLcontext *ctx, (const GLchan (*)[4]) rgba, mask ); } else { - (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, mask ); + (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask ); if (swrast->_RasterMask & ALPHABUF_BIT) { _mesa_write_mono_alpha_span( ctx, n, x, y, (GLchan) color[ACOMP], write_all ? Null : mask ); diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 8ca640610e..b71da4f648 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1,4 +1,4 @@ -/* $Id: s_triangle.c,v 1.3 2000/11/13 20:02:57 keithw Exp $ */ +/* $Id: s_triangle.c,v 1.4 2000/11/14 17:40:16 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -74,12 +74,7 @@ static void flat_ci_triangle( GLcontext *ctx, SWvertex *v2 ) { #define INTERP_Z 1 -#define SETUP_CODE \ - GLuint index = v0->index; \ - if (1) { \ - /* set the color index */ \ - (*ctx->Driver.Index)( ctx, index ); \ - } +#define SETUP_CODE #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -95,7 +90,7 @@ static void flat_ci_triangle( GLcontext *ctx, fffog += fdfogdx; \ } \ gl_write_monoindex_span( ctx, n, LEFT, Y, zspan, \ - fogspan, index, GL_POLYGON ); \ + fogspan, v0->index, GL_POLYGON ); \ } \ } @@ -152,15 +147,7 @@ static void flat_rgba_triangle( GLcontext *ctx, #define INTERP_Z 1 #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define SETUP_CODE \ - if (1) { \ - /* set the color */ \ - GLchan r = v0->color[0]; \ - GLchan g = v0->color[1]; \ - GLchan b = v0->color[2]; \ - GLchan a = v0->color[3]; \ - (*ctx->Driver.Color)( ctx, r, g, b, a ); \ - } +#define SETUP_CODE #define INNER_LOOP( LEFT, RIGHT, Y ) \ { \ @@ -176,8 +163,7 @@ static void flat_rgba_triangle( GLcontext *ctx, fffog += fdfogdx; \ } \ gl_write_monocolor_span( ctx, n, LEFT, Y, zspan, \ - fogspan, \ - v0->color, \ + fogspan, v0->color, \ GL_POLYGON ); \ } \ } |