diff options
author | Brian Paul <[email protected]> | 2002-10-04 19:10:06 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2002-10-04 19:10:06 +0000 |
commit | fc80ad6e62fb2b53d53756593099330477a44c52 (patch) | |
tree | 0b47f3ee84d613dfa2264d6f23e5c2a60cecc9ba /src/mesa/drivers/x11/xm_span.c | |
parent | f782b8189e718974a40d72ac4f6b8d213ca99e1e (diff) |
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.
Diffstat (limited to 'src/mesa/drivers/x11/xm_span.c')
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 51 |
1 files changed, 35 insertions, 16 deletions
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 */ |