From 442d034243dc1a8579f163de0e9823af4f7f5fc3 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 14 Feb 2018 17:03:27 -0500 Subject: Write at least 1 for each component of sBIT in gfxx PNG requires each to be 0 < x <= depth. ImageMagick actually checks. --- bin/gfxx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/gfxx.c b/bin/gfxx.c index 6ccb17cb..5f05650c 100644 --- a/bin/gfxx.c +++ b/bin/gfxx.c @@ -28,9 +28,11 @@ #include #include +#define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MASK(b) ((1 << (b)) - 1) + #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) static enum { COLOR_INDEXED, @@ -351,7 +353,8 @@ static void pngDump(uint32_t *src, size_t srcWidth, size_t srcHeight) { pngWrite(options, strlen(options)); } PNG_CHUNK("sBIT", 3) { - pngWrite(&bits[R], 3); + uint8_t sbit[3] = { MAX(bits[R], 1), MAX(bits[G], 1), MAX(bits[B], 1) }; + pngWrite(sbit, sizeof(sbit)); } PNG_CHUNK("IDAT", dataSize) { pngWrite(data, dataSize); -- cgit 1.4.1 .config?id=328f307298d62f81bb2eb355b0fc61ce7a86e346&follow=1'>commit diff
Commit message (Expand)Author
2013-05-04Update awesome themeJune McEnroe
2013-04-27Update terminal colors with proper base16 paletteJune McEnroe
2013-04-27Update location of Xfce4-Terminal configurationJune McEnroe
2013-04-24Update system configurationsJune McEnroe
2013-04-23Fix terminal colorsJune McEnroe
2013-04-14Start xcompmgrJune McEnroe
2013-04-06Drop pacman-color, regular pacman now has colorJune McEnroe
2013-04-06Restore wallpaper automaticallyJune McEnroe
2013-03-22Simplify autostartJune McEnroe
2013-02-24Default to Ruby 2.0June McEnroe
2013-01-26Make pretty riplrcJune McEnroe
2013-01-26Default to awesome sessionJune McEnroe
2013-01-26Add git promptJune McEnroe
2013-01-26Actually port awesome config to 3.5June McEnroe
2013-01-26Make pretty zshrcJune McEnroe
2013-01-26Port awesome config to 3.5June McEnroe
2013-01-26Replace RVM with chrubyJune McEnroe