Regression in revision 5288?

The attached sample works fine up to 1.3 revision 5262. With 5288 and
newer its broken.

This is basically the code we use for loading PNGs all stuffed into a
small self contained test program. This has been working with SDL 1.2
for ages and it worked still after porting to SDL 1.3, until very
recently.

I’m on Ubuntu 10.10, using the opengl renderer. To try it out, compile with

g++ sdl-config --cflags loadpng.cc -o loadpng -lpng sdl-config --libs

and run with test.png in the same folder. Up to and including revision
5262, you’ll see the png in all its glory. Starting with 5288, all you
get is garbage.

I was poking through the changes in question a bit, but didn’t see
anything obvious. It’s worth noting that loading PNGs with alpha
channel still works fine. It’s only the 24bit variant that is broken.

Interestingly, if I exchange Red and Blue masks in my code, it does
display okay, only all in red ;-). Conversely, if I change
SDL_pixels.c to use the masks it would use on a big endian system, my
code will work unchanged with the latest revision. But I assume those
#defines are there for a reason.

Any help here would be appreciated. Is something wrong with SDL here?
Or was it just sheer luck that my code has been working at all?

Kai
-------------- next part --------------
A non-text attachment was scrubbed…
Name: loadpng.cc
Type: text/x-c++src
Size: 5504 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110216/f4ea103b/attachment.cc
-------------- next part --------------
A non-text attachment was scrubbed…
Name: test.png
Type: image/png
Size: 266 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20110216/f4ea103b/attachment.png

Your masks were fine. It was picking a YV12 texture format on your behalf.
:slight_smile:

Fixed in http://hg.libsdl.org/SDL/rev/3f825465a14a

Thanks!On Tue, Feb 15, 2011 at 3:22 PM, Kai Sterker <kai.sterker at gmail.com> wrote:

The attached sample works fine up to 1.3 revision 5262. With 5288 and
newer its broken.

This is basically the code we use for loading PNGs all stuffed into a
small self contained test program. This has been working with SDL 1.2
for ages and it worked still after porting to SDL 1.3, until very
recently.

I’m on Ubuntu 10.10, using the opengl renderer. To try it out, compile with

g++ sdl-config --cflags loadpng.cc -o loadpng -lpng sdl-config --libs

and run with test.png in the same folder. Up to and including revision
5262, you’ll see the png in all its glory. Starting with 5288, all you
get is garbage.

I was poking through the changes in question a bit, but didn’t see
anything obvious. It’s worth noting that loading PNGs with alpha
channel still works fine. It’s only the 24bit variant that is broken.

Interestingly, if I exchange Red and Blue masks in my code, it does
display okay, only all in red ;-). Conversely, if I change
SDL_pixels.c to use the masks it would use on a big endian system, my
code will work unchanged with the latest revision. But I assume those
#defines are there for a reason.

Any help here would be appreciated. Is something wrong with SDL here?
Or was it just sheer luck that my code has been working at all?

Kai


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and CEO, Galaxy Gameworks