trackgen: fix reading of palette and gray png files with no alpha

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8617 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 5adaf6b9568f45c75b974b071476121203f008cd
Former-commit-id: d7a82259b9d2941bc75f75ea67b670c470b7397a
This commit is contained in:
iobyte 2022-11-03 02:46:42 +00:00
parent 0d73ac53be
commit be9b8c00b3

View file

@ -216,7 +216,8 @@ GfTexReadImageFromPNG(const char *filename, float screen_gamma, int *pWidth, int
}
if (color_type == PNG_COLOR_TYPE_PALETTE) {
png_set_expand(png_ptr);
png_set_palette_to_rgb(png_ptr);
png_set_add_alpha(png_ptr, 0xffff, PNG_FILLER_AFTER);
}
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
@ -228,6 +229,8 @@ GfTexReadImageFromPNG(const char *filename, float screen_gamma, int *pWidth, int
}
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
if (color_type == PNG_COLOR_TYPE_GRAY)
png_set_add_alpha(png_ptr, 0xffff, PNG_FILLER_AFTER);
png_set_gray_to_rgb(png_ptr);
}