summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/colormac.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-09-14 11:08:57 +0100
committerDave Airlie <airlied@redhat.com>2011-09-14 11:18:08 +0100
commit81a86aea4f0990a1b8795f9e00e7a6c4ba368281 (patch)
tree9798a61c65a74aba6790849544afcd6b32e15f51 /src/mesa/main/colormac.h
parent093dc9e548537e6c77e33064a584f849ad90dfa5 (diff)
downloadexternal_mesa3d-81a86aea4f0990a1b8795f9e00e7a6c4ba368281.zip
external_mesa3d-81a86aea4f0990a1b8795f9e00e7a6c4ba368281.tar.gz
external_mesa3d-81a86aea4f0990a1b8795f9e00e7a6c4ba368281.tar.bz2
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 <airlied@redhat.com>
Diffstat (limited to 'src/mesa/main/colormac.h')
-rw-r--r--src/mesa/main/colormac.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h
index d308c48..923c5a3 100644
--- a/src/mesa/main/colormac.h
+++ b/src/mesa/main/colormac.h
@@ -168,7 +168,12 @@ do { \
UNCLAMPED_FLOAT_TO_CHAN((dst)[3], (f)[3]); \
} while (0)
-
+static inline void _mesa_unclamped_float_rgba_to_ubyte(GLubyte dst[4], const GLfloat src[4])
+{
+ int i;
+ for (i = 0; i < 4; i++)
+ UNCLAMPED_FLOAT_TO_UBYTE(dst[i], src[i]);
+}
/**
* \name Generic color packing macros. All inputs should be GLubytes.