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 | |
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')
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 51 |
2 files changed, 47 insertions, 24 deletions
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 */ |