@@ -112,25 +112,25 @@ static bool ReadHeightmapPNG(char *filen
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL || setjmp(png_jmpbuf(png_ptr))) {
ShowErrorMessage(STR_PNGMAP_ERR_MISC, STR_PNGMAP_ERROR, 0, 0);
fclose(fp);
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return false;
}
png_init_io(png_ptr, fp);
/* Allocate memory and read image, without alpha or 16-bit samples
* (result is either 8-bit indexed/grayscale or 24-bit RGB) */
png_set_packing(png_ptr);
png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_PACKING | PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_STRIP_16, NULL);
/* Maps of wrong color-depth are not used.
* (this should have been taken care of by stripping alpha and 16-bit samples on load) */
if ((info_ptr->channels != 1) && (info_ptr->channels != 3) && (info_ptr->bit_depth != 8)) {
ShowErrorMessage(STR_PNGMAP_ERR_IMAGE_TYPE, STR_PNGMAP_ERROR, 0, 0);