From fc80ad6e62fb2b53d53756593099330477a44c52 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Oct 2002 19:10:06 +0000 Subject: Changed a number of context fields from GLchan to GLfloat (such as ClearColor). Also changed parameter types for some driver functions (like ctx->Driver.Clear- Color). Updated all the device drivers. Someday, we want to support 8, 16 and 32-bit channels dynamically at runtime. --- src/mesa/drivers/svga/svgamesa15.c | 10 +++++++--- src/mesa/drivers/svga/svgamesa16.c | 12 ++++++++---- src/mesa/drivers/svga/svgamesa24.c | 12 ++++++++---- src/mesa/drivers/svga/svgamesa32.c | 8 ++++++-- 4 files changed, 29 insertions(+), 13 deletions(-) (limited to 'src/mesa/drivers/svga') 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, -- cgit v1.2.3