From 53604c70f5a43d47e78317d5625b74aab03b27f2 Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 15 Jan 2011 19:16:00 +0000 Subject: Fix build with png-1.5. --- news/knews/distinfo | 4 +-- news/knews/patches/patch-bd | 70 +++++++++++++++++++++++++++------------------ 2 files changed, 44 insertions(+), 30 deletions(-) (limited to 'news') diff --git a/news/knews/distinfo b/news/knews/distinfo index 54340079a2b..3118663d078 100644 --- a/news/knews/distinfo +++ b/news/knews/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.8 2005/02/24 12:19:55 agc Exp $ +$NetBSD: distinfo,v 1.9 2011/01/15 19:16:00 tron Exp $ SHA1 (knews-1.0b.1.tar.gz) = b56046036d4c6688439e6730b8ae2a2eade922db RMD160 (knews-1.0b.1.tar.gz) = c29cd8401bd802852f875d3c531f2f0f8805cc43 @@ -32,7 +32,7 @@ SHA1 (patch-az) = 1d91236b5f1dd59e54e9d8b02f31090abe70b67b SHA1 (patch-ba) = a46041cc02ec99379d1c7a69534ca4574a1d8b77 SHA1 (patch-bb) = 05963335420741b8ce5658ad43cbfa83379fe289 SHA1 (patch-bc) = 74b0c0ee543f3753886dc75ea7d32a61256eb5b5 -SHA1 (patch-bd) = bda85621f338cecd8796a42170bfa493bb0592f4 +SHA1 (patch-bd) = ed7df6088ef3bf837b4ea52e404030fa2108c399 SHA1 (patch-be) = 3cf47af64e7865f3336b0549b78e3f56bbff2252 SHA1 (patch-bf) = 5d51af81738c227de3ec6d23bbfe33c593410614 SHA1 (patch-bg) = 84e4daf47ca111831661448c4411da4d9c803d27 diff --git a/news/knews/patches/patch-bd b/news/knews/patches/patch-bd index d91e014c47f..75a99eecfc2 100644 --- a/news/knews/patches/patch-bd +++ b/news/knews/patches/patch-bd @@ -1,7 +1,9 @@ -$NetBSD: patch-bd,v 1.2 2002/03/15 03:25:57 fredb Exp $ +$NetBSD: patch-bd,v 1.3 2011/01/15 19:16:00 tron Exp $ ---- src/png.c.orig Sat Nov 21 08:55:13 1998 -+++ src/png.c +Fix build with png-1.5. + +--- src/png.c.orig 1998-11-21 14:55:13.000000000 +0000 ++++ src/png.c 2011-01-15 19:09:09.000000000 +0000 @@ -78,8 +78,8 @@ Pixmap do_png(char *data, long len, long *wp, long *hp) @@ -26,36 +28,44 @@ $NetBSD: patch-bd,v 1.2 2002/03/15 03:25:57 fredb Exp $ ArtTextAddLine(main_widgets.text, "[knews: png error.]", ascii_font->body_font, global.alert_pixel); else { -@@ -108,58 +112,55 @@ +@@ -107,59 +111,63 @@ + int did; unsigned int per_line = 0; unsigned int i, j, pass; ++ png_color_16p background; ++ png_byte color_type; ++ png_colorp palette; ++ int num_palette; ++ ++ png_init_io(p_str, vol_fp); ++ png_read_info(p_str, p_info); ++ ++ vol_w = w = png_get_image_width(p_str, p_info); ++ vol_h = h = png_get_image_height(p_str, p_info); ++ ++ if (png_get_bit_depth(p_str, p_info) == 16) ++ png_set_strip_16(p_str); ++ else if (png_get_bit_depth(p_str, p_info) < 8) ++ png_set_packing(p_str); - png_read_init(&p_str); - png_info_init(&p_info); - - png_init_io(&p_str, vol_fp); - png_read_info(&p_str, &p_info); -+ png_init_io(p_str, vol_fp); -+ png_read_info(p_str, p_info); - +- - vol_w = w = p_info.width; - vol_h = h = p_info.height; -+ vol_w = w = p_info->width; -+ vol_h = h = p_info->height; - +- - if (p_info.bit_depth == 16) - png_set_strip_16(&p_str); - else if (p_info.bit_depth < 8) - png_set_packing(&p_str); -+ if (p_info->bit_depth == 16) -+ png_set_strip_16(p_str); -+ else if (p_info->bit_depth < 8) -+ png_set_packing(p_str); - +- - if (p_info.valid & PNG_INFO_bKGD) - png_set_background(&p_str, &p_info.background, -+ if (p_info->valid & PNG_INFO_bKGD) -+ png_set_background(p_str, &p_info->background, ++ if (png_get_bKGD(p_str, p_info, &background) & PNG_INFO_bKGD) ++ png_set_background(p_str, background, PNG_BACKGROUND_GAMMA_FILE, True, 1.0); else { static png_color_16 bg = {0, }; @@ -67,38 +77,42 @@ $NetBSD: patch-bd,v 1.2 2002/03/15 03:25:57 fredb Exp $ per_line = w; - if (!(p_info.color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ -+ if (!(p_info->color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ ++ color_type = png_get_color_type(p_str, p_info); ++ if (!(color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ grey = True; - png_set_expand(&p_str); + png_set_expand(p_str); } else if (!p_cmap) { /* true color visual */ - if (p_info.color_type == PNG_COLOR_TYPE_PALETTE) - png_set_expand(&p_str); -+ if (p_info->color_type == PNG_COLOR_TYPE_PALETTE) ++ if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_expand(p_str); per_line *= 3; - } else if (p_info.color_type & PNG_COLOR_MASK_PALETTE) { -+ } else if (p_info->color_type & PNG_COLOR_MASK_PALETTE) { ++ } else if (color_type & PNG_COLOR_MASK_PALETTE && ++ png_get_PLTE(p_str, p_info, ++ &palette, &num_palette) & PNG_INFO_PLTE) { CMAP_ENTRY *pal; int i, pn; - pn = p_info.num_palette; -+ pn = p_info->num_palette; ++ pn = num_palette; pal = (CMAP_ENTRY *)XtMalloc(pn * sizeof *pal); for (i = 0 ; i < pn ; i++) { - pal[i].r = p_info.palette[i].red; - pal[i].g = p_info.palette[i].green; - pal[i].b = p_info.palette[i].blue; -+ pal[i].r = p_info->palette[i].red; -+ pal[i].g = p_info->palette[i].green; -+ pal[i].b = p_info->palette[i].blue; ++ pal[i].r = palette[i].red; ++ pal[i].g = palette[i].green; ++ pal[i].b = palette[i].blue; } vol_pal = pal; vol_pn = pn; } else { - png_set_dither(&p_str, p_cmap, cmap_size, -+ png_set_dither(p_str, p_cmap, cmap_size, - cmap_size, NULL, True); +- cmap_size, NULL, True); ++ png_set_quantize(p_str, p_cmap, cmap_size, ++ cmap_size, NULL, True); } - pass = png_set_interlace_handling(&p_str); @@ -108,7 +122,7 @@ $NetBSD: patch-bd,v 1.2 2002/03/15 03:25:57 fredb Exp $ vol_pic = pic = (unsigned char *)XtMalloc(h * per_line); -@@ -167,14 +168,14 @@ +@@ -167,14 +175,14 @@ for (i = 0 ; i < pass ; i++) { row = pic; for (j = 0 ; j < h ; j++) { @@ -125,7 +139,7 @@ $NetBSD: patch-bd,v 1.2 2002/03/15 03:25:57 fredb Exp $ } if (!vol_did) -@@ -204,7 +205,10 @@ +@@ -204,7 +212,10 @@ } } -- cgit v1.2.3