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.
This commit is contained in:
Brian Paul
2000-11-14 17:40:13 +00:00
parent 1e1aac034c
commit c19d783e07
24 changed files with 420 additions and 591 deletions

View File

@@ -981,8 +981,10 @@ void fxSetupDDPointers(GLcontext *ctx)
ctx->Driver.ClearColor=fxDDClearColor; ctx->Driver.ClearColor=fxDDClearColor;
ctx->Driver.Clear=fxDDClear; ctx->Driver.Clear=fxDDClear;
#if 0
ctx->Driver.Index=NULL; ctx->Driver.Index=NULL;
ctx->Driver.Color=fxDDSetColor; ctx->Driver.Color=fxDDSetColor;
#endif
ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer; ctx->Driver.SetDrawBuffer=fxDDSetDrawBuffer;
ctx->Driver.SetReadBuffer=fxDDSetReadBuffer; ctx->Driver.SetReadBuffer=fxDDSetReadBuffer;

View File

@@ -223,12 +223,13 @@ static void fxDDWriteRGBSpan(const GLcontext *ctx,
static void fxDDWriteMonoRGBASpan(const GLcontext *ctx, static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
const GLubyte mask[]) const GLchan color[4], const GLubyte mask[])
{ {
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i; GLuint i;
GLint bottom=fxMesa->height-1; GLint bottom=fxMesa->height-1;
GLuint data[MAX_WIDTH]; GLuint data[MAX_WIDTH];
GrColor_t gColor = FXCOLOR4(color);
if (MESA_VERBOSE&VERBOSE_DRIVER) { if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n"); fprintf(stderr,"fxmesa: fxDDWriteMonoRGBASpan(...)\n");
@@ -239,7 +240,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
for (i=0;i<n;i++) { for (i=0;i<n;i++) {
if (mask[i]) { if (mask[i]) {
data[span] = (GLuint) fxMesa->color; data[span] = (GLuint) gColor;
++span; ++span;
} else { } else {
if (span > 0) { if (span > 0) {
@@ -257,7 +258,7 @@ static void fxDDWriteMonoRGBASpan(const GLcontext *ctx,
(void *) data ); (void *) data );
} else { } else {
for (i=0;i<n;i++) { 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, 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, static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], GLuint n, const GLint x[], const GLint y[],
const GLubyte mask[]) const GLchan color[4], const GLubyte mask[])
{ {
fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx; fxMesaContext fxMesa=(fxMesaContext)ctx->DriverCtx;
GLuint i; GLuint i;
GLint bottom=fxMesa->height-1; GLint bottom=fxMesa->height-1;
GrColor_t gColor = FXCOLOR4(color);
if (MESA_VERBOSE&VERBOSE_DRIVER) { if (MESA_VERBOSE&VERBOSE_DRIVER) {
fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n"); fprintf(stderr,"fxmesa: fxDDWriteMonoRGBAPixels(...)\n");
@@ -385,7 +387,7 @@ static void fxDDWriteMonoRGBAPixels(const GLcontext *ctx,
for(i=0;i<n;i++) for(i=0;i<n;i++)
if(mask[i]) if(mask[i])
writeRegionClipped(fxMesa, fxMesa->currentFB,x[i],bottom-y[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);
} }

View File

@@ -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 * 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 *****/ /***** 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 ) static void clear_index( GLcontext *ctx, GLuint index )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
osmesa->clearpixel = index; osmesa->clearpixel = index;
} }
@@ -646,7 +650,7 @@ static void clear_index( GLcontext *ctx, GLuint index )
static void clear_color( GLcontext *ctx, static void clear_color( GLcontext *ctx,
GLchan r, GLchan g, GLchan b, GLchan a ) 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 ); 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, static GLbitfield clear( GLcontext *ctx, GLbitfield mask, GLboolean all,
GLint x, GLint y, GLint width, GLint height ) GLint x, GLint y, GLint width, GLint height )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask; const GLuint *colorMask = (GLuint *) &ctx->Color.ColorMask;
/* we can't handle color or index masking */ /* 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 ) static void set_index( GLcontext *ctx, GLuint index )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
osmesa->pixel = index; osmesa->pixel = index;
} }
@@ -760,7 +764,7 @@ static void set_index( GLcontext *ctx, GLuint index )
static void set_color( GLcontext *ctx, static void set_color( GLcontext *ctx,
GLchan r, GLchan g, GLchan b, GLchan a ) 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 ); 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 ) static void buffer_size( GLcontext *ctx, GLuint *width, GLuint *height )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
*width = osmesa->width; *width = osmesa->width;
*height = osmesa->height; *height = osmesa->height;
} }
@@ -783,7 +787,7 @@ static void write_rgba_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
CONST GLchan rgba[][4], const GLubyte mask[] ) CONST GLchan rgba[][4], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint *ptr4 = PIXELADDR4( x, y ); GLuint *ptr4 = PIXELADDR4( x, y );
GLuint i; GLuint i;
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
@@ -811,7 +815,7 @@ static void write_rgba_span_rgba( const GLcontext *ctx,
CONST GLchan rgba[][4], CONST GLchan rgba[][4],
const GLubyte mask[] ) const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint *ptr4 = PIXELADDR4( x, y ); GLuint *ptr4 = PIXELADDR4( x, y );
const GLuint *rgba4 = (const GLuint *) rgba; const GLuint *rgba4 = (const GLuint *) rgba;
GLuint i; GLuint i;
@@ -833,7 +837,7 @@ static void write_rgb_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
CONST GLchan rgb[][3], const GLubyte mask[] ) CONST GLchan rgb[][3], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint *ptr4 = PIXELADDR4( x, y ); GLuint *ptr4 = PIXELADDR4( x, y );
GLuint i; GLuint i;
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
@@ -858,14 +862,16 @@ static void write_rgb_span( const GLcontext *ctx,
static void write_monocolor_span( const GLcontext *ctx, static void write_monocolor_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, 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 *ptr4 = PIXELADDR4(x,y);
GLuint i; GLuint i;
for (i=0;i<n;i++,ptr4++) { for (i=0;i<n;i++,ptr4++) {
if (mask[i]) { 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[], GLuint n, const GLint x[], const GLint y[],
CONST GLchan rgba[][4], const GLubyte mask[] ) CONST GLchan rgba[][4], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
GLint gshift = osmesa->gshift; GLint gshift = osmesa->gshift;
@@ -894,14 +900,17 @@ static void write_rgba_pixels( const GLcontext *ctx,
static void write_monocolor_pixels( const GLcontext *ctx, static void write_monocolor_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], 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; GLuint i;
for (i=0;i<n;i++) { for (i=0;i<n;i++) {
if (mask[i]) { if (mask[i]) {
GLuint *ptr4 = PIXELADDR4(x[i],y[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, static void read_rgba_span( const GLcontext *ctx, GLuint n, GLint x, GLint y,
GLchan rgba[][4] ) GLchan rgba[][4] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
GLuint *ptr4 = PIXELADDR4(x,y); GLuint *ptr4 = PIXELADDR4(x,y);
for (i=0;i<n;i++) { 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, GLuint n, GLint x, GLint y,
GLchan rgba[][4] ) GLchan rgba[][4] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint *ptr4 = PIXELADDR4(x,y); GLuint *ptr4 = PIXELADDR4(x,y);
MEMCPY( rgba, ptr4, n * 4 * sizeof(GLchan) ); 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[], GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] ) GLchan rgba[][4], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
for (i=0;i<n;i++) { for (i=0;i<n;i++) {
if (mask[i]) { if (mask[i]) {
@@ -961,7 +970,7 @@ static void write_rgba_span3( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
CONST GLchan rgba[][4], const GLubyte mask[] ) CONST GLchan rgba[][4], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *ptr3 = PIXELADDR3( x, y); GLubyte *ptr3 = PIXELADDR3( x, y);
GLuint i; GLuint i;
GLint rind = osmesa->rind; GLint rind = osmesa->rind;
@@ -990,12 +999,12 @@ static void write_rgb_span3( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
CONST GLchan rgb[][3], const GLubyte mask[] ) 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); GLubyte *ptr3 = PIXELADDR3( x, y);
GLuint i; GLuint i;
GLint rind = osmesa->rind;
GLint gind = osmesa->gind;
GLint bind = osmesa->bind;
if (mask) { if (mask) {
for (i=0;i<n;i++,ptr3+=3) { for (i=0;i<n;i++,ptr3+=3) {
if (mask[i]) { if (mask[i]) {
@@ -1016,17 +1025,16 @@ static void write_rgb_span3( const GLcontext *ctx,
static void write_monocolor_span3( const GLcontext *ctx, static void write_monocolor_span3( const GLcontext *ctx,
GLuint n, GLint x, GLint y, 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 GLubyte rval = color[RCOMP];
GLubyte rval = UNPACK_RED(osmesa->pixel); const GLubyte gval = color[GCOMP];
GLubyte gval = UNPACK_GREEN(osmesa->pixel); const GLubyte bval = color[BCOMP];
GLubyte bval = UNPACK_BLUE(osmesa->pixel); const GLint rind = osmesa->rind;
GLint rind = osmesa->rind; const GLint gind = osmesa->gind;
GLint gind = osmesa->gind; const GLint bind = osmesa->bind;
GLint bind = osmesa->bind;
GLubyte *ptr3 = PIXELADDR3( x, y); GLubyte *ptr3 = PIXELADDR3( x, y);
GLuint i; GLuint i;
for (i=0;i<n;i++,ptr3+=3) { 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[], GLuint n, const GLint x[], const GLint y[],
CONST GLchan rgba[][4], const GLubyte mask[] ) CONST GLchan rgba[][4], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; const OSMesaContext osmesa = (const OSMesaContext) ctx;
GLuint i; GLuint i;
GLint rind = osmesa->rind; GLint rind = osmesa->rind;
GLint gind = osmesa->gind; GLint gind = osmesa->gind;
@@ -1058,17 +1066,19 @@ static void write_rgba_pixels3( const GLcontext *ctx,
} }
static void write_monocolor_pixels3( const GLcontext *ctx, static void write_monocolor_pixels3( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], GLuint n, const GLint x[],
const GLubyte mask[] ) 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; 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++) { for (i=0;i<n;i++) {
if (mask[i]) { if (mask[i]) {
GLubyte *ptr3 = PIXELADDR3(x[i],y[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, GLuint n, GLint x, GLint y,
GLchan rgba[][4] ) GLchan rgba[][4] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
GLint rind = osmesa->rind; GLint rind = osmesa->rind;
GLint gind = osmesa->gind; GLint gind = osmesa->gind;
@@ -1101,7 +1111,7 @@ static void read_rgba_pixels3( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], GLuint n, const GLint x[], const GLint y[],
GLchan rgba[][4], const GLubyte mask[] ) GLchan rgba[][4], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
GLint rind = osmesa->rind; GLint rind = osmesa->rind;
GLint gind = osmesa->gind; GLint gind = osmesa->gind;
@@ -1127,7 +1137,7 @@ static void write_index32_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
const GLuint index[], const GLubyte mask[] ) const GLuint index[], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *ptr1 = PIXELADDR1(x,y); GLubyte *ptr1 = PIXELADDR1(x,y);
GLuint i; GLuint i;
if (mask) { if (mask) {
@@ -1150,7 +1160,7 @@ static void write_index8_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
const GLubyte index[], const GLubyte mask[] ) const GLubyte index[], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *ptr1 = PIXELADDR1(x,y); GLubyte *ptr1 = PIXELADDR1(x,y);
GLuint i; GLuint i;
if (mask) { if (mask) {
@@ -1168,14 +1178,14 @@ static void write_index8_span( const GLcontext *ctx,
static void write_monoindex_span( const GLcontext *ctx, static void write_monoindex_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, 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); GLubyte *ptr1 = PIXELADDR1(x,y);
GLuint i; GLuint i;
for (i=0;i<n;i++,ptr1++) { for (i=0;i<n;i++,ptr1++) {
if (mask[i]) { 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[], GLuint n, const GLint x[], const GLint y[],
const GLuint index[], const GLubyte mask[] ) const GLuint index[], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
for (i=0;i<n;i++) { for (i=0;i<n;i++) {
if (mask[i]) { if (mask[i]) {
@@ -1198,14 +1208,14 @@ static void write_index_pixels( const GLcontext *ctx,
static void write_monoindex_pixels( const GLcontext *ctx, static void write_monoindex_pixels( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], 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; GLuint i;
for (i=0;i<n;i++) { for (i=0;i<n;i++) {
if (mask[i]) { if (mask[i]) {
GLubyte *ptr1 = PIXELADDR1(x[i],y[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, static void read_index_span( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint index[] ) GLuint n, GLint x, GLint y, GLuint index[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
const GLubyte *ptr1 = PIXELADDR1(x,y); const GLubyte *ptr1 = PIXELADDR1(x,y);
for (i=0;i<n;i++,ptr1++) { 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 n, const GLint x[], const GLint y[],
GLuint index[], const GLubyte mask[] ) GLuint index[], const GLubyte mask[] )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLuint i; GLuint i;
for (i=0;i<n;i++) { for (i=0;i<n;i++) {
if (mask[i] ) { if (mask[i] ) {
@@ -1250,7 +1260,7 @@ static void read_index_pixels( const GLcontext *ctx,
static void flat_rgba_line( GLcontext *ctx, static void flat_rgba_line( GLcontext *ctx,
SWvertex *vert0, SWvertex *vert1 ) SWvertex *vert0, SWvertex *vert1 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *color = vert0->color; GLubyte *color = vert0->color;
unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); 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, static void flat_rgba_z_line( GLcontext *ctx,
SWvertex *vert0, SWvertex *vert1 ) SWvertex *vert0, SWvertex *vert1 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLubyte *color = vert0->color; GLubyte *color = vert0->color;
unsigned long pixel = PACK_RGBA( color[0], color[1], color[2], color[3] ); 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, static void flat_blend_rgba_line( GLcontext *ctx,
SWvertex *vert0, SWvertex *vert1 ) SWvertex *vert0, SWvertex *vert1 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
GLint gshift = osmesa->gshift; GLint gshift = osmesa->gshift;
GLint bshift = osmesa->bshift; 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, static void flat_blend_rgba_z_line( GLcontext *ctx,
SWvertex *vert0, SWvertex *vert1 ) SWvertex *vert0, SWvertex *vert1 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
GLint gshift = osmesa->gshift; GLint gshift = osmesa->gshift;
GLint bshift = osmesa->bshift; 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, static void flat_blend_rgba_z_line_write( GLcontext *ctx,
SWvertex *vert0, SWvertex *vert1 ) SWvertex *vert0, SWvertex *vert1 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
GLint gshift = osmesa->gshift; GLint gshift = osmesa->gshift;
GLint bshift = osmesa->bshift; GLint bshift = osmesa->bshift;
@@ -1414,7 +1424,7 @@ static void flat_blend_rgba_z_line_write( GLcontext *ctx,
static swrast_line_func static swrast_line_func
osmesa_choose_line_function( GLcontext *ctx ) osmesa_choose_line_function( GLcontext *ctx )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
SWcontext *swrast = SWRAST_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx);
if (ctx->RenderMode != GL_RENDER) return NULL; 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, static void smooth_rgba_z_triangle( GLcontext *ctx,
SWvertex *v0, SWvertex *v1, SWvertex *v2 ) SWvertex *v0, SWvertex *v1, SWvertex *v2 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
GLint rshift = osmesa->rshift; GLint rshift = osmesa->rshift;
GLint gshift = osmesa->gshift; GLint gshift = osmesa->gshift;
GLint bshift = osmesa->bshift; GLint bshift = osmesa->bshift;
@@ -1562,7 +1572,7 @@ static void smooth_rgba_z_triangle( GLcontext *ctx,
static void flat_rgba_z_triangle( GLcontext *ctx, static void flat_rgba_z_triangle( GLcontext *ctx,
SWvertex *v0, SWvertex *v1, SWvertex *v2 ) SWvertex *v0, SWvertex *v1, SWvertex *v2 )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
#define INTERP_Z 1 #define INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \ #define SETUP_CODE \
@@ -1601,7 +1611,7 @@ static void flat_rgba_z_triangle( GLcontext *ctx,
static swrast_tri_func static swrast_tri_func
osmesa_choose_triangle_function( GLcontext *ctx ) osmesa_choose_triangle_function( GLcontext *ctx )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
SWcontext *swrast = SWRAST_CONTEXT(ctx); SWcontext *swrast = SWRAST_CONTEXT(ctx);
if ((osmesa->format==OSMESA_RGB)||(osmesa->format==OSMESA_BGR)) 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 ) static void osmesa_update_state( GLcontext *ctx )
{ {
OSMesaContext osmesa = (OSMesaContext) ctx; OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
ASSERT((void *) osmesa == (void *) ctx->DriverCtx); 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.SetDrawBuffer = set_draw_buffer;
ctx->Driver.SetReadBuffer = set_read_buffer; ctx->Driver.SetReadBuffer = set_read_buffer;
#if 000
ctx->Driver.Color = set_color; ctx->Driver.Color = set_color;
ctx->Driver.Index = set_index; ctx->Driver.Index = set_index;
#endif
ctx->Driver.ClearIndex = clear_index; ctx->Driver.ClearIndex = clear_index;
ctx->Driver.ClearColor = clear_color; ctx->Driver.ClearColor = clear_color;
ctx->Driver.Clear = clear; ctx->Driver.Clear = clear;

View File

@@ -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 * Mesa 3-D graphics library
@@ -291,7 +291,6 @@ static void svgamesa_update_state( GLcontext *ctx )
switch (SVGABuffer.Depth) { switch (SVGABuffer.Depth) {
case 8: ctx->Driver.ClearIndex = __clear_index8; case 8: ctx->Driver.ClearIndex = __clear_index8;
ctx->Driver.Clear = __clear8; ctx->Driver.Clear = __clear8;
ctx->Driver.Index = __set_index8;
ctx->Driver.ReadCI32Span = __read_ci32_span8; ctx->Driver.ReadCI32Span = __read_ci32_span8;
ctx->Driver.ReadCI32Pixels = __read_ci32_pixels8; ctx->Driver.ReadCI32Pixels = __read_ci32_pixels8;
@@ -307,7 +306,6 @@ static void svgamesa_update_state( GLcontext *ctx )
break; break;
case 15: ctx->Driver.ClearColor = __clear_color15; case 15: ctx->Driver.ClearColor = __clear_color15;
ctx->Driver.Clear = __clear15; ctx->Driver.Clear = __clear15;
ctx->Driver.Color = __set_color15;
ctx->Driver.ReadRGBASpan = __read_rgba_span15; ctx->Driver.ReadRGBASpan = __read_rgba_span15;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels15; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels15;
@@ -321,7 +319,6 @@ static void svgamesa_update_state( GLcontext *ctx )
break; break;
case 16: ctx->Driver.ClearColor = __clear_color16; case 16: ctx->Driver.ClearColor = __clear_color16;
ctx->Driver.Clear = __clear16; ctx->Driver.Clear = __clear16;
ctx->Driver.Color = __set_color16;
ctx->Driver.ReadRGBASpan = __read_rgba_span16; ctx->Driver.ReadRGBASpan = __read_rgba_span16;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels16; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels16;
@@ -335,7 +332,6 @@ static void svgamesa_update_state( GLcontext *ctx )
#endif #endif
case 24: ctx->Driver.ClearColor = __clear_color24; case 24: ctx->Driver.ClearColor = __clear_color24;
ctx->Driver.Clear = __clear24; ctx->Driver.Clear = __clear24;
ctx->Driver.Color = __set_color24;
ctx->Driver.ReadRGBASpan = __read_rgba_span24; ctx->Driver.ReadRGBASpan = __read_rgba_span24;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels24; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels24;
@@ -349,7 +345,6 @@ static void svgamesa_update_state( GLcontext *ctx )
#endif #endif
case 32: ctx->Driver.ClearColor = __clear_color32; case 32: ctx->Driver.ClearColor = __clear_color32;
ctx->Driver.Clear = __clear32; ctx->Driver.Clear = __clear32;
ctx->Driver.Color = __set_color32;
ctx->Driver.ReadRGBASpan = __read_rgba_span32; ctx->Driver.ReadRGBASpan = __read_rgba_span32;
ctx->Driver.ReadRGBAPixels = __read_rgba_pixels32; ctx->Driver.ReadRGBAPixels = __read_rgba_pixels32;
@@ -429,9 +424,6 @@ SVGAMesaContext SVGAMesaCreateContext( GLboolean doubleBuffer )
ctx->gl_vis->AccumRedBits > 0, ctx->gl_vis->AccumRedBits > 0,
ctx->gl_vis->AlphaBits > 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" */ ctx->width = ctx->height = 0; /* temporary until first "make-current" */
#endif #endif
return ctx; return ctx;

View File

@@ -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 * Mesa 3-D graphics library
@@ -54,14 +54,6 @@ static unsigned long __svga_getpixel15(int x, int y)
return shortBuffer[offset]; 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, void __clear_color15( GLcontext *ctx,
GLubyte red, GLubyte green, GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha ) 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, void __write_mono_rgba_span15( const GLcontext *ctx,
GLuint n, GLint x, GLint y, 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; int i;
for (i=0; i<n; i++, x++) { for (i=0; i<n; i++, x++) {
if (mask[i]) { 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, void __write_mono_rgba_pixels15( const GLcontext *ctx,
GLuint n, GLuint n,
const GLint x[], const GLint y[], 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; int i;
/* use current rgb color */ /* use current rgb color */
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (mask[i]) { if (mask[i]) {
__svga_drawpixel15( x[i], y[i], SVGAMesa->hicolor ); __svga_drawpixel15( x[i], y[i], hicolor );
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -31,14 +31,13 @@
#ifndef SVGA_MESA_15_H #ifndef SVGA_MESA_15_H
#define 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 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 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_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 __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_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[] ); 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 */ #endif /* SVGA_MESA_15_H */

View File

@@ -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 * Mesa 3-D graphics library
@@ -56,14 +56,6 @@ static unsigned long __svga_getpixel16(int x, int y)
return shortBuffer[offset]; 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, void __clear_color16( GLcontext *ctx,
GLubyte red, GLubyte green, GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha ) 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, void __write_mono_rgba_span16( const GLcontext *ctx,
GLuint n, GLint x, GLint y, 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; int i;
for (i=0; i<n; i++, x++) { for (i=0; i<n; i++, x++) {
if (mask[i]) { 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, void __write_mono_rgba_pixels16( const GLcontext *ctx,
GLuint n, GLuint n,
const GLint x[], const GLint y[], 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; int i;
/* use current rgb color */
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (mask[i]) { if (mask[i]) {
__svga_drawpixel16( x[i], y[i], SVGAMesa->hicolor ); __svga_drawpixel16( x[i], y[i], hicolor );
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -31,14 +31,13 @@
#ifndef SVGA_MESA_16_H #ifndef SVGA_MESA_16_H
#define 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 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 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_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 __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_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[] ); 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 */ #endif /* SVGA_MESA_16_H */

View File

@@ -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 * 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; 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, void __clear_color24( GLcontext *ctx,
GLubyte red, GLubyte green, GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha ) 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, void __write_mono_rgba_span24( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
const GLubyte mask[]) const GLchan color[4], const GLubyte mask[])
{ {
int i; int i;
for (i=0; i<n; i++, x++) { for (i=0; i<n; i++, x++) {
if (mask[i]) { if (mask[i]) {
__svga_drawpixel24( x, y, SVGAMesa->red, __svga_drawpixel24( x, y, color[RCOMP], color[GCOMP], color[BCOMP]);
SVGAMesa->green,
SVGAMesa->blue);
} }
} }
} }
@@ -210,15 +198,13 @@ void __write_rgba_pixels24( const GLcontext *ctx,
void __write_mono_rgba_pixels24( const GLcontext *ctx, void __write_mono_rgba_pixels24( const GLcontext *ctx,
GLuint n, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLubyte mask[] ) const GLchan color[4], const GLubyte mask[] )
{ {
int i; int i;
/* use current rgb color */
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (mask[i]) { if (mask[i]) {
__svga_drawpixel24( x[i], y[i], SVGAMesa->red, __svga_drawpixel24( x[i], y[i],
SVGAMesa->green, color[RCOMP], color[GCOMP], color[BCOMP] );
SVGAMesa->blue);
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -31,14 +31,13 @@
#ifndef SVGA_MESA_24_H #ifndef SVGA_MESA_24_H
#define 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 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 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_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 __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_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[] ); 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 */ #endif /* SVGA_MESA_24_H */

View File

@@ -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 * Mesa 3-D graphics library
@@ -74,16 +74,6 @@ static unsigned long __svga_getpixel32(int x, int y)
return intBuffer[offset]; 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, void __clear_color32( GLcontext *ctx,
GLubyte red, GLubyte green, GLubyte red, GLubyte green,
GLubyte blue, GLubyte alpha ) 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, void __write_mono_rgba_span32( const GLcontext *ctx,
GLuint n, GLint x, GLint y, GLuint n, GLint x, GLint y,
const GLubyte mask[]) const GLchan color[4], const GLubyte mask[])
{ {
int i; int i;
GLuint truecolor = color[RCOMP]<<16 | color[GCOMP]<<8 | color[BCOMP];
for (i=0; i<n; i++, x++) { for (i=0; i<n; i++, x++) {
if (mask[i]) { 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, void __write_mono_rgba_pixels32( const GLcontext *ctx,
GLuint n, GLuint n,
const GLint x[], const GLint y[], 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; int i;
/* use current rgb color */
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (mask[i]) { if (mask[i]) {
__svga_drawpixel32( x[i], y[i], SVGAMesa->truecolor ); __svga_drawpixel32( x[i], y[i], truecolor );
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -31,14 +31,13 @@
#ifndef SVGA_MESA_32_H #ifndef SVGA_MESA_32_H
#define 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 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 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_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 __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_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[] ); 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 */ #endif /* SVGA_MESA_32_H */

View File

@@ -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 * Mesa 3-D graphics library
@@ -53,11 +53,6 @@ static unsigned long __svga_getpixel8(int x, int y)
return SVGABuffer.ReadBuffer[offset]; return SVGABuffer.ReadBuffer[offset];
} }
void __set_index8( GLcontext *ctx, GLuint index )
{
SVGAMesa->index = index;
}
void __clear_index8( GLcontext *ctx, GLuint index ) void __clear_index8( GLcontext *ctx, GLuint index )
{ {
SVGAMesa->clear_index = 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, 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; int i;
for (i=0;i<n;i++,x++) { for (i=0;i<n;i++,x++) {
if (mask[i]) { 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, void __write_mono_ci_pixels8( const GLcontext *ctx, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLubyte mask[] ) GLuint colorIndex, const GLubyte mask[] )
{ {
int i; int i;
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (mask[i]) { if (mask[i]) {
__svga_drawpixel8( x[i], y[i], SVGAMesa->index); __svga_drawpixel8( x[i], y[i], colorIndex);
} }
} }
} }

View File

@@ -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 * Mesa 3-D graphics library
@@ -31,15 +31,14 @@
#ifndef SVGA_MESA_8_H #ifndef SVGA_MESA_8_H
#define 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 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 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_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_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 __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_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[] ); 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 */ #endif /* SVGA_MESA_15_H */

View File

@@ -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 * 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 ) static void enable( GLcontext* ctx, GLenum pname, GLboolean enable )
{ {
if (!Current) if (!Current)
@@ -766,7 +747,7 @@ static void write_ci8_span( const GLcontext* ctx,
*/ */
static void write_mono_ci_span(const GLcontext* ctx, static void write_mono_ci_span(const GLcontext* ctx,
GLuint n,GLint x,GLint y, GLuint n,GLint x,GLint y,
const GLubyte mask[]) GLuint colorIndex, const GLubyte mask[])
{ {
STARTPROFILE STARTPROFILE
GLuint i; GLuint i;
@@ -774,7 +755,7 @@ static void write_mono_ci_span(const GLcontext* ctx,
assert(Current->rgb_flag==GL_FALSE); assert(Current->rgb_flag==GL_FALSE);
for (i=0; i<n; i++) for (i=0; i<n; i++)
if (mask[i]) if (mask[i])
Mem[i]=Current->pixel; Mem[i]=colorIndex;
ENDPROFILE(write_mono_ci_span) 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, static void write_mono_rgba_span( const GLcontext* ctx,
GLuint n, GLint x, GLint y, 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 STARTPROFILE
GLuint i; GLuint i;
HDC DC=DD_GETDC; HDC DC=DD_GETDC;
@@ -886,12 +868,12 @@ static void write_mono_rgba_span( const GLcontext* ctx,
for (i=0; i<n; i++) for (i=0; i<n; i++)
if (mask[i]) if (mask[i])
// Trying // 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 { else {
for (i=0; i<n; i++) for (i=0; i<n; i++)
if (mask[i]) if (mask[i])
SetPixel(DC, y, x+i, Current->pixel); SetPixel(DC, y, x+i, pixel);
} }
DD_RELEASEDC; DD_RELEASEDC;
ENDPROFILE(write_mono_rgba_span) 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, static void write_mono_ci_pixels( const GLcontext* ctx,
GLuint n, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLubyte mask[] ) GLuint colorIndex, const GLubyte mask[] )
{ {
STARTPROFILE STARTPROFILE
GLuint i; GLuint i;
@@ -938,7 +920,7 @@ static void write_mono_ci_pixels( const GLcontext* ctx,
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
if (mask[i]) { if (mask[i]) {
BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i]; BYTE *Mem=Current->ScreenMem+FLIP(y[i])*Current->ScanWidth+x[i];
*Mem = Current->pixel; *Mem = colorIndex;
} }
} }
ENDPROFILE(write_mono_ci_pixels) ENDPROFILE(write_mono_ci_pixels)
@@ -958,7 +940,8 @@ static void write_rgba_pixels( const GLcontext* ctx,
assert(Current->rgb_flag==GL_TRUE); assert(Current->rgb_flag==GL_TRUE);
for (i=0; i<n; i++) for (i=0; i<n; i++)
if (mask[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; DD_RELEASEDC;
ENDPROFILE(write_rgba_pixels) 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, static void write_mono_rgba_pixels( const GLcontext* ctx,
GLuint n, GLuint n,
const GLint x[], const GLint y[], const GLint x[], const GLint y[],
const GLchan color[4],
const GLubyte mask[] ) const GLubyte mask[] )
{ {
STARTPROFILE STARTPROFILE
@@ -981,8 +965,8 @@ static void write_mono_rgba_pixels( const GLcontext* ctx,
assert(Current->rgb_flag==GL_TRUE); assert(Current->rgb_flag==GL_TRUE);
for (i=0; i<n; i++) for (i=0; i<n; i++)
if (mask[i]) if (mask[i])
wmSetPixel(pwc, FLIP(y[i]),x[i],GetRValue(Current->pixel), wmSetPixel(pwc, FLIP(y[i]),x[i],color[RCOMP],
GetGValue(Current->pixel), GetBValue(Current->pixel)); color[GCOMP], color[BCOMP]);
DD_RELEASEDC; DD_RELEASEDC;
ENDPROFILE(write_mono_rgba_pixels) ENDPROFILE(write_mono_rgba_pixels)
} }
@@ -1109,9 +1093,6 @@ void setup_DD_pointers( GLcontext* ctx )
ctx->Driver.ClearColor = clear_color; ctx->Driver.ClearColor = clear_color;
ctx->Driver.Clear = clear; ctx->Driver.Clear = clear;
ctx->Driver.Index = set_index;
ctx->Driver.Color = set_color;
ctx->Driver.Enable = enable; ctx->Driver.Enable = enable;
ctx->Driver.SetDrawBuffer = set_draw_buffer; ctx->Driver.SetDrawBuffer = set_draw_buffer;

View File

@@ -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 * Mesa 3-D graphics library
@@ -1295,14 +1295,11 @@ static GLboolean initialize_visual_and_buffer( int client,
/* X11 graphics contexts */ /* X11 graphics contexts */
#ifdef XFree86Server #ifdef XFree86Server
b->gc1 = CreateScratchGC(v->display, window->depth); b->gc = CreateScratchGC(v->display, window->depth);
b->gc2 = CreateScratchGC(v->display, window->depth);
#else #else
b->gc1 = XCreateGC( v->display, window, 0, NULL ); b->gc = XCreateGC( v->display, window, 0, NULL );
b->gc2 = XCreateGC( v->display, window, 0, NULL );
#endif #endif
XMesaSetFunction( v->display, b->gc1, GXcopy ); XMesaSetFunction( v->display, b->gc, GXcopy );
XMesaSetFunction( v->display, b->gc2, GXcopy );
/* /*
* Don't generate Graphics Expose/NoExpose events in swapbuffers(). * Don't generate Graphics Expose/NoExpose events in swapbuffers().
@@ -1993,8 +1990,7 @@ void XMesaDestroyBuffer( XMesaBuffer b )
client = CLIENT_ID(b->frontbuffer->id); client = CLIENT_ID(b->frontbuffer->id);
#endif #endif
if (b->gc1) XMesaFreeGC( b->xm_visual->display, b->gc1 ); if (b->gc) XMesaFreeGC( b->xm_visual->display, b->gc );
if (b->gc2) XMesaFreeGC( b->xm_visual->display, b->gc2 );
if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc ); if (b->cleargc) XMesaFreeGC( b->xm_visual->display, b->cleargc );
if (b->backimage) { if (b->backimage) {
@@ -2099,9 +2095,6 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
* Must recompute and set these pixel values because colormap * Must recompute and set these pixel values because colormap
* can be different for different windows. * 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->clearpixel = xmesa_color_to_pixel( c,
c->clearcolor[0], c->clearcolor[0],
c->clearcolor[1], c->clearcolor[1],

View File

@@ -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 * 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 */ /* Set index mask ala glIndexMask */
static void static void
index_mask( GLcontext *ctx, GLuint mask ) index_mask( GLcontext *ctx, GLuint mask )
@@ -807,7 +780,7 @@ drawpixels_8R8G8B( GLcontext *ctx,
const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDisplay *dpy = xmesa->xm_visual->display;
XMesaDrawable buffer = xmesa->xm_buffer->buffer; XMesaDrawable buffer = xmesa->xm_buffer->buffer;
XMesaGC gc = xmesa->xm_buffer->gc1; XMesaGC gc = xmesa->xm_buffer->gc;
assert(dpy); assert(dpy);
assert(buffer); assert(buffer);
assert(gc); assert(gc);
@@ -952,8 +925,6 @@ void xmesa_init_pointers( GLcontext *ctx )
ctx->Driver.SetDrawBuffer = set_draw_buffer; ctx->Driver.SetDrawBuffer = set_draw_buffer;
ctx->Driver.SetReadBuffer = set_read_buffer; ctx->Driver.SetReadBuffer = set_read_buffer;
ctx->Driver.Index = set_index;
ctx->Driver.Color = set_color;
ctx->Driver.ClearIndex = clear_index; ctx->Driver.ClearIndex = clear_index;
ctx->Driver.ClearColor = clear_color; ctx->Driver.ClearColor = clear_color;
ctx->Driver.Clear = clear_buffers; ctx->Driver.Clear = clear_buffers;

View File

@@ -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 * Mesa 3-D graphics library
@@ -60,7 +60,7 @@ static void draw_points_ANY_pixmap( GLcontext *ctx, SWvertex *vert )
XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; XMesaContext xmesa = (XMesaContext) ctx->DriverCtx;
XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDisplay *dpy = xmesa->xm_visual->display;
XMesaDrawable buffer = xmesa->xm_buffer->buffer; 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) { if (xmesa->xm_visual->gl_visual->RGBAflag) {
register int x, y; 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. * Draw a flat-shaded, PF_TRUECOLOR line into an XImage.
*/ */

File diff suppressed because it is too large Load Diff

View File

@@ -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 * 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. * 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 ) \ #define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \ { \
GLint i, len = RIGHT-LEFT; \ GLint i, len = RIGHT-LEFT; \
(void) fffog; \ (void) fffog; \
for (i=0;i<len;i++) { \ for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \ GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \ if (z < zRow[i]) { \
@@ -595,7 +555,7 @@ static void flat_8R8G8B24_z_triangle( GLcontext *ctx,
#define INNER_LOOP( LEFT, RIGHT, Y ) \ #define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \ { \
GLint i, len = RIGHT-LEFT; \ GLint i, len = RIGHT-LEFT; \
(void) fffog; \ (void) fffog; \
for (i=0;i<len;i++) { \ for (i=0;i<len;i++) { \
GLdepth z = FixedToDepth(ffz); \ GLdepth z = FixedToDepth(ffz); \
if (z < zRow[i]) { \ if (z < zRow[i]) { \

View File

@@ -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 * Mesa 3-D graphics library
@@ -142,9 +142,6 @@ struct xmesa_context {
GLuint pixelformat; /* Current pixel format */ 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 */ GLubyte clearcolor[4]; /* current clearing color */
unsigned long clearpixel; /* current clearing pixel value */ unsigned long clearpixel; /* current clearing pixel value */
@@ -209,8 +206,7 @@ struct xmesa_buffer {
XMesaPixmap stipple_pixmap; /* For polygon stippling */ XMesaPixmap stipple_pixmap; /* For polygon stippling */
XMesaGC stipple_gc; /* For polygon stippling */ XMesaGC stipple_gc; /* For polygon stippling */
XMesaGC gc1; /* GC for infrequent color changes */ XMesaGC gc; /* scratch GC for span, line, tri drawing */
XMesaGC gc2; /* GC for frequent color changes */
XMesaGC cleargc; /* GC for clearing the color buffer */ XMesaGC cleargc; /* GC for clearing the color buffer */
/* The following are here instead of in the XMesaVisual /* The following are here instead of in the XMesaVisual

View File

@@ -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 * 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. * 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 ); GLboolean (*SetDrawBuffer)( GLcontext *ctx, GLenum buffer );
/* /*
* Specifies the current buffer for writing. * 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, void (*WriteMonoRGBASpan)( const GLcontext *ctx, GLuint n, GLint x, GLint y,
const GLubyte mask[] ); const GLchan color[4], const GLubyte mask[] );
/* Write a horizontal run of RGBA pixels all with the color last /* Write a horizontal run of RGBA pixels all with the same color.
* specified by the Color function.
*/ */
void (*WriteRGBAPixels)( const GLcontext *ctx, void (*WriteRGBAPixels)( const GLcontext *ctx,
@@ -256,7 +242,7 @@ struct dd_function_table {
void (*WriteMonoRGBAPixels)( const GLcontext *ctx, void (*WriteMonoRGBAPixels)( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], 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. /* 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, 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 /* Write a horizontal run of color index pixels using the color index
* last specified by the Index() function. * last specified by the Index() function.
*/ */
@@ -284,7 +270,7 @@ struct dd_function_table {
void (*WriteMonoCIPixels)( const GLcontext *ctx, void (*WriteMonoCIPixels)( const GLcontext *ctx,
GLuint n, const GLint x[], const GLint y[], 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 /* Write a random array of color index pixels using the color index
* last specified by the Index() function. * last specified by the Index() function.
*/ */

View File

@@ -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 * Mesa 3-D graphics library
@@ -364,7 +364,7 @@ void gl_write_monoindex_span( GLcontext *ctx,
} }
else { else {
/* normal situation: draw to exactly one buffer */ /* 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 ); (const GLchan (*)[4]) rgba, mask );
} }
else { else {
(*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, mask ); (*ctx->Driver.WriteMonoRGBASpan)( ctx, n, x, y, color, mask );
if (swrast->_RasterMask & ALPHABUF_BIT) { if (swrast->_RasterMask & ALPHABUF_BIT) {
_mesa_write_mono_alpha_span( ctx, n, x, y, (GLchan) color[ACOMP], _mesa_write_mono_alpha_span( ctx, n, x, y, (GLchan) color[ACOMP],
write_all ? Null : mask ); write_all ? Null : mask );

View File

@@ -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 * Mesa 3-D graphics library
@@ -74,12 +74,7 @@ static void flat_ci_triangle( GLcontext *ctx,
SWvertex *v2 ) SWvertex *v2 )
{ {
#define INTERP_Z 1 #define INTERP_Z 1
#define SETUP_CODE \ #define SETUP_CODE
GLuint index = v0->index; \
if (1) { \
/* set the color index */ \
(*ctx->Driver.Index)( ctx, index ); \
}
#define INNER_LOOP( LEFT, RIGHT, Y ) \ #define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \ { \
@@ -95,7 +90,7 @@ static void flat_ci_triangle( GLcontext *ctx,
fffog += fdfogdx; \ fffog += fdfogdx; \
} \ } \
gl_write_monoindex_span( ctx, n, LEFT, Y, zspan, \ 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 INTERP_Z 1
#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE #define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE
#define SETUP_CODE \ #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 INNER_LOOP( LEFT, RIGHT, Y ) \ #define INNER_LOOP( LEFT, RIGHT, Y ) \
{ \ { \
@@ -176,8 +163,7 @@ static void flat_rgba_triangle( GLcontext *ctx,
fffog += fdfogdx; \ fffog += fdfogdx; \
} \ } \
gl_write_monocolor_span( ctx, n, LEFT, Y, zspan, \ gl_write_monocolor_span( ctx, n, LEFT, Y, zspan, \
fogspan, \ fogspan, v0->color, \
v0->color, \
GL_POLYGON ); \ GL_POLYGON ); \
} \ } \
} }