summaryrefslogtreecommitdiff
path: root/graphics/py-matplotlib/patches/patch-ab
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/py-matplotlib/patches/patch-ab')
-rw-r--r--graphics/py-matplotlib/patches/patch-ab126
1 files changed, 58 insertions, 68 deletions
diff --git a/graphics/py-matplotlib/patches/patch-ab b/graphics/py-matplotlib/patches/patch-ab
index ceac7d65efe..cc9efa2aa64 100644
--- a/graphics/py-matplotlib/patches/patch-ab
+++ b/graphics/py-matplotlib/patches/patch-ab
@@ -1,79 +1,69 @@
-$NetBSD: patch-ab,v 1.4 2011/02/06 08:57:07 markd Exp $
+$NetBSD: patch-ab,v 1.5 2011/02/17 10:33:37 markd Exp $
Fix build with png 1.5
+https://sourceforge.net/tracker/?func=detail&aid=3184016&group_id=80706&atid=560722
---- src/_png.cpp.orig 2009-08-01 19:14:01.000000000 +0000
+--- src/_png.cpp.orig 2010-10-12 16:14:42.000000000 +0000
+++ src/_png.cpp
-@@ -122,7 +122,7 @@ Py::Object _png_module::write_png(const
- throw Py::RuntimeError("Could not create info struct");
- }
-
-- if (setjmp(png_ptr->jmpbuf)) {
-+ if (setjmp(png_jmpbuf(png_ptr))) {
- throw Py::RuntimeError("Error building image");
- }
-
-@@ -210,10 +210,10 @@ _png_module::read_png(const Py::Tuple& a
- png_set_sig_bytes(png_ptr, 8);
- png_read_info(png_ptr, info_ptr);
-
-- png_uint_32 width = info_ptr->width;
-- png_uint_32 height = info_ptr->height;
-+ png_uint_32 width = png_get_image_width(png_ptr, info_ptr);
-+ png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
-
-- int bit_depth = info_ptr->bit_depth;
-+ int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
-
- // Unpack 1, 2, and 4-bit images
- if (bit_depth < 8)
-@@ -221,7 +221,7 @@ _png_module::read_png(const Py::Tuple& a
+@@ -350,10 +350,10 @@ _png_module::read_png(const Py::Tuple& a
+ png_set_sig_bytes(png_ptr, 8);
+ png_read_info(png_ptr, info_ptr);
- // If sig bits are set, shift data
- png_color_8p sig_bit;
-- if ((info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) && png_get_sBIT(png_ptr, info_ptr, &sig_bit))
-+ if ((png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_PALETTE) && png_get_sBIT(png_ptr, info_ptr, &sig_bit))
- png_set_shift(png_ptr, sig_bit);
+- png_uint_32 width = info_ptr->width;
+- png_uint_32 height = info_ptr->height;
++ png_uint_32 width = png_get_image_width(png_ptr, info_ptr);
++ png_uint_32 height = png_get_image_height(png_ptr, info_ptr);
- // Convert big endian to little
-@@ -229,11 +229,11 @@ _png_module::read_png(const Py::Tuple& a
- png_set_swap(png_ptr);
+- int bit_depth = info_ptr->bit_depth;
++ int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
- // Convert palletes to full RGB
-- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
-+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE)
- png_set_palette_to_rgb(png_ptr);
+ // Unpack 1, 2, and 4-bit images
+ if (bit_depth < 8)
+@@ -361,7 +361,7 @@ _png_module::read_png(const Py::Tuple& a
- // If there's an alpha channel convert gray to RGB
-- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
-+ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
- png_set_gray_to_rgb(png_ptr);
+ // If sig bits are set, shift data
+ png_color_8p sig_bit;
+- if ((info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) &&
++ if ((png_get_color_type(png_ptr, info_ptr) != PNG_COLOR_TYPE_PALETTE) &&
+ png_get_sBIT(png_ptr, info_ptr, &sig_bit))
+ {
+ png_set_shift(png_ptr, sig_bit);
+@@ -374,13 +374,13 @@ _png_module::read_png(const Py::Tuple& a
+ }
- png_set_interlace_handling(png_ptr);
-@@ -254,14 +254,14 @@ _png_module::read_png(const Py::Tuple& a
- npy_intp dimensions[3];
- dimensions[0] = height; //numrows
- dimensions[1] = width; //numcols
-- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
-+ if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA)
- dimensions[2] = 4; //RGBA images
-- else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
-+ else if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR)
- dimensions[2] = 3; //RGB images
- else
- dimensions[2] = 1; //Greyscale images
- //For gray, return an x by y array, not an x by y by 1
-- int num_dims = (info_ptr->color_type & PNG_COLOR_MASK_COLOR) ? 3 : 2;
-+ int num_dims = (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR) ? 3 : 2;
+ // Convert palletes to full RGB
+- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_PALETTE)
+ {
+ png_set_palette_to_rgb(png_ptr);
+ }
- double max_value = (1 << ((bit_depth < 8) ? 8 : bit_depth)) - 1;
- PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNew(num_dims, dimensions, PyArray_FLOAT);
-@@ -290,7 +290,7 @@ _png_module::read_png(const Py::Tuple& a
+ // If there's an alpha channel convert gray to RGB
+- if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) == PNG_COLOR_TYPE_GRAY_ALPHA)
+ {
+ png_set_gray_to_rgb(png_ptr);
+ }
+@@ -408,11 +408,11 @@ _png_module::read_png(const Py::Tuple& a
+ npy_intp dimensions[3];
+ dimensions[0] = height; //numrows
+ dimensions[1] = width; //numcols
+- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
++ if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_ALPHA)
+ {
+ dimensions[2] = 4; //RGBA images
+ }
+- else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
++ else if (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR)
+ {
+ dimensions[2] = 3; //RGB images
+ }
+@@ -421,7 +421,7 @@ _png_module::read_png(const Py::Tuple& a
+ dimensions[2] = 1; //Greyscale images
+ }
+ //For gray, return an x by y array, not an x by y by 1
+- int num_dims = (info_ptr->color_type & PNG_COLOR_MASK_COLOR) ? 3 : 2;
++ int num_dims = (png_get_color_type(png_ptr, info_ptr) & PNG_COLOR_MASK_COLOR) ? 3 : 2;
- //free the png memory
- png_read_end(png_ptr, info_ptr);
-- png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
-+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
- fclose(fp);
- for (row = 0; row < height; row++)
- delete [] row_pointers[row];
+ double max_value = (1 << ((bit_depth < 8) ? 8 : bit_depth)) - 1;
+ PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNew(