--- htmldoc/image.cxx.old 2011-10-03 16:43:23.000000000 -0400 +++ htmldoc/image.cxx 2011-10-03 16:59:05.000000000 -0400 @@ -55,6 +55,7 @@ #include /* JPEG/JFIF image definitions */ } +#include #include /* Portable Network Graphics (PNG) definitions */ @@ -1499,14 +1500,15 @@ rows = NULL; - if (setjmp(pp->jmpbuf)) + if (setjmp(png_jmpbuf(pp))) { progress_error(HD_ERROR_BAD_FORMAT, "PNG file contains errors!"); png_destroy_read_struct(&pp, &info, NULL); +/* -- no longer needed, afaik if (img != NULL && img->pixels != NULL) - free(img->pixels); + free(img->pixels); */ if (rows != NULL) free(rows); @@ -1526,7 +1528,7 @@ png_read_info(pp, info); - if (info->color_type & PNG_COLOR_MASK_PALETTE) + if (png_get_color_type(pp,info) & PNG_COLOR_MASK_PALETTE) { png_set_expand(pp); @@ -1535,29 +1537,29 @@ if (Encryption) img->use ++; } - else if (info->bit_depth < 8) + else if (png_get_bit_depth(pp,info) < 8) { png_set_packing(pp); png_set_expand(pp); } - else if (info->bit_depth == 16) + else if (png_get_bit_depth(pp,info) == 16) png_set_strip_16(pp); - if (info->color_type & PNG_COLOR_MASK_COLOR) + if (png_get_color_type(pp,info) & PNG_COLOR_MASK_COLOR) { depth = 3; - img->depth = gray ? 1 : 3; + img->depth = gray ? 1 : 3; } else { depth = 1; - img->depth = 1; + img->depth = 1; } - img->width = info->width; - img->height = info->height; + img->width = png_get_image_width(pp,info); + img->height = png_get_image_height(pp,info); - if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans) + if ((png_get_color_type(pp,info) & PNG_COLOR_MASK_ALPHA)) { if ((PSLevel == 0 && PDFVersion >= 14) || PSLevel == 3) image_need_mask(img, 8); @@ -1572,6 +1574,7 @@ #ifdef DEBUG printf("color_type=0x%04x, depth=%d, img->width=%d, img->height=%d, img->depth=%d\n", info->color_type, depth, img->width, img->height, img->depth); +/* all of this is old and i don't care to bother converting if (info->color_type & PNG_COLOR_MASK_COLOR) puts(" COLOR"); else @@ -1580,6 +1583,7 @@ puts(" ALPHA"); if (info->color_type & PNG_COLOR_MASK_PALETTE) puts(" PALETTE"); +*/ #endif // DEBUG if (!load_data) @@ -1594,9 +1598,9 @@ * Allocate pointers... */ - rows = (png_bytep *)calloc(info->height, sizeof(png_bytep)); + rows = (png_bytep *)calloc(img->height, sizeof(png_bytep)); - for (i = 0; i < (int)info->height; i ++) + for (i = 0; i < (int)img->height; i ++) rows[i] = img->pixels + i * img->width * depth; /* @@ -1610,7 +1614,7 @@ * Generate the alpha mask as necessary... */ - if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans) + if ((png_get_color_type(pp,info) & PNG_COLOR_MASK_ALPHA)) { #ifdef DEBUG for (inptr = img->pixels, i = 0; i < img->height; i ++) @@ -1639,7 +1643,7 @@ * Reformat the data as necessary for the reader... */ - if (gray && info->color_type & PNG_COLOR_MASK_COLOR) + if (gray && png_get_color_type(pp,info) & PNG_COLOR_MASK_COLOR) { /* * Greyscale output needed...