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.
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;
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");
for (i=0;i<n;i++) {
if (mask[i]) {
- data[span] = (GLuint) fxMesa->color;
+ data[span] = (GLuint) gColor;
++span;
} else {
if (span > 0) {
(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,
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");
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);
}
-/* $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
+#define OSMESA_CONTEXT(ctx) ((OSMesaContext) (ctx->DriverCtx))
+
+
+
/**********************************************************************/
/***** Public Functions *****/
/**********************************************************************/
static void clear_index( GLcontext *ctx, GLuint index )
{
- OSMesaContext osmesa = (OSMesaContext) ctx;
+ OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
osmesa->clearpixel = 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 );
}
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 */
static void set_index( GLcontext *ctx, GLuint index )
{
- OSMesaContext osmesa = (OSMesaContext) ctx;
+ OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
osmesa->pixel = 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 );
}
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;
}
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;
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;
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;
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;
}
}
}
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;
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;
}
}
}
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++) {
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) );
}
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]) {
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;
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]) {
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) {
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;
}
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]);
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;
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;
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) {
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) {
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;
}
}
}
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]) {
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;
}
}
}
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++) {
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] ) {
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] );
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] );
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;
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;
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;
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;
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;
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 \
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))
static void osmesa_update_state( GLcontext *ctx )
{
- OSMesaContext osmesa = (OSMesaContext) ctx;
+ OSMesaContext osmesa = OSMESA_CONTEXT(ctx);
ASSERT((void *) osmesa == (void *) ctx->DriverCtx);
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;
-/* $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
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;
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;
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;
#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;
#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;
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;
-/* $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
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 )
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);
}
}
}
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 );
}
}
}
-/* $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
#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 */
-/* $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
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 )
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);
}
}
}
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 );
}
}
}
-/* $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
#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 */
-/* $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
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 )
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]);
}
}
}
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] );
}
}
}
-/* $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
#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 */
-/* $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
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 )
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);
}
}
}
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 );
}
}
}
-/* $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
#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 */
-/* $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
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;
}
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);
}
}
}
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);
}
}
}
-/* $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
#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 */
-/* $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
-/* 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)
*/
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;
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)
}
*/
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;
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)
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;
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)
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)
}
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
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)
}
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;
-/* $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
/* 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().
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) {
* 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],
-/* $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
-/* 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 )
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);
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;
-/* $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
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;
/**********************************************************************/
-#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.
*/
-/* $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
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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;
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) {
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;
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) {
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) {
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) {
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) {
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);
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);
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);
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);
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) {
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) {
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);
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);
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) {
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) {
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]) {
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]) {
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]) {
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]) {
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]) {
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]) {
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]) {
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++) {
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++) {
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]) {
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++) {
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]) {
/**********************************************************************/
#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++) {
}
+
/*
- * 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;
/*
- * 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 ) );
/*
- * 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]) {
/*
- * 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]) {
/*
- * 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++) {
/*
- * 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 ) );
/*
- * 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 );
/*
- * 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;
/*
- * 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]) {
/*
- * 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 );
/*
- * 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;
/*
- * 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]) {
#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 ) );
/*
- * 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 ) );
/*
- * 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 );
}
}
}
/*
* 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;
/*
- * 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] );
/*
- * 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] );
/*
- * 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]) {
/*
- * 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 ) );
/*
- * 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]);
/*
- * 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]);
/*
- * 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]);
/*
- * 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]);
/*
* 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] );
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++) {
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++) {
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]) {
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;
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 */
-/* $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
/**********************************************************************/
-#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.
*/
#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]) { \
#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]) { \
-/* $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
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 */
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
-/* $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
* 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.
*/
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,
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.
*/
*/
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.
*/
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.
*/
-/* $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
}
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 );
}
}
}
(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 );
-/* $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
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 ) \
{ \
fffog += fdfogdx; \
} \
gl_write_monoindex_span( ctx, n, LEFT, Y, zspan, \
- fogspan, index, GL_POLYGON ); \
+ fogspan, v0->index, GL_POLYGON ); \
} \
}
#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 ) \
{ \
fffog += fdfogdx; \
} \
gl_write_monocolor_span( ctx, n, LEFT, Y, zspan, \
- fogspan, \
- v0->color, \
+ fogspan, v0->color, \
GL_POLYGON ); \
} \
}