From 2011b9dca9a762133d23cb4b742df927a4dc4cb7 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Mon, 5 Feb 2018 17:29:21 -0500 Subject: Always skip most significant bits in gfxx This works for CARDS.DLL but might not for other things. We'll see. --- bin/gfxx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/gfxx.c b/bin/gfxx.c index df947d1c..ead9e2cd 100644 --- a/bin/gfxx.c +++ b/bin/gfxx.c @@ -28,7 +28,7 @@ #define RGB(r,g,b) ((uint32_t)(r) << 16 | (uint32_t)(g) << 8 | (uint32_t)(b)) #define GRAY(n) RGB(n, n, n) -#define MASK(b) ((1 << b) - 1) +#define MASK(b) ((1 << (b)) - 1) #define SCALE(b,n) ((b) ? (uint8_t)(255 * (uint32_t)(n) / MASK(b)) : 0) static enum { @@ -208,7 +208,7 @@ static uint32_t interpolate(uint32_t n) { g = (n >>= bits[3]) & MASK(bits[2]); r = (n >>= bits[2]) & MASK(bits[1]); } else { - r = (n >>= bits[0]) & MASK(bits[1]); + r = n & MASK(bits[1]); g = (n >>= bits[1]) & MASK(bits[2]); b = (n >>= bits[2]) & MASK(bits[3]); } -- cgit 1.4.1