$OpenBSD$ --- source/shared_lib/sources/graphics/PNGReader.cpp.orig Wed Sep 14 21:27:05 2011 +++ source/shared_lib/sources/graphics/PNGReader.cpp Wed Sep 14 21:48:50 2011 @@ -93,13 +93,13 @@ Pixmap2D* PNGReader::read(ifstream& is, const string& png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); - int width = info_ptr->width; - int height = info_ptr->height; - int color_type = info_ptr->color_type; - int bit_depth = info_ptr->bit_depth; + int width = png_get_image_width(png_ptr, info_ptr); + int height = png_get_image_height(png_ptr, info_ptr); + int color_type = png_get_color_type(png_ptr, info_ptr); + int bit_depth = png_get_bit_depth(png_ptr, info_ptr); //We want RGB, 24 bit - if (color_type == PNG_COLOR_TYPE_PALETTE || (color_type == PNG_COLOR_TYPE_GRAY && info_ptr->bit_depth < 8) || (info_ptr->valid & PNG_INFO_tRNS)) { + if (color_type == PNG_COLOR_TYPE_PALETTE || (color_type == PNG_COLOR_TYPE_GRAY && png_get_bit_depth(png_ptr, info_ptr) < 8) || (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) { png_set_expand(png_ptr); } @@ -117,17 +117,17 @@ Pixmap2D* PNGReader::read(ifstream& is, const string& return NULL; //error during read_image } for (int y = 0; y < height; ++y) { - row_pointers[y] = new png_byte[info_ptr->rowbytes]; + row_pointers[y] = new png_byte[png_get_rowbytes(png_ptr, info_ptr)]; } png_read_image(png_ptr, row_pointers); - size_t fileComponents = info_ptr->rowbytes/info_ptr->width; + size_t fileComponents = png_get_rowbytes(png_ptr, info_ptr)/png_get_image_width(png_ptr, info_ptr); size_t picComponents = (ret->getComponents()==-1)?fileComponents:ret->getComponents(); //std::cout << "PNG-Components: Pic: " << picComponents << " old: " << (ret->getComponents()) << " File: " << fileComponents << std::endl; //picComponents = 4; //Copy image ret->init(width,height,(int)picComponents); uint8* pixels = ret->getPixels(); - const size_t rowbytes = info_ptr->rowbytes; + const size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr); size_t location = 0; for (int y = height-1; y >= 0; --y) { //you have to somehow invert the lines if (picComponents == fileComponents) {