summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-02-05 17:29:21 -0500
committerJune McEnroe <june@causal.agency>2018-02-05 17:29:21 -0500
commit2011b9dca9a762133d23cb4b742df927a4dc4cb7 (patch)
tree61eb951f034668b6199cbcf557306bf0ca4627aa
parentSet title in gfcocoa (diff)
downloadsrc-2011b9dca9a762133d23cb4b742df927a4dc4cb7.tar.gz
src-2011b9dca9a762133d23cb4b742df927a4dc4cb7.zip
Always skip most significant bits in gfxx
This works for CARDS.DLL but might not for other things. We'll see.
Diffstat (limited to '')
-rw-r--r--bin/gfxx.c4
1 files 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]);
     }