summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-02-04 11:59:14 -0500
committerJune McEnroe <programble@gmail.com>2018-02-04 11:59:14 -0500
commit82abc2d38c92542b1c7e4eaf6a662d9e4bef2c52 (patch)
tree418608ca22d809f1b6968a046419d0ed511a2129
parentAdd Quit menu item to gfcocoa (diff)
downloadsrc-82abc2d38c92542b1c7e4eaf6a662d9e4bef2c52.tar.gz
src-82abc2d38c92542b1c7e4eaf6a662d9e4bef2c52.zip
Add 4-bit RGB to gfxx
Replace default palette with alternating black and white.
Diffstat (limited to '')
-rw-r--r--bin/gfxx.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/bin/gfxx.c b/bin/gfxx.c
index f742149c..b72af163 100644
--- a/bin/gfxx.c
+++ b/bin/gfxx.c
@@ -38,10 +38,9 @@ static enum {
 static uint8_t bits = 1;
 static bool endian;
 static uint32_t palette[256] = {
-#define P8 0x000000, 0xFF0000, 0x00FF00, 0xFFFF00, 0x0000FF, 0xFF00FF, 0x00FFFF, 0xFFFFFF,
-    P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8
-    P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8 P8
-#undef P8
+#define X(...) __VA_ARGS__, __VA_ARGS__
+    X(X(X(X(X(X(X(0x000000, 0xFFFFFF)))))))
+#undef X
 };
 
 static bool reverse;
@@ -187,6 +186,8 @@ static void drawBits(struct Pos *pos) {
             uint8_t n = get(i) >> (endian ? 8 - bits - s : s) & MASK(bits);
             if (space == COLOR_PALETTE) {
                 put(pos, palette[n]);
+            } else if (space == COLOR_RGB && bits == 4) {
+                put(pos, RGB(SCALE(1, n & 1), SCALE(1, n & 2), SCALE(1, n & 4)));
             } else {
                 put(pos, GRAY(SCALE(bits, n)));
             }