mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Support reducing png bit depth
This commit is contained in:
parent
6d6a876dbd
commit
3ee3d6e346
@ -62,10 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d
|
|||||||
|
|
||||||
for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth)
|
for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth)
|
||||||
{
|
{
|
||||||
unsigned char pixel = (srcByte >> j) % (1 << srcBitDepth);
|
unsigned char pixel = (srcByte >> j) % (1 << destBitDepth);
|
||||||
|
|
||||||
if (pixel >= (1 << destBitDepth))
|
|
||||||
FATAL_ERROR("Image exceeds the maximum color value for a %ibpp image.\n", destBitDepth);
|
|
||||||
*dest |= pixel << destBit;
|
*dest |= pixel << destBit;
|
||||||
destBit -= destBitDepth;
|
destBit -= destBitDepth;
|
||||||
if (destBit < 0)
|
if (destBit < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user