Merge pull request #1974 from Sierraffinity/gbagfx-fix

gbagfx bit depth upconversion fix
This commit is contained in:
GriffinR 2024-01-27 17:44:44 -05:00 committed by GitHub
commit 5e47049b3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)