From b7568b4e009c1b7bf554e6fb12c49ddffcf38f98 Mon Sep 17 00:00:00 2001 From: wiz Date: Mon, 7 Feb 2011 21:28:56 +0000 Subject: Fix build with png-1.5. --- graphics/xart/Makefile | 5 +- graphics/xart/distinfo | 6 +- graphics/xart/patches/patch-af | 140 ++++++++++++++++++++++++++++++++--- graphics/xart/patches/patch-ag | 162 +++++++++++++++++++++++++++++++++++++++-- 4 files changed, 294 insertions(+), 19 deletions(-) diff --git a/graphics/xart/Makefile b/graphics/xart/Makefile index 9a380759ca5..5c5213b5dd4 100644 --- a/graphics/xart/Makefile +++ b/graphics/xart/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.52 2011/01/13 13:38:23 wiz Exp $ +# $NetBSD: Makefile,v 1.53 2011/02/07 21:28:56 wiz Exp $ # DISTNAME= xart19980415 @@ -11,6 +11,9 @@ EXTRACT_SUFX= .tgz MAINTAINER= pkgsrc-users@NetBSD.org HOMEPAGE= http://linux01.gwdg.de/~rhohen/linux.html COMMENT= Paint program (enhanced xpaint) +# quite like isc, but copyright needs to mention in documentation as well +# see the bottom of the included "Help.txt" file +#LICENSE= isc PKG_DESTDIR_SUPPORT= user-destdir diff --git a/graphics/xart/distinfo b/graphics/xart/distinfo index ee54cd0f246..6a6dcd11506 100644 --- a/graphics/xart/distinfo +++ b/graphics/xart/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.13 2010/06/13 22:44:46 wiz Exp $ +$NetBSD: distinfo,v 1.14 2011/02/07 21:28:56 wiz Exp $ SHA1 (xart19980415.tgz) = d4445392e33a5dcf5ae951babac82394e7cdd65c RMD160 (xart19980415.tgz) = 99077c23a798d8c0026bd53450052b1a8cf6ff6f @@ -8,8 +8,8 @@ SHA1 (patch-ab) = b0f00e29560ce786e37a8ba62fef82dae80c4ee9 SHA1 (patch-ac) = 618003b6d192e85a1aa5f64b0f8eccfec991012e SHA1 (patch-ad) = 08059ca068d156be0e31283180c5deaebb99f7bd SHA1 (patch-ae) = d0d87fe957cbec5979e635270d2ad05b294f7530 -SHA1 (patch-af) = 2ee00a7b02d14a5962ac0f561ede6423c4d45801 -SHA1 (patch-ag) = c764ddf68af02eda1475778e6c1774d751e68a92 +SHA1 (patch-af) = 7253489721eead898cd3a67878584d86b7719e3f +SHA1 (patch-ag) = 58bf357debce54707378b6598ca813af6a632e3b SHA1 (patch-ah) = f888c5167cd8a6111e2064d586ff50984320b210 SHA1 (patch-ai) = 349170a16199734f35dc56de12e77dd289db412b SHA1 (patch-aj) = 7139b114301de5becf1449bd2b346223b205a908 diff --git a/graphics/xart/patches/patch-af b/graphics/xart/patches/patch-af index e4340b745e6..c23da132765 100644 --- a/graphics/xart/patches/patch-af +++ b/graphics/xart/patches/patch-af @@ -1,8 +1,19 @@ -$NetBSD: patch-af,v 1.2 2006/04/19 17:04:31 wiz Exp $ +$NetBSD: patch-af,v 1.3 2011/02/07 21:28:56 wiz Exp $ ---- rw/readPNG.c.orig 1996-08-29 07:24:48.000000000 +0200 +Fix build with png-1.5. + +--- rw/readPNG.c.orig 1996-08-29 05:24:48.000000000 +0000 +++ rw/readPNG.c -@@ -46,8 +46,8 @@ Image * +@@ -28,7 +28,7 @@ + int + TestPNG(char *file) /* gets called a LOT on the first image: brushes? */ + { +- char header[8]; ++ unsigned char header[8]; + FILE *fp = fopen(file, "rb"); /* libpng requires ANSI; so do we */ + + if (!fp) +@@ -46,11 +46,13 @@ Image * ReadPNG(char *file) { FILE *fp; @@ -13,7 +24,12 @@ $NetBSD: patch-af,v 1.2 2006/04/19 17:04:31 wiz Exp $ int i, hasAlpha=FALSE; int width, height, level, bit_depth, npasses; Image *image = NULL; -@@ -59,14 +59,15 @@ ReadPNG(char *file) ++ png_colorp palette; ++ int num_palette; + + + Trace((stderr, "\nGRR ReadPNG: reading file %s\n", file)); +@@ -59,14 +61,15 @@ ReadPNG(char *file) return NULL; } @@ -31,7 +47,7 @@ $NetBSD: patch-af,v 1.2 2006/04/19 17:04:31 wiz Exp $ if (!info_ptr) { RWSetMsg("Error allocating PNG info_ptr memory"); free(png_ptr); -@@ -74,17 +75,13 @@ ReadPNG(char *file) +@@ -74,38 +77,36 @@ ReadPNG(char *file) return NULL; } @@ -51,8 +67,72 @@ $NetBSD: patch-af,v 1.2 2006/04/19 17:04:31 wiz Exp $ png_init_io(png_ptr, fp); png_read_info(png_ptr, info_ptr); -@@ -183,7 +180,7 @@ ReadPNG(char *file) - info_ptr->color_type); +- width = info_ptr->width; +- height = info_ptr->height; ++ width = png_get_image_width(png_ptr, info_ptr); ++ height = png_get_image_height(png_ptr, info_ptr); + + Trace((stderr, "GRR ReadPNG: width = %d, height = %d\n", width, height)); +- switch (info_ptr->color_type) { ++ ++ png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette); ++ switch (png_get_color_type(png_ptr, info_ptr)) { + + case PNG_COLOR_TYPE_PALETTE: + Trace((stderr, "GRR ReadPNG: PNG_COLOR_TYPE_PALETTE\n")); +- image = ImageNewCmap(width, height, info_ptr->num_palette); +- for (i = 0; i < info_ptr->num_palette; ++i) +- ImageSetCmap(image, i, info_ptr->palette[i].red, +- info_ptr->palette[i].green, info_ptr->palette[i].blue); ++ image = ImageNewCmap(width, height, num_palette); ++ for (i = 0; i < num_palette; ++i) ++ ImageSetCmap(image, i, palette[i].red, ++ palette[i].green, palette[i].blue); + /* GRR: still need to get image data into `image' */ + break; + + case PNG_COLOR_TYPE_RGB: + Trace((stderr, "GRR ReadPNG: PNG_COLOR_TYPE_RGB\n")); +- if (info_ptr->bit_depth == 16) { ++ if (png_get_bit_depth(png_ptr, info_ptr) == 16) { + RWSetMsg("Stripping 48-bit RGB image to 24 bits"); + fprintf(stderr, + "ReadPNG: stripping 48-bit RGB image to 24 bits\n"); +@@ -117,8 +118,8 @@ ReadPNG(char *file) + + case PNG_COLOR_TYPE_GRAY: /* treat grayscale as special colormap */ + Trace((stderr, "GRR ReadPNG: PNG_COLOR_TYPE_GRAY\n")); +- bit_depth = info_ptr->bit_depth; +- if (info_ptr->bit_depth == 16) { ++ bit_depth = png_get_bit_depth(png_ptr, info_ptr); ++ if (bit_depth == 16) { + RWSetMsg("Stripping 16-bit grayscale image to 8 bits"); + fprintf(stderr, + "ReadPNG: stripping 16-bit grayscale image to 8 bits\n"); +@@ -157,7 +158,7 @@ ReadPNG(char *file) + + case PNG_COLOR_TYPE_RGB_ALPHA: + Trace((stderr, "GRR ReadPNG: PNG_COLOR_TYPE_RGB_ALPHA\n")); +- if (info_ptr->bit_depth == 16) { ++ if (png_get_bit_depth(png_ptr, info_ptr) == 16) { + RWSetMsg("Stripping 64-bit RGBA image to 32 bits"); + png_set_strip_16(png_ptr); + } +@@ -169,7 +170,7 @@ ReadPNG(char *file) + + case PNG_COLOR_TYPE_GRAY_ALPHA: + Trace((stderr, "GRR ReadPNG: PNG_COLOR_TYPE_GRAY_ALPHA\n")); +- if (info_ptr->bit_depth == 16) { ++ if (png_get_bit_depth(png_ptr, info_ptr) == 16) { + RWSetMsg("Stripping 32-bit gray+alpha image to 16 bits"); + png_set_strip_16(png_ptr); + } +@@ -180,20 +181,20 @@ ReadPNG(char *file) + + default: + fprintf(stderr, "ReadPNG: unknown image type (%d)\n", +- info_ptr->color_type); ++ png_get_color_type(png_ptr, info_ptr)); fflush(stderr); RWSetMsg("Unknown PNG image type"); - png_read_destroy(png_ptr, info_ptr, (png_infop)NULL); @@ -60,7 +140,26 @@ $NetBSD: patch-af,v 1.2 2006/04/19 17:04:31 wiz Exp $ free(png_ptr); free(info_ptr); fclose(fp); -@@ -217,7 +214,7 @@ ReadPNG(char *file) + return image; /* NULL */ + } + +- if (info_ptr->bit_depth < 8) ++ if (png_get_bit_depth(png_ptr, info_ptr) < 8) + png_set_packing(png_ptr); + +- if (info_ptr->interlace_type) ++ if (png_get_interlace_type(png_ptr, info_ptr)) + npasses = png_set_interlace_handling(png_ptr); + + png_read_update_info(png_ptr, info_ptr); +@@ -211,13 +212,13 @@ ReadPNG(char *file) + * no easy way around it: libpng returns the image and alpha channel + * interspersed, and interlaced alpha images just make matters worse + */ +- png_data = (png_bytep)malloc(height*info_ptr->rowbytes); ++ png_data = (png_bytep)malloc(height*png_get_rowbytes(png_ptr, info_ptr)); + if (!png_data) { + RWSetMsg("Unable to allocate temporary storage for alpha image"); fprintf(stderr, "ReadPNG error: unable to malloc png_data\n"); fflush(stderr); ImageDelete(image); @@ -69,7 +168,30 @@ $NetBSD: patch-af,v 1.2 2006/04/19 17:04:31 wiz Exp $ free(png_ptr); free(info_ptr); fclose(fp); -@@ -271,7 +268,7 @@ ReadPNG(char *file) +@@ -226,11 +227,11 @@ ReadPNG(char *file) + + /* only bit depths of 8 and 16 support alpha channels */ + for (i = 0; i < height; ++i) +- row_pointers[i] = (png_bytep)png_data + i*info_ptr->rowbytes; ++ row_pointers[i] = (png_bytep)png_data + i*png_get_rowbytes(png_ptr, info_ptr); + + png_read_image(png_ptr, row_pointers); + +- if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { ++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_RGB_ALPHA) { + png_bytep png=png_data, rgb=image->data, alpha=image->maskData; + + for (i = 0; i < height*width; ++i) { +@@ -258,7 +259,7 @@ ReadPNG(char *file) + return NULL; + } + for (i = 0; i < height; ++i) +- row_pointers[i] = (png_bytep)image->data + i*info_ptr->rowbytes; ++ row_pointers[i] = (png_bytep)image->data + i*png_get_rowbytes(png_ptr, info_ptr); + + png_read_image(png_ptr, row_pointers); + +@@ -271,7 +272,7 @@ ReadPNG(char *file) */ png_read_end(png_ptr, info_ptr); diff --git a/graphics/xart/patches/patch-ag b/graphics/xart/patches/patch-ag index c62e0c04764..461bdfe5eaa 100644 --- a/graphics/xart/patches/patch-ag +++ b/graphics/xart/patches/patch-ag @@ -1,8 +1,20 @@ -$NetBSD: patch-ag,v 1.1 2001/08/03 09:43:18 wiz Exp $ +$NetBSD: patch-ag,v 1.2 2011/02/07 21:28:56 wiz Exp $ ---- rw/writePNG.c.orig Thu Aug 29 07:24:57 1996 +Fix build with png-1.5. + +--- rw/writePNG.c.orig 1996-08-29 05:24:57.000000000 +0000 +++ rw/writePNG.c -@@ -38,26 +38,23 @@ +@@ -31,6 +31,9 @@ WritePNG(char *file, Image *image, int i + png_structp png_ptr; + png_infop info_ptr; + png_textp software; ++ int bit_depth; ++ int color_type; ++ png_timep mod_time; + + + Trace((stderr, "\nGRR WritePNG: %d x %d, scale = %d\n", +@@ -38,47 +41,41 @@ WritePNG(char *file, Image *image, int i if (!fp) return 1; @@ -34,8 +46,146 @@ $NetBSD: patch-ag,v 1.1 2001/08/03 09:43:18 wiz Exp $ - png_write_init(png_ptr); png_init_io(png_ptr, fp); - info_ptr->width = image->width; -@@ -200,9 +197,7 @@ +- info_ptr->width = image->width; +- info_ptr->height = image->height; +- + if (image->isBW) { + if (image->maskData) { +- info_ptr->color_type = PNG_COLOR_TYPE_GRAY_ALPHA; +- info_ptr->bit_depth = 8; /* promote to full grayscale */ ++ color_type = PNG_COLOR_TYPE_GRAY_ALPHA; ++ bit_depth = 8; /* promote to full grayscale */ + } else { +- info_ptr->color_type = PNG_COLOR_TYPE_GRAY; +- info_ptr->bit_depth = 1; ++ color_type = PNG_COLOR_TYPE_GRAY; ++ bit_depth = 1; + } + Trace((stderr, "GRR WritePNG: B/W, bit_depth = %d\n", +- info_ptr->bit_depth)); ++ bit_depth)); + + } else if (image->isGrey) { +- info_ptr->color_type = image->maskData? PNG_COLOR_TYPE_GRAY_ALPHA : ++ color_type = image->maskData? PNG_COLOR_TYPE_GRAY_ALPHA : + PNG_COLOR_TYPE_GRAY; + if (image->cmapPacked) +- info_ptr->bit_depth = 8; ++ bit_depth = 8; + else { + Trace((stderr, + "GRR WritePNG: isGrey: cmapSize = %d (before compressing), ", +@@ -86,15 +83,15 @@ WritePNG(char *file, Image *image, int i + compressColormap(image); + Trace((stderr, "%d (after)\n", image->cmapSize)); + if (image->cmapSize > 16) +- info_ptr->bit_depth = 8; ++ bit_depth = 8; + else if (image->cmapSize > 4) +- info_ptr->bit_depth = 4; ++ bit_depth = 4; + else if (image->cmapSize > 2) +- info_ptr->bit_depth = 2; ++ bit_depth = 2; + else +- info_ptr->bit_depth = 1; ++ bit_depth = 1; + Trace((stderr, "GRR WritePNG: isGrey: picked bit_depth = %d\n", +- info_ptr->bit_depth)); ++ bit_depth)); + } + + } else if (image->scale == 3) { +@@ -107,9 +104,9 @@ WritePNG(char *file, Image *image, int i + if (cmapImage) { + image = cmapImage; /* original was deleted in ImageCompress() */ + } else { +- info_ptr->color_type = image->maskData? PNG_COLOR_TYPE_RGB_ALPHA : ++ color_type = image->maskData? PNG_COLOR_TYPE_RGB_ALPHA : + PNG_COLOR_TYPE_RGB; +- info_ptr->bit_depth = 8; ++ bit_depth = 8; + Trace((stderr, "GRR WritePNG: RGB, bit_depth = 8\n")); + } + } +@@ -129,7 +126,7 @@ WritePNG(char *file, Image *image, int i + * ImageCompress() worked + */ + if (image->scale == 1) { +- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; ++ color_type = PNG_COLOR_TYPE_PALETTE; + if (image->maskData) { + fprintf(stderr, + "WritePNG: can't use alpha mask with colormapped image\n"); +@@ -139,18 +136,17 @@ WritePNG(char *file, Image *image, int i + if (!image->cmapPacked) + compressColormap(image); + if (image->cmapSize > 16) +- info_ptr->bit_depth = 8; ++ bit_depth = 8; + else if (image->cmapSize > 4) +- info_ptr->bit_depth = 4; ++ bit_depth = 4; + else if (image->cmapSize > 2) +- info_ptr->bit_depth = 2; ++ bit_depth = 2; + else +- info_ptr->bit_depth = 1; +- info_ptr->valid |= PNG_INFO_PLTE; +- info_ptr->num_palette = image->cmapSize; +- info_ptr->palette = (png_colorp)image->cmapData; /* seems to work... */ +- Trace((stderr, "%d, num_palette = %d\n", info_ptr->bit_depth, +- info_ptr->num_palette)); ++ bit_depth = 1; ++ png_set_PLTE(png_ptr, info_ptr, (png_colorp)image->cmapData, ++ image->cmapSize); /* seems to work... */ ++ Trace((stderr, "%d, num_palette = %d\n", bit_depth, ++ image->cmapSize)); + #if 0 + for (i = 0; i < image->cmapSize; ++i) { + info_ptr->palette[i].red = +@@ -160,14 +156,15 @@ WritePNG(char *file, Image *image, int i + #endif + } + +- info_ptr->interlace_type = interlace_type; ++ png_set_IHDR(png_ptr, info_ptr, image->width, image->height, ++ bit_depth, color_type, interlace_type, PNG_COMPRESSION_TYPE_BASE, ++ PNG_FILTER_TYPE_BASE); + + /* set the file gamma */ +- info_ptr->valid |= PNG_INFO_gAMA; + #ifdef DISPLAY_GAMMA +- info_ptr->gamma = 1.0 / DISPLAY_GAMMA; ++ png_set_gAMA(png_ptr, info_ptr, 1.0 / DISPLAY_GAMMA); + #else +- info_ptr->gamma = 0.45; /* default: assume PC-like system */ ++ png_set_gAMA(png_ptr, info_ptr, 0.45); /* default: assume PC-like system */ + #endif + + /* info_ptr->valid |= PNG_INFO_tEXt; DOES NOT EXIST */ +@@ -180,16 +177,14 @@ WritePNG(char *file, Image *image, int i + software->key = "Software"; + software->text = software_text; + software->text_length = strlen(software->text); +- info_ptr->num_text = 1; +- info_ptr->text = software; ++ png_set_text(png_ptr, info_ptr, software, 1); + } else { + /* couldn't malloc: oh well */ +- info_ptr->num_text = 0; +- info_ptr->text = NULL; ++ png_set_text(png_ptr, info_ptr, NULL, 0); + } + +- info_ptr->valid |= PNG_INFO_tIME; +- png_convert_from_time_t(&info_ptr->mod_time, time(NULL)); ++ png_convert_from_time_t(mod_time, time(NULL)); ++ png_set_tIME(png_ptr, info_ptr, mod_time); + + png_write_flush(png_ptr); + png_write_info(png_ptr, info_ptr); +@@ -200,9 +195,7 @@ WritePNG(char *file, Image *image, int i /* alpha channel version */ fprintf(stderr, "WritePNG: sorry, can't write alpha images yet\n"); fflush(stderr); @@ -46,7 +196,7 @@ $NetBSD: patch-ag,v 1.1 2001/08/03 09:43:18 wiz Exp $ fclose(fp); return 1; } else { -@@ -222,13 +217,11 @@ +@@ -222,13 +215,11 @@ WritePNG(char *file, Image *image, int i } png_write_end(png_ptr, NULL); -- cgit v1.2.3