diff options
author | wiz <wiz@pkgsrc.org> | 2011-04-19 10:28:31 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2011-04-19 10:28:31 +0000 |
commit | 239420dd48733e36080d875e9c8ea785a3da3bc2 (patch) | |
tree | f296aa6f6457bf4c8e255b21c1559688de4311e1 /graphics/gimp/patches | |
parent | b21b91797b750615325d9a87c376abab31eba2ea (diff) | |
download | pkgsrc-239420dd48733e36080d875e9c8ea785a3da3bc2.tar.gz |
Fix palette cases, after bug report from Gentoo.
Bump PKGREVISION.
Diffstat (limited to 'graphics/gimp/patches')
-rw-r--r-- | graphics/gimp/patches/patch-ae | 53 | ||||
-rw-r--r-- | graphics/gimp/patches/patch-af | 80 |
2 files changed, 76 insertions, 57 deletions
diff --git a/graphics/gimp/patches/patch-ae b/graphics/gimp/patches/patch-ae index e1418daf70e..7a3a3e98f33 100644 --- a/graphics/gimp/patches/patch-ae +++ b/graphics/gimp/patches/patch-ae @@ -1,4 +1,4 @@ -$NetBSD: patch-ae,v 1.12 2011/01/24 12:35:33 wiz Exp $ +$NetBSD: patch-ae,v 1.13 2011/04/19 10:28:31 wiz Exp $ Fix build with png-1.5. https://bugzilla.gnome.org/show_bug.cgi?id=640409 @@ -28,7 +28,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 { g_warning ("HRM saving PNG in mng_save_image()"); png_destroy_write_struct (&png_ptr, &png_info_ptr); -@@ -981,34 +988,27 @@ mng_save_image (const gchar *filename, +@@ -981,37 +988,31 @@ mng_save_image (const gchar *filename, png_init_io (png_ptr, outfile); png_set_compression_level (png_ptr, mng_data.compression_level); @@ -37,6 +37,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 - png_info_ptr->interlace_type = (mng_data.interlaced == 0 ? 0 : 1); - png_info_ptr->bit_depth = 8; - ++ bit_depth = 8; switch (layer_drawable_type) { case GIMP_RGB_IMAGE: @@ -61,42 +62,48 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 - png_info_ptr->palette = - (png_colorp) gimp_image_get_colormap (image_id, &num_colors); - png_info_ptr->num_palette = num_colors; -+ color_type = PNG_COLOR_TYPE_PALETTE; -+ -+ png_set_PLTE(png_ptr, png_info_ptr, (png_colorp) gimp_image_get_colormap (image_id, &num_colors), num_colors); - break; +- break; case GIMP_INDEXEDA_IMAGE: - png_info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; +- layer_has_unique_palette = +- respin_cmap (png_ptr, png_info_ptr, layer_remap, +- image_id, layer_drawable); + color_type = PNG_COLOR_TYPE_PALETTE; - layer_has_unique_palette = - respin_cmap (png_ptr, png_info_ptr, layer_remap, - image_id, layer_drawable); -@@ -1021,15 +1021,17 @@ mng_save_image (const gchar *filename, ++ gimp_image_get_colormap (image_id, &num_colors); ++ if (num_palette <= 2) ++ bit_depth = 1; ++ else if (num_palette <= 4) ++ bit_depth = 2; ++ else if (num_palette <= 16) ++ bit_depth = 4; + break; + default: + g_warning ("This can't be!\n"); +@@ -1021,16 +1022,14 @@ mng_save_image (const gchar *filename, goto err3; } - if ((png_info_ptr->valid & PNG_INFO_PLTE) == PNG_INFO_PLTE) -+ bit_depth = 8; -+ if (png_get_PLTE(png_ptr, png_info_ptr, &palette, &num_palette) != 0) - { +- { - if (png_info_ptr->num_palette <= 2) - png_info_ptr->bit_depth = 1; - else if (png_info_ptr->num_palette <= 4) - png_info_ptr->bit_depth = 2; - else if (png_info_ptr->num_palette <= 16) - png_info_ptr->bit_depth = 4; -+ if (num_palette <= 2) -+ bit_depth = 1; -+ else if (num_palette <= 4) -+ bit_depth = 2; -+ else if (num_palette <= 16) -+ bit_depth = 4; - } +- } + png_set_IHDR(png_ptr, png_info_ptr, layer_cols, layer_rows, bit_depth, color_type, (mng_data.interlaced == 0 ? PNG_INTERLACE_NONE : PNG_INTERLACE_ADAM7), PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); ++ if (layer_drawable_type == GIMP_INDEXED_IMAGE) ++ png_set_PLTE(png_ptr, png_info_ptr, (png_colorp) gimp_image_get_colormap (image_id, &num_colors), num_colors); ++ else if (layer_drawable_type == GIMP_INDEXEDA_IMAGE) ++ layer_has_unique_palette = ++ respin_cmap (png_ptr, png_info_ptr, layer_remap, ++ image_id, layer_drawable); png_write_info (png_ptr, png_info_ptr); -@@ -1038,8 +1040,8 @@ mng_save_image (const gchar *filename, + if (mng_data.interlaced != 0) +@@ -1038,8 +1037,8 @@ mng_save_image (const gchar *filename, else num_passes = 1; @@ -107,7 +114,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 png_set_packing (png_ptr); tile_height = gimp_tile_height (); -@@ -1065,7 +1067,7 @@ mng_save_image (const gchar *filename, +@@ -1065,7 +1064,7 @@ mng_save_image (const gchar *filename, gimp_pixel_rgn_get_rect (&layer_pixel_rgn, layer_pixel, 0, begin, layer_cols, num); @@ -116,7 +123,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 { for (j = 0; j < num; j++) { -@@ -1077,7 +1079,7 @@ mng_save_image (const gchar *filename, +@@ -1077,7 +1076,7 @@ mng_save_image (const gchar *filename, } } else diff --git a/graphics/gimp/patches/patch-af b/graphics/gimp/patches/patch-af index 383877ded59..10e0dabfb34 100644 --- a/graphics/gimp/patches/patch-af +++ b/graphics/gimp/patches/patch-af @@ -1,4 +1,4 @@ -$NetBSD: patch-af,v 1.7 2011/01/24 16:51:59 wiz Exp $ +$NetBSD: patch-af,v 1.8 2011/04/19 10:28:31 wiz Exp $ Fix build with png-1.5. https://bugzilla.gnome.org/show_bug.cgi?id=640409 @@ -237,7 +237,15 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 /* * Initialise remap[] */ -@@ -1309,37 +1317,34 @@ save_image (const gchar *filename, +@@ -1304,44 +1312,48 @@ save_image (const gchar *filename, + + /* + * Set color type and remember bytes per pixel count ++ * Also fix bit depths for (possibly) smaller colormap images + */ + ++ bit_depth = 8; ++ switch (type) { case GIMP_RGB_IMAGE: @@ -265,31 +273,47 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 break; case GIMP_INDEXED_IMAGE: ++ case GIMP_INDEXEDA_IMAGE: bpp = 1; - info->color_type = PNG_COLOR_TYPE_PALETTE; - info->valid |= PNG_INFO_PLTE; - info->palette = - (png_colorp) gimp_image_get_colormap (image_ID, &num_colors); - info->num_palette = num_colors; -+ color_type = PNG_COLOR_TYPE_PALETTE; -+ png_set_PLTE(pp, info, (png_colorp) gimp_image_get_colormap (image_ID, &num_colors), num_colors); - break; +- break; ++ if (type == GIMP_INDEXEDA_IMAGE) ++ bpp = 2; - case GIMP_INDEXEDA_IMAGE: - bpp = 2; +- case GIMP_INDEXEDA_IMAGE: +- bpp = 2; - info->color_type = PNG_COLOR_TYPE_PALETTE; +- /* fix up transparency */ +- respin_cmap (pp, info, remap, image_ID, drawable); + color_type = PNG_COLOR_TYPE_PALETTE; - /* fix up transparency */ - respin_cmap (pp, info, remap, image_ID, drawable); ++ gimp_image_get_colormap (image_ID, &num_colors); ++ if (num_colors <= 2) ++ bit_depth = 1; ++ else if (num_colors <= 4) ++ bit_depth = 2; ++ else if (num_colors <= 16) ++ bit_depth = 4; ++ /* otherwise the default is fine */ break; -@@ -1353,17 +1358,25 @@ save_image (const gchar *filename, - * Fix bit depths for (possibly) smaller colormap images - */ + + default: +@@ -1349,19 +1361,14 @@ save_image (const gchar *filename, + return FALSE; + } + +- /* +- * Fix bit depths for (possibly) smaller colormap images +- */ ++ png_set_IHDR(pp, info, drawable->width, drawable->height, bit_depth, color_type, pngvals.interlaced ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - if (info->valid & PNG_INFO_PLTE) -+ bit_depth = 8; -+ -+ if (png_get_valid(pp, info, PNG_INFO_PLTE)) ++ if (type == GIMP_INDEXED_IMAGE) ++ png_set_PLTE(pp, info, (png_colorp) gimp_image_get_colormap (image_ID, &num_colors), num_colors); ++ else if (type == GIMP_INDEXEDA_IMAGE) { - if (info->num_palette <= 2) - info->bit_depth = 1; @@ -297,25 +321,13 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 - info->bit_depth = 2; - else if (info->num_palette <= 16) - info->bit_depth = 4; -+ png_colorp palette; -+ int num_palette; -+ png_get_PLTE(pp, info, &palette, &num_palette); -+ -+ if (num_palette <= 2) -+ bit_depth = 1; -+ else if (num_palette <= 4) -+ bit_depth = 2; -+ else if (num_palette <= 16) -+ bit_depth = 4; - /* otherwise the default is fine */ +- /* otherwise the default is fine */ ++ /* fix up transparency */ ++ respin_cmap (pp, info, remap, image_ID, drawable); } -+ png_set_IHDR(pp, info, drawable->width, drawable->height, bit_depth, color_type, pngvals.interlaced ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); -+ /* All this stuff is optional extras, if the user is aiming for smallest - possible file size she can turn them all off */ - -@@ -1477,7 +1490,7 @@ save_image (const gchar *filename, +@@ -1477,7 +1484,7 @@ save_image (const gchar *filename, * Convert unpacked pixels to packed if necessary */ @@ -324,7 +336,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 png_set_packing (pp); /* -@@ -1529,7 +1542,7 @@ save_image (const gchar *filename, +@@ -1529,7 +1536,7 @@ save_image (const gchar *filename, /* If we're dealing with a paletted image with * transparency set, write out the remapped palette */ @@ -333,7 +345,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 { guchar inverse_remap[256]; -@@ -1549,7 +1562,7 @@ save_image (const gchar *filename, +@@ -1549,7 +1556,7 @@ save_image (const gchar *filename, } /* Otherwise if we have a paletted image and transparency * couldn't be set, we ignore the alpha channel */ @@ -342,7 +354,7 @@ https://bugzilla.gnome.org/show_bug.cgi?id=640409 { for (i = 0; i < num; ++i) { -@@ -1564,7 +1577,7 @@ save_image (const gchar *filename, +@@ -1564,7 +1571,7 @@ save_image (const gchar *filename, png_write_rows (pp, pixels, num); gimp_progress_update (((double) pass + (double) end / |