Fix PNGs that are encoded using indexed mode and have a transparent chunk not decoding properly on big endian systems (Thanks Doctorj1)

This commit is contained in:
UnknownShadow200 2021-09-04 09:31:12 +10:00
parent bbedc4e1f1
commit 49729a67a2

View File

@ -442,7 +442,7 @@ cc_result Png_Decode(struct Bitmap* bmp, struct Stream* stream) {
/* set alpha component of palette */ /* set alpha component of palette */
for (i = 0; i < dataSize; i++) { for (i = 0; i < dataSize; i++) {
palette[i] &= BITMAPCOL_RGB_MASK; /* set A to 0 */ palette[i] &= BITMAPCOL_RGB_MASK; /* set A to 0 */
palette[i] |= tmp[i] << PACKEDCOL_A_SHIFT; palette[i] |= tmp[i] << BITMAPCOL_A_SHIFT;
} }
} else if (col == PNG_COL_RGB) { } else if (col == PNG_COL_RGB) {
if (dataSize != 6) return PNG_ERR_TRANS_COUNT; if (dataSize != 6) return PNG_ERR_TRANS_COUNT;