This patch is from netbsd pkgsrc ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/x11/fbdesk/patches --- a/src/FbTk/ImagePNG.cc +++ b/src/FbTk/ImagePNG.cc @@ -76,6 +76,8 @@ ImagePNG::~ImagePNG() { } PixmapWithMask *ImagePNG::load(const std::string &filename, int screen_num) const { + int pixel_depth; + int rowbytes; if (filename.empty()) return 0; #ifdef DEBUG @@ -102,7 +104,7 @@ PixmapWithMask *ImagePNG::load(const std return 0; } - if (setjmp(png.png()->jmpbuf)) { + if (setjmp(png_jmpbuf(png.png()))) { fclose(fp); return 0; } @@ -115,12 +117,14 @@ PixmapWithMask *ImagePNG::load(const std png_get_IHDR(png.png(), png.info(), &w, &h, &bit_depth, &color_type, &interlace_type, 0, 0); + pixel_depth = bit_depth * png_get_channels(png.png(), png.info()); + rowbytes = png_get_rowbytes(png.png(), png.info()); #ifdef DEBUG - cerr<width<<", "<height<pixel_depth<<" to 32bpp."<channels != 4) ? 0xFF000000 : 0); + int alphacolor = ((png_get_channels(png.png(), png.info()) != 4) ? 0xFF000000 : 0); if (big_endian) { - int shift = ((png.info()->channels == 4) ? 0 : 8); + int shift = ((png_get_channels(png.png(), png.info()) == 4) ? 0 : 8); alphacolor = (0xFF >> shift); } screen_surf.setColorKey(alphacolor, true);