I have recently upgraded my game to the latest version of SDL, and since then a number of PNGs fail to load.
The code is simply:
SDL_RWops *rw = SDL_RWFromFile(libfile[n].name, “rb”);
SDL_Surface *s1 = IMG_LoadPNG_RW(rw);
The PNG is here: http://crystalshard.net/test/fail.png
This results in a nullpointer, and SDL_GetError simply tells me it fails to load, but doesn’t say why. Notably, in earlier versions of SDL this did work. Most other PNGs still work fine, but about 10% of them do not. Is there something unusual about this PNG that people can see? Or am I doing something wrong?
If I build SDL2_image against the included libpng-1.6.32, showimage
program errors with: “libpng error: IDAT: chunk data is too large”
If I replace libpng-1.6.32 with 1.6.35 (latest official release yet), then
Iet a warning “libpng warning: iCCP: known incorrect sRGB profile”,
but no errors and the image displays Ok.
So, we should update the libpng version included in SDL2_image.
sigh…
@Radiant: I tried it myself on windows, reproduced your issue and the
replacement png dlls fixed it for me. Waiting for your response to push
to the official repository.
As for the reason for the failures, libpng-1.6.32-to-1.6.33 changelog
mentions the following:
- Compute a larger limit on IDAT because some applications write
a deflate buffer for each row