diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2025-05-04 14:59:10 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2025-05-04 14:59:10 -0700 |
commit | 55fdd41ae125fd12d6e8deec493037469d1c0888 (patch) | |
tree | b163448a71a540ba7564c0ff89b1c812d04c072d | |
parent | b8bcb930e265123a5e498c81b05354f0b376f503 (diff) |
vcr: deprecate DARK_$COLOR variants
Preparatory commit for supporting more bar colors for non-CPU rows.
It's this or move from 4bpp(16-color) to 8bpp(256-color). 8bpp
produces significantly larger PNG files, so I'm opting for
keeping things small.
The down side is now you can't identify bar pixels in shadow,
because all text shadow pixels will be the same DARK_WHITE.
Maybe in the future I'll introduce support for picking 4bpp vs.
8bpp at runtime, then you can pick which trade-off you prefer.
-rw-r--r-- | src/vcr.c | 28 |
1 files changed, 15 insertions, 13 deletions
@@ -2082,10 +2082,8 @@ static int vcr_present_xlib_to_png(vcr_t *vcr, vcr_dest_t *dest) #define VCR_PNG_DARK_GRAY {0x30, 0x30, 0x30} /* used for separator */ #define VCR_PNG_DARKER_GRAY {0x10, 0x10, 0x10} /* used for odd rows background */ -/* when in shadow */ +/* when in shadow (see VCR_LUT_DARK_WHITE comment below) */ #define VCR_PNG_DARK_WHITE {0x4a, 0x4a, 0x4a} -#define VCR_PNG_DARK_RED {0x80, 0x00, 0x00} -#define VCR_PNG_DARK_CYAN {0x00, 0x5b, 0x5b} enum { VCR_LUT_BLACK = 0, @@ -2095,15 +2093,21 @@ enum { VCR_LUT_YELLOW, VCR_LUT_DARK_GRAY, VCR_LUT_DARKER_GRAY, - VCR_LUT_DARK_WHITE, - VCR_LUT_DARK_RED, - VCR_LUT_DARK_CYAN, + VCR_LUT_DARK_WHITE, /* In simpler times when there was only RED and CYAN bar colors, I had DARK_RED and DARK_CYAN shadows. + * But then more per-process rows were wanted like RSS, which implied two new bar colors. To keep the + * colored text shadows for consistency, it would require four more colors in the final palette. That + * is far too wasteful of colors in the 16-color/4bpp output image. To not lose the size advantage of + * 4bpp by reverting back to 256-color/8bpp for colored shadows /and/ enough colors for more row types, + * I instead switched all text shadows to simply be DARK_WHITE. That still puts shadow over the colored + * bars, distinguishing the white from whatever bar color it may overlay, while leaving many more color + * slots in the 16-color palette for varied bar colors to support more row type variety as 4bpp. + */ }; static int vcr_present_mem_to_png(vcr_t *vcr, vcr_dest_t *dest) { - static png_color pal[] = { /* programming gfx like it's 1990 can be such a joy */ + static png_color pal[16] = { /* programming gfx like it's 1990 can be such a joy */ [VCR_LUT_BLACK] = {}, [VCR_LUT_WHITE] = VCR_PNG_WHITE, [VCR_LUT_RED] = VCR_PNG_RED, @@ -2112,8 +2116,6 @@ static int vcr_present_mem_to_png(vcr_t *vcr, vcr_dest_t *dest) [VCR_LUT_DARK_GRAY] = VCR_PNG_DARK_GRAY, [VCR_LUT_DARKER_GRAY] = VCR_PNG_DARKER_GRAY, [VCR_LUT_DARK_WHITE] = VCR_PNG_DARK_WHITE, - [VCR_LUT_DARK_RED] = VCR_PNG_DARK_RED, - [VCR_LUT_DARK_CYAN] = VCR_PNG_DARK_CYAN, }; /* lut is an indirection table for mapping layer bit combinations to the above deduplicated denser color palette */ @@ -2153,11 +2155,11 @@ static int vcr_present_mem_to_png(vcr_t *vcr, vcr_dest_t *dest) [VCR_GRAPHAB_ODD] = VCR_LUT_WHITE, /* shadowed same but dark */ - [VCR_SHADOW_GRAPHA] = VCR_LUT_DARK_RED, - [VCR_SHADOW_GRAPHB] = VCR_LUT_DARK_CYAN, + [VCR_SHADOW_GRAPHA] = VCR_LUT_DARK_WHITE, /* XXX: these used to be colored shadows, maybe an optiona 8bpp mode could bring them back */ + [VCR_SHADOW_GRAPHB] = VCR_LUT_DARK_WHITE, /* XXX: these used to be colored shadows, maybe an optiona 8bpp mode could bring them back */ [VCR_SHADOW_GRAPHAB] = VCR_LUT_DARK_WHITE, - [VCR_SHADOW_ODD_GRAPHA] = VCR_LUT_DARK_RED, - [VCR_SHADOW_ODD_GRAPHB] = VCR_LUT_DARK_CYAN, + [VCR_SHADOW_ODD_GRAPHA] = VCR_LUT_DARK_WHITE, /* XXX: these used to be colored shadows, maybe an optiona 8bpp mode could bring them back */ + [VCR_SHADOW_ODD_GRAPHB] = VCR_LUT_DARK_WHITE, /* XXX: these used to be colored shadows, maybe an optiona 8bpp mode could bring them back */ [VCR_SHADOW_ODD_GRAPHAB] = VCR_LUT_DARK_WHITE, /* the rest get defaulted to black, which is great. */ |