diff options
author | Dave Airlie <[email protected]> | 2011-09-12 10:57:40 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-09-14 11:18:07 +0100 |
commit | 093dc9e548537e6c77e33064a584f849ad90dfa5 (patch) | |
tree | 4a3ecd84f123cd89a29fea6700603a5da53d62cb /src/mesa/drivers/x11/xm_dd.c | |
parent | b06613c6cc029c3ff200430b0706b5229c4508bd (diff) |
mesa: introduce a clear color union to be used for int/unsigned buffers
This introduces a new gl_color_union union and moves the current
ClearColorUnclamped to use it, it removes current ClearColor completely and
renames CCU to CC, then all drivers are modified to expected unclamped floats instead.
also fixes st to use translated color in one place it wasn't.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/mesa/drivers/x11/xm_dd.c')
-rw-r--r-- | src/mesa/drivers/x11/xm_dd.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 81d000b3952..52964ddd047 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -104,16 +104,17 @@ finish_or_flush( struct gl_context *ctx ) static void -clear_color( struct gl_context *ctx, const GLfloat color[4] ) +clear_color( struct gl_context *ctx, + const union gl_color_union color ) { if (ctx->DrawBuffer->Name == 0) { const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - 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]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color.f[0]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color.f[1]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color.f[2]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color.f[3]); xmesa->clearpixel = xmesa_color_to_pixel( ctx, xmesa->clearcolor[0], xmesa->clearcolor[1], @@ -770,17 +771,18 @@ enable( struct gl_context *ctx, GLenum pname, GLboolean state ) static void -clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] ) +clear_color_HPCR_ximage( struct gl_context *ctx, + const union gl_color_union color ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); - 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]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color.f[0]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color.f[1]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color.f[2]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color.f[3]); - if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { + if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) { /* black is black */ memset( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 , sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern)); @@ -804,17 +806,18 @@ clear_color_HPCR_ximage( struct gl_context *ctx, const GLfloat color[4] ) static void -clear_color_HPCR_pixmap( struct gl_context *ctx, const GLfloat color[4] ) +clear_color_HPCR_pixmap( struct gl_context *ctx, + const union gl_color_union color ) { int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); - 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]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color.f[0]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color.f[1]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color.f[2]); + UNCLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color.f[3]); - if (color[0] == 0.0 && color[1] == 0.0 && color[2] == 0.0) { + if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) { /* black is black */ for (i=0; i<16; i++) { XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0); |