diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/allegro/generic.h | 11 | ||||
-rw-r--r-- | src/mesa/drivers/dos/dmesa.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/ggi/ggimesa.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/glide/fxdd.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa15.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa16.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa24.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/svga/svgamesa32.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/windows/wmesa.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/windows/wmesa_stereo.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 51 |
12 files changed, 119 insertions, 57 deletions
diff --git a/src/mesa/drivers/allegro/generic.h b/src/mesa/drivers/allegro/generic.h index 898a055d623..cbdf5ff2b3a 100644 --- a/src/mesa/drivers/allegro/generic.h +++ b/src/mesa/drivers/allegro/generic.h @@ -18,13 +18,14 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-static void clear_color_generic(GLcontext *ctx,
- GLubyte red, GLubyte green,
- GLubyte blue, GLubyte alpha)
+static void clear_color_generic(GLcontext *ctx, const GLfloat color[4])
{
AMesaContext context = (AMesaContext)(ctx->DriverCtx);
-
- context->ClearColor = makecol(red, green, blue);
+ GLubyte r, g, b;
+ CLAMPED_FLOAT_TO_UBYTE(r, color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(g, color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(b, color[2]);
+ context->ClearColor = makecol(r, g, b);
}
diff --git a/src/mesa/drivers/dos/dmesa.c b/src/mesa/drivers/dos/dmesa.c index 1d430354f63..e45d00f269e 100644 --- a/src/mesa/drivers/dos/dmesa.c +++ b/src/mesa/drivers/dos/dmesa.c @@ -467,8 +467,13 @@ static void dmesa_choose_tri (GLcontext *ctx) static void clear_color (GLcontext *ctx, const GLchan color[4])
{
+ const GLubyte col[4];
DMesaContext c = (DMesaContext)ctx->DriverCtx;
- c->ClearColor = vl_mixrgba(color);
+ CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
+ CLAMPED_FLOAT_TO_UBYTE(col[3], color[3]);
+ c->ClearColor = vl_mixrgba(col);
}
diff --git a/src/mesa/drivers/ggi/ggimesa.c b/src/mesa/drivers/ggi/ggimesa.c index 6fff79648c6..94364f49e45 100644 --- a/src/mesa/drivers/ggi/ggimesa.c +++ b/src/mesa/drivers/ggi/ggimesa.c @@ -96,17 +96,22 @@ static void gl_ggiSetClearIndex(GLcontext *ctx, GLuint ci) ggi_ctx->clearcolor = (ggi_pixel)ci; } -static void gl_ggiSetClearColor(GLcontext *ctx, const GLchan color[4]) +static void gl_ggiSetClearColor(GLcontext *ctx, const GLfloat color[4]) { ggi_mesa_context_t ggi_ctx = (ggi_mesa_context_t)ctx->DriverCtx; ggi_color rgb; ggi_pixel col; - + GLubyte byteColor[3]; + GGIMESADPRINT_CORE("gl_ggiSetClearColor() called\n"); - rgb.r = (uint16)color[0] << SHIFT; - rgb.g = (uint16)color[1] << SHIFT; - rgb.b = (uint16)color[2] << SHIFT; + CLAMPED_FLOAT_TO_UBYTE(byteColor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(byteColor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(byteColor[2], color[2]); + + rgb.r = (uint16)byteColor[0] << SHIFT; + rgb.g = (uint16)byteColor[1] << SHIFT; + rgb.b = (uint16)byteColor[2] << SHIFT; col = ggiMapColor(ggi_ctx->ggi_visual, &rgb); ggiSetGCForeground(ggi_ctx->ggi_visual, col); ggi_ctx->clearcolor = col; diff --git a/src/mesa/drivers/glide/fxdd.c b/src/mesa/drivers/glide/fxdd.c index d4ef05be146..9b98cdd106a 100644 --- a/src/mesa/drivers/glide/fxdd.c +++ b/src/mesa/drivers/glide/fxdd.c @@ -1,4 +1,4 @@ -/* $Id: fxdd.c,v 1.91 2002/09/27 02:45:38 brianp Exp $ */ +/* $Id: fxdd.c,v 1.92 2002/10/04 19:10:10 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -125,17 +125,21 @@ fxDDBufferSize(GLframebuffer *buffer, GLuint * width, GLuint * height) /* Implements glClearColor() */ static void -fxDDClearColor(GLcontext * ctx, const GLchan color[4]) +fxDDClearColor(GLcontext * ctx, const GLfloat color[4]) { fxMesaContext fxMesa = (fxMesaContext) ctx->DriverCtx; GLubyte col[4]; if (MESA_VERBOSE & VERBOSE_DRIVER) { - fprintf(stderr, "fxmesa: fxDDClearColor(%d,%d,%d,%d)\n", + fprintf(stderr, "fxmesa: fxDDClearColor(%f,%f,%f,%f)\n", color[0], color[1], color[2], color[3]); } - ASSIGN_4V(col, color[0], color[1], color[2], 255); + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(col[3], color[3]); + fxMesa->clearC = FXCOLOR4(col); fxMesa->clearA = color[3]; } diff --git a/src/mesa/drivers/svga/svgamesa15.c b/src/mesa/drivers/svga/svgamesa15.c index 89ff6445be2..d14d58d7561 100644 --- a/src/mesa/drivers/svga/svgamesa15.c +++ b/src/mesa/drivers/svga/svgamesa15.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa15.c,v 1.9 2001/02/06 00:03:47 brianp Exp $ */ +/* $Id: svgamesa15.c,v 1.10 2002/10/04 19:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -56,9 +56,13 @@ static unsigned long __svga_getpixel15(int x, int y) return shortBuffer[offset]; } -void __clear_color15( GLcontext *ctx, const GLchan color[4] ) +void __clear_color15( GLcontext *ctx, const GLfloat color[4] ) { - SVGAMesa->clear_hicolor=(color[0]>>3)<<10 | (color[1]>>3)<<5 | (color[2]>>3); + GLubyte col[3]; + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + SVGAMesa->clear_hicolor=(col[0]>>3)<<10 | (col[1]>>3)<<5 | (col[2]>>3); /* SVGAMesa->clear_hicolor=(red)<<10 | (green)<<5 | (blue);*/ } diff --git a/src/mesa/drivers/svga/svgamesa16.c b/src/mesa/drivers/svga/svgamesa16.c index ed36beca244..9078d927091 100644 --- a/src/mesa/drivers/svga/svgamesa16.c +++ b/src/mesa/drivers/svga/svgamesa16.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa16.c,v 1.9 2001/02/06 00:03:48 brianp Exp $ */ +/* $Id: svgamesa16.c,v 1.10 2002/10/04 19:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -59,9 +59,13 @@ static unsigned long __svga_getpixel16(int x, int y) void __clear_color16( GLcontext *ctx, const GLchan color[4] ) { - SVGAMesa->clear_hicolor = (color[0] >> 3) << 11 | - (color[1] >> 2) << 5 | - (color[2] >> 3); + GLubyte col[3]; + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + SVGAMesa->clear_hicolor = (col[0] >> 3) << 11 | + (col[1] >> 2) << 5 | + (col[2] >> 3); /* SVGAMesa->clear_hicolor=(red)<<11 | (green)<<5 | (blue); */ } diff --git a/src/mesa/drivers/svga/svgamesa24.c b/src/mesa/drivers/svga/svgamesa24.c index df1c47be3e8..fc56ccb6b32 100644 --- a/src/mesa/drivers/svga/svgamesa24.c +++ b/src/mesa/drivers/svga/svgamesa24.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa24.c,v 1.10 2001/02/06 00:03:48 brianp Exp $ */ +/* $Id: svgamesa24.c,v 1.11 2002/10/04 19:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -81,9 +81,13 @@ static unsigned long __svga_getpixel24(int x, int y) void __clear_color24( GLcontext *ctx, const GLchan color[4] ) { - SVGAMesa->clear_red = color[0]; - SVGAMesa->clear_green = color[1]; - SVGAMesa->clear_blue = color[2]; + GLubyte col[3]; + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + SVGAMesa->clear_red = col[0]; + SVGAMesa->clear_green = col[1]; + SVGAMesa->clear_blue = col[2]; /* SVGAMesa->clear_truecolor = red<<16 | green<<8 | blue; */ } diff --git a/src/mesa/drivers/svga/svgamesa32.c b/src/mesa/drivers/svga/svgamesa32.c index 49c1812b3de..2ef3a191be0 100644 --- a/src/mesa/drivers/svga/svgamesa32.c +++ b/src/mesa/drivers/svga/svgamesa32.c @@ -1,4 +1,4 @@ -/* $Id: svgamesa32.c,v 1.10 2001/02/06 00:03:48 brianp Exp $ */ +/* $Id: svgamesa32.c,v 1.11 2002/10/04 19:10:11 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -78,7 +78,11 @@ static unsigned long __svga_getpixel32(int x, int y) void __clear_color32( GLcontext *ctx, const GLchan color[4] ) { - SVGAMesa->clear_truecolor = (color[0] << 16) | (color[1] << 8) | color[2]; + GLubyte col[3]; + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + SVGAMesa->clear_truecolor = (col[0] << 16) | (col[1] << 8) | col[2]; } void __clear32( GLcontext *ctx, GLbitfield mask, GLboolean all, diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c index 05029adbfea..8d59cff2039 100644 --- a/src/mesa/drivers/windows/wmesa.c +++ b/src/mesa/drivers/windows/wmesa.c @@ -1,4 +1,4 @@ -/* $Id: wmesa.c,v 1.37 2002/10/04 15:58:33 kschultz Exp $ */ +/* $Id: wmesa.c,v 1.38 2002/10/04 19:10:11 brianp Exp $ */ /* * Windows (Win32) device driver for Mesa 3.4 @@ -371,9 +371,13 @@ static void clear_index(GLcontext* ctx, GLuint index) /* * Set the color used to clear the color buffer. */ -static void clear_color( GLcontext* ctx, const GLchan color[4] ) +static void clear_color( GLcontext* ctx, const GLfloat color[4] ) { - Current->clearpixel = RGB(color[0], color[1], color[2]); + GLubyte col[4]; + CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]); + Current->clearpixel = RGB(col[0], col[1], col[2]); } diff --git a/src/mesa/drivers/windows/wmesa_stereo.c b/src/mesa/drivers/windows/wmesa_stereo.c index fea0dc42292..1781b0e4397 100644 --- a/src/mesa/drivers/windows/wmesa_stereo.c +++ b/src/mesa/drivers/windows/wmesa_stereo.c @@ -153,10 +153,14 @@ static void clear_index(GLcontext* ctx, GLuint index) /*
* Set the color used to clear the color buffer.
*/
-static void clear_color( GLcontext* ctx, const GLchan color[4] )
+static void clear_color( GLcontext* ctx, const GLfloat color[4] )
{
STARTPROFILE
- Current->clearpixel = RGB(color[0], color[1], color[2]);
+ GLubyte col[4];
+ CLAMPED_FLOAT_TO_UBYTE(col[0], color[0]);
+ CLAMPED_FLOAT_TO_UBYTE(col[1], color[1]);
+ CLAMPED_FLOAT_TO_UBYTE(col[2], color[2]);
+ Current->clearpixel = RGB(col[0], col[1], col[2]);
ENDPROFILE(clear_color)
}
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 3d4792737ca..9be4aba69be 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1,4 +1,4 @@ -/* $Id: xm_dd.c,v 1.36 2002/09/27 02:45:39 brianp Exp $ */ +/* $Id: xm_dd.c,v 1.37 2002/10/04 19:10:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -27,6 +27,7 @@ #include "glxheader.h" #include "context.h" +#include "colormac.h" #include "depth.h" #include "drawpix.h" #include "extensions.h" @@ -176,15 +177,18 @@ clear_index( GLcontext *ctx, GLuint index ) static void -clear_color( GLcontext *ctx, const GLchan color[4] ) +clear_color( GLcontext *ctx, const GLfloat color[4] ) { const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - xmesa->clearcolor[0] = color[0]; - xmesa->clearcolor[1] = color[1]; - xmesa->clearcolor[2] = color[2]; - xmesa->clearcolor[3] = color[3]; - xmesa->clearpixel = xmesa_color_to_pixel( xmesa, color[0], color[1], - color[2], color[3], + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); + xmesa->clearpixel = xmesa_color_to_pixel( xmesa, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2], + xmesa->clearcolor[3], xmesa->xm_visual->undithered_pf ); _glthread_LOCK_MUTEX(_xmesa_lock); XMesaSetForeground( xmesa->display, xmesa->xm_draw_buffer->cleargc, diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index eed8c91a968..ec51de0d2e3 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -1,4 +1,4 @@ -/* $Id: xm_span.c,v 1.15 2002/07/09 01:22:52 brianp Exp $ */ +/* $Id: xm_span.c,v 1.16 2002/10/04 19:10:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -26,15 +26,16 @@ /* $XFree86: xc/extras/Mesa/src/X/xm_span.c,v 1.3 2002/02/27 21:07:54 tsi Exp $ */ #include "glxheader.h" +#include "colormac.h" #include "context.h" -#include "drawpix.h" -#include "mem.h" -#include "state.h" #include "depth.h" +#include "drawpix.h" +#include "extensions.h" #include "macros.h" +#include "mem.h" #include "mtypes.h" +#include "state.h" #include "xmesaP.h" -#include "extensions.h" #include "swrast/swrast.h" @@ -4163,14 +4164,17 @@ static void read_color_pixels( const GLcontext *ctx, static void -clear_color_HPCR_ximage( GLcontext *ctx, const GLchan color[4] ) +clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - COPY_4V(xmesa->clearcolor, color); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); - if (color[0] == 0 && color[1] == 0 && color[2] == 0) { + if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { /* black is black */ MEMSET( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 , sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern)); @@ -4178,24 +4182,33 @@ clear_color_HPCR_ximage( GLcontext *ctx, const GLchan color[4] ) else { /* build clear pattern */ for (i=0; i<16; i++) { - xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = - DITHER_HPCR(i, 0, color[0], color[1], color[2]); + xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = + DITHER_HPCR(i, 0, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2]); xmesa->xm_visual->hpcr_clear_ximage_pattern[1][i] = - DITHER_HPCR(i, 1, color[0], color[1], color[2]); + DITHER_HPCR(i, 1, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2]); } } } static void -clear_color_HPCR_pixmap( GLcontext *ctx, const GLchan color[4] ) +clear_color_HPCR_pixmap( GLcontext *ctx, const GLfloat color[4] ) { int i; const XMesaContext xmesa = (XMesaContext) ctx->DriverCtx; - COPY_4V(xmesa->clearcolor, color); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]); - if (color[0] == 0 && color[1] == 0 && color[2] == 0) { + if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { /* black is black */ for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0); @@ -4205,9 +4218,15 @@ clear_color_HPCR_pixmap( GLcontext *ctx, const GLchan color[4] ) else { for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, - DITHER_HPCR(i, 0, color[0], color[1], color[2])); + DITHER_HPCR(i, 0, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2])); XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, - DITHER_HPCR(i, 1, color[0], color[1], color[2])); + DITHER_HPCR(i, 1, + xmesa->clearcolor[0], + xmesa->clearcolor[1], + xmesa->clearcolor[2])); } } /* change tile pixmap content */ |