$NetBSD: patch-ac,v 1.2 2013/02/26 10:19:28 joerg Exp $ Fix build with png-1.5. --- src/FbTk/ImagePNG.cc.orig 2004-09-20 14:04:11.000000000 +0000 +++ src/FbTk/ImagePNG.cc @@ -28,6 +28,7 @@ #include "PixmapWithMask.hh" #include +#include #include #include using namespace std; @@ -76,6 +77,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 +105,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 +118,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);