]> git.pld-linux.org Git - packages/htmldoc.git/blob - htmldoc-libpng15.patch
- new, patch from openbsd
[packages/htmldoc.git] / htmldoc-libpng15.patch
1 $OpenBSD: patch-htmldoc_image_cxx,v 1.1 2011/07/08 20:36:09 naddy Exp $
2
3 Fix build with png-1.5.
4
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;
12 +  int num_trans;
13 +  png_color_16p trans_color;
14  
15  
16   /*
17 @@ -1499,7 +1502,7 @@ image_load_png(image_t *img,      /* I - Image pointer */
18  
19    rows = NULL;
20  
21 -  if (setjmp(pp->jmpbuf)) 
22 +  if (setjmp(png_jmpbuf(pp))) 
23    {
24      progress_error(HD_ERROR_BAD_FORMAT, "PNG file contains errors!");
25  
26 @@ -1526,7 +1529,7 @@ image_load_png(image_t *img,      /* I - Image pointer */
27  
28    png_read_info(pp, info);
29  
30 -  if (info->color_type & PNG_COLOR_MASK_PALETTE)
31 +  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
32    {
33      png_set_expand(pp);
34  
35 @@ -1535,15 +1538,15 @@ image_load_png(image_t *img,    /* I - Image pointer */
36      if (Encryption)
37        img->use ++;
38    }
39 -  else if (info->bit_depth < 8)
40 +  else if (png_get_bit_depth(pp, info) < 8)
41    {
42      png_set_packing(pp);
43      png_set_expand(pp);
44    }
45 -  else if (info->bit_depth == 16)
46 +  else if (png_get_bit_depth(pp, info) == 16)
47      png_set_strip_16(pp);
48  
49 -  if (info->color_type & PNG_COLOR_MASK_COLOR)
50 +  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
51    {
52      depth      = 3;
53      img->depth = gray ? 1 : 3;
54 @@ -1554,10 +1557,11 @@ image_load_png(image_t *img,    /* I - Image pointer */
55      img->depth = 1;
56    }
57  
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);
62  
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)
66    {
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 */
70  
71  #ifdef DEBUG
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)
77      puts("    COLOR");
78    else
79      puts("    GRAYSCALE");
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)
82      puts("    ALPHA");
83 -  if (info->color_type & PNG_COLOR_MASK_PALETTE)
84 +  if (png_get_color_type(pp, info) & PNG_COLOR_MASK_PALETTE)
85      puts("    PALETTE");
86  #endif // DEBUG
87  
88 @@ -1594,9 +1598,9 @@ image_load_png(image_t *img,      /* I - Image pointer */
89    * Allocate pointers...
90    */
91  
92 -  rows = (png_bytep *)calloc(info->height, sizeof(png_bytep));
93 +  rows = (png_bytep *)calloc(png_get_image_height(pp, info), sizeof(png_bytep));
94  
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;
98  
99   /*
100 @@ -1610,7 +1614,7 @@ image_load_png(image_t *img,      /* I - Image pointer */
101    * Generate the alpha mask as necessary...
102    */
103  
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)
106    {
107  #ifdef DEBUG
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...
111    */
112  
113 -  if (gray && info->color_type & PNG_COLOR_MASK_COLOR)
114 +  if (gray && png_get_color_type(pp, info) & PNG_COLOR_MASK_COLOR)
115    {
116     /*
117      * Greyscale output needed...
This page took 0.072672 seconds and 3 git commands to generate.