summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2011-09-19 18:25:38 -0600
committerMarek Olšák <maraeo@gmail.com>2011-10-02 18:08:31 +0200
commita74400ca3060486cc94eae4631e8cd5ff968a53b (patch)
tree5a47839a38ad54fa3d8e8aa4313f68cadbb483d2
parenta5e2074fdd1591ad7f892ae014d73f7388f47e0a (diff)
mesa: fix PACK_COLOR_5551(), PACK_COLOR_1555() macros
The 1-bit alpha channel was incorrectly encoded. Previously, any non-zero alpha value for the ubyte alpha value would set A=1. Instead, use the most significant bit of the ubyte alpha to determine the A bit. This is consistent with the other channels and other OpenGL implementations. Note: This is a candidate for the 7.11 branch. Reviewed-by: Michel Dänzer <michel@daenzer.net> (cherry picked from commit 4731a598f00c8a229df7b36d9a2a7505b679de1d)
-rw-r--r--src/mesa/main/colormac.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h
index a328dcd32af..223e04a3ef5 100644
--- a/src/mesa/main/colormac.h
+++ b/src/mesa/main/colormac.h
@@ -188,11 +188,11 @@ do { \
#define PACK_COLOR_5551( R, G, B, A ) \
((((R) & 0xf8) << 8) | (((G) & 0xf8) << 3) | (((B) & 0xf8) >> 2) | \
- ((A) ? 1 : 0))
+ ((A) >> 7))
#define PACK_COLOR_1555( A, B, G, R ) \
((((B) & 0xf8) << 7) | (((G) & 0xf8) << 2) | (((R) & 0xf8) >> 3) | \
- ((A) ? 0x8000 : 0))
+ (((A) & 0x80) << 8))
#define PACK_COLOR_1555_REV( A, B, G, R ) \
((((B) & 0xf8) >> 1) | (((G) & 0xc0) >> 6) | (((G) & 0x38) << 10) | (((R) & 0xf8) << 5) | \