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/dri/nouveau/nouveau_util.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/mesa/drivers/dri/nouveau') diff --git a/src/mesa/drivers/dri/nouveau/nouveau_util.h b/src/mesa/drivers/dri/nouveau/nouveau_util.h index 8cfe26dfb44..63566a63abc 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_util.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_util.h @@ -81,11 +81,9 @@ pack_rgba_f(gl_format f, float c[]) static inline unsigned pack_rgba_clamp_f(gl_format f, float c[]) { - return pack_rgba_i(f, (uint8_t []) { - UNCLAMPED_FLOAT_TO_UBYTE(c[RCOMP]), - UNCLAMPED_FLOAT_TO_UBYTE(c[GCOMP]), - UNCLAMPED_FLOAT_TO_UBYTE(c[BCOMP]), - UNCLAMPED_FLOAT_TO_UBYTE(c[ACOMP]) }); + GLubyte bytes[4]; + _mesa_unclamped_float_rgba_to_ubyte(bytes, c); + return pack_rgba_i(f, bytes); } static inline unsigned -- cgit v1.2.3