1 $OpenBSD: patch-htmldoc_image_cxx,v 1.1 2011/07/08 20:36:09 naddy Exp $
3 Fix build with png-1.5.
5 --- htmldoc/image.cxx.orig Wed May 31 13:00:02 2006
6 +++ htmldoc/image.cxx Wed Jul 6 15:22:43 2011
7 @@ -1472,6 +1472,9 @@ image_load_png(image_t *img, /* I - Image pointer */
8 png_bytep *rows; /* PNG row pointers */
9 uchar *inptr, /* Input pixels */
10 *outptr; /* Output pixels */
11 + png_bytep trans_alpha;
13 + png_color_16p trans_color;
17 @@ -1499,7 +1502,7 @@ image_load_png(image_t *img, /* I - Image pointer */
21 - if (setjmp(pp->jmpbuf))
22 + if (setjmp(png_jmpbuf(pp)))
24 progress_error(HD_ERROR_BAD_FORMAT, "PNG file contains errors!");
26 @@ -1526,7 +1529,7 @@ image_load_png(image_t *img, /* I - Image pointer */
28 png_read_info(pp, info);
30 - if (info->color_type & PNG_COLOR_MASK_PALETTE)
31 + if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
35 @@ -1535,15 +1538,15 @@ image_load_png(image_t *img, /* I - Image pointer */
39 - else if (info->bit_depth < 8)
40 + else if (png_get_bit_depth(pp, info) < 8)
45 - else if (info->bit_depth == 16)
46 + else if (png_get_bit_depth(pp, info) == 16)
49 - if (info->color_type & PNG_COLOR_MASK_COLOR)
50 + if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
53 img->depth = gray ? 1 : 3;
54 @@ -1554,10 +1557,11 @@ image_load_png(image_t *img, /* I - Image pointer */
58 - img->width = info->width;
59 - img->height = info->height;
60 + img->width = png_get_image_width(pp, info);
61 + img->height = png_get_image_height(pp, info);
63 - if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
64 + png_get_tRNS(pp, info, &trans_alpha, &num_trans, &trans_color);
65 + if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
67 if ((PSLevel == 0 && PDFVersion >= 14) || PSLevel == 3)
68 image_need_mask(img, 8);
69 @@ -1571,14 +1575,14 @@ image_load_png(image_t *img, /* I - Image pointer */
72 printf("color_type=0x%04x, depth=%d, img->width=%d, img->height=%d, img->depth=%d\n",
73 - info->color_type, depth, img->width, img->height, img->depth);
74 - if (info->color_type & PNG_COLOR_MASK_COLOR)
75 + png_get_color_type(pp, info), depth, img->width, img->height, img->depth);
76 + if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
80 - if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
81 + if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
83 - if (info->color_type & PNG_COLOR_MASK_PALETTE)
84 + if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
88 @@ -1594,9 +1598,9 @@ image_load_png(image_t *img, /* I - Image pointer */
89 * Allocate pointers...
92 - rows = (png_bytep *)calloc(info->height, sizeof(png_bytep));
93 + rows = (png_bytep *)calloc(png_get_image_height(pp, info), sizeof(png_bytep));
95 - for (i = 0; i < (int)info->height; i ++)
96 + for (i = 0; i < (int)png_get_image_height(pp, info); i ++)
97 rows[i] = img->pixels + i * img->width * depth;
100 @@ -1610,7 +1614,7 @@ image_load_png(image_t *img, /* I - Image pointer */
101 * Generate the alpha mask as necessary...
104 - if ((info->color_type & PNG_COLOR_MASK_ALPHA) || info->num_trans)
105 + if ((png_get_color_type(pp, info) & PNG_COLOR_MASK_ALPHA) || num_trans)
108 for (inptr = img->pixels, i = 0; i < img->height; i ++)
109 @@ -1639,7 +1643,7 @@ image_load_png(image_t *img, /* I - Image pointer */
110 * Reformat the data as necessary for the reader...
113 - if (gray && info->color_type & PNG_COLOR_MASK_COLOR)
114 + if (gray && png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
117 * Greyscale output needed...