From e85750bb55d040e829a141f9fe23732a952a4361 Mon Sep 17 00:00:00 2001 From: Sierraffinity Date: Sat, 27 Jan 2024 14:29:31 -0800 Subject: [PATCH] gbagfx bit depth upconversion fix --- tools/gbagfx/convert_png.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gbagfx/convert_png.c b/tools/gbagfx/convert_png.c index c9c240efbb..58371229c0 100644 --- a/tools/gbagfx/convert_png.c +++ b/tools/gbagfx/convert_png.c @@ -62,7 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth) { - unsigned char pixel = (srcByte >> j) % (1 << destBitDepth); + unsigned char pixel = ((srcByte >> j) % (1 << srcBitDepth)) % (1 << destBitDepth); *dest |= pixel << destBit; destBit -= destBitDepth; if (destBit < 0)