From 81a86aea4f0990a1b8795f9e00e7a6c4ba368281 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Sep 2011 11:08:57 +0100 Subject: mesa/colormac: introduce inline helper for 4 unclamped float to ubyte. This introduces an UNCLAMPED_FLOAT_TO_UBYTE x 4 inline function, as suggested by Brian. It uses it in a few places I noticed from previous color changes, and also some core mesa places. I haven't updated other places yet. Signed-off-by: Dave Airlie --- src/mesa/drivers/x11/xm_dd.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/mesa/drivers/x11/xm_dd.c') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 52964ddd047..a59ffd3755a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -111,10 +111,7 @@ clear_color( struct gl_context *ctx, const XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer xmbuf = XMESA_BUFFER(ctx->DrawBuffer); - 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]); + _mesa_unclamped_float_rgba_to_ubyte(xmesa->clearcolor, color.f); xmesa->clearpixel = xmesa_color_to_pixel( ctx, xmesa->clearcolor[0], xmesa->clearcolor[1], @@ -777,10 +774,7 @@ clear_color_HPCR_ximage( struct gl_context *ctx, int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); - 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]); + _mesa_unclamped_float_rgba_to_ubyte(xmesa->clearcolor, color.f); if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) { /* black is black */ @@ -812,10 +806,7 @@ clear_color_HPCR_pixmap( struct gl_context *ctx, int i; const XMesaContext xmesa = XMESA_CONTEXT(ctx); - 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]); + _mesa_unclamped_float_rgba_to_ubyte(xmesa->clearcolor, color.f); if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) { /* black is black */ -- cgit v1.2.3