summaryrefslogtreecommitdiff
path: root/source/t/tetex/tetex.png16.diff
diff options
context:
space:
mode:
Diffstat (limited to 'source/t/tetex/tetex.png16.diff')
-rw-r--r--source/t/tetex/tetex.png16.diff167
1 files changed, 167 insertions, 0 deletions
diff --git a/source/t/tetex/tetex.png16.diff b/source/t/tetex/tetex.png16.diff
new file mode 100644
index 00000000..f2465233
--- /dev/null
+++ b/source/t/tetex/tetex.png16.diff
@@ -0,0 +1,167 @@
+--- ./texk/web2c/pdftexdir/writeimg.c.orig 2015-03-23 13:18:35.471056383 -0500
++++ ./texk/web2c/pdftexdir/writeimg.c 2015-03-23 13:30:32.157115740 -0500
+@@ -126,7 +126,7 @@
+ {
+ switch (img_type(img)) {
+ case IMAGE_TYPE_PNG:
+- return png_info(img)->bit_depth;
++ return png_get_bit_depth(png_ptr(img), png_info(img));
+ case IMAGE_TYPE_JPG:
+ return jpg_ptr(img)->bits_per_component;
+ case IMAGE_TYPE_PDF:
+@@ -346,7 +346,7 @@
+ epdf_delete();
+ break;
+ case IMAGE_TYPE_PNG:
+- xfclose(png_ptr(img)->io_ptr, cur_file_name);
++ xfclose(png_get_io_ptr(png_ptr(img)), cur_file_name);
+ png_destroy_read_struct(&(png_ptr(img)), &(png_info(img)), NULL);
+ break;
+ case IMAGE_TYPE_JPG:
+--- ./texk/web2c/pdftexdir/writepng.c.orig 2015-03-23 13:18:35.471056383 -0500
++++ ./texk/web2c/pdftexdir/writepng.c 2015-03-23 13:27:58.053102977 -0500
+@@ -34,24 +34,24 @@
+ pdftex_fail("libpng: png_create_read_struct() failed");
+ if ((png_info(img) = png_create_info_struct(png_ptr(img))) == NULL)
+ pdftex_fail("libpng: png_create_info_struct() failed");
+- if (setjmp(png_ptr(img)->jmpbuf))
++ if (setjmp(png_jmpbuf(png_ptr(img))))
+ pdftex_fail("libpng: internal error");
+ png_init_io(png_ptr(img), png_file);
+ png_read_info(png_ptr(img), png_info(img));
+- if (png_info(img)->color_type & PNG_COLOR_MASK_ALPHA)
++ if (png_get_color_type(png_ptr(img), png_info(img)) & PNG_COLOR_MASK_ALPHA)
+ png_set_strip_alpha(png_ptr(img));
+- if (png_info(img)->bit_depth == 16)
++ if (png_get_bit_depth(png_ptr(img), png_info(img)) == 16)
+ png_set_strip_16(png_ptr(img));
+ png_read_update_info(png_ptr(img), png_info(img));
+- img_width(img) = png_info(img)->width;
+- img_height(img) = png_info(img)->height;
+- if (png_info(img)->valid & PNG_INFO_pHYs) {
++ img_width(img) = png_get_image_width(png_ptr(img), png_info(img));
++ img_height(img) = png_get_image_height(png_ptr(img), png_info(img));
++ if (png_get_valid(png_ptr(img), png_info(img), PNG_INFO_pHYs)) {
+ img_xres(img) =
+ round(0.0254*png_get_x_pixels_per_meter(png_ptr(img), png_info(img)));
+ img_yres(img) =
+ round(0.0254*png_get_y_pixels_per_meter(png_ptr(img), png_info(img)));
+ }
+- switch (png_info(img)->color_type) {
++ switch (png_get_color_type(png_ptr(img), png_info(img))) {
+ case PNG_COLOR_TYPE_PALETTE:
+ img_color(img) = IMAGE_COLOR_C | IMAGE_COLOR_I;
+ break;
+@@ -64,7 +64,7 @@
+ img_color(img) = IMAGE_COLOR_C;
+ break;
+ default:
+- pdftex_fail("unsupported type of color_type <%i>", png_info(img)->color_type);
++ pdftex_fail("unsupported type of color_type <%i>", png_get_color_type(png_ptr(img), png_info(img)));
+ }
+ }
+
+@@ -73,23 +73,26 @@
+ int i, j, k, l;
+ integer palette_objnum = 0;
+ png_bytep row, r, *rows;
++ png_colorp png_palette;
++ int num_palette;
++ png_get_PLTE(png_ptr(img), png_info(img), &png_palette, &num_palette);
+ pdf_puts("/Type /XObject\n/Subtype /Image\n");
+ pdf_printf("/Width %i\n/Height %i\n/BitsPerComponent %i\n",
+- (int)png_info(img)->width,
+- (int)png_info(img)->height,
+- (int)png_info(img)->bit_depth);
++ (int)png_get_image_width(png_ptr(img), png_info(img)),
++ (int)png_get_image_height(png_ptr(img), png_info(img)),
++ (int)png_get_bit_depth(png_ptr(img), png_info(img)));
+ pdf_puts("/ColorSpace ");
+ if (img_colorspace_ref(img) != 0) {
+ pdf_printf("%i 0 R\n", (int)img_colorspace_ref(img));
+ }
+ else {
+- switch (png_info(img)->color_type) {
++ switch (png_get_color_type(png_ptr(img), png_info(img))) {
+ case PNG_COLOR_TYPE_PALETTE:
+ pdfcreateobj(0, 0);
+ palette_objnum = objptr;
+ pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n",
+- (int)(png_info(img)->num_palette - 1),
+- (int)palette_objnum);
++ num_palette - 1),
++ (int)palette_objnum;
+ break;
+ case PNG_COLOR_TYPE_GRAY:
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
+@@ -100,20 +103,20 @@
+ pdf_puts("/DeviceRGB\n");
+ break;
+ default:
+- pdftex_fail("unsupported type of color_type <%i>", png_info(img)->color_type);
++ pdftex_fail("unsupported type of color_type <%i>", png_get_color_type(png_ptr(img), png_info(img)));
+ }
+ }
+ pdfbeginstream();
+- if (png_info(img)->interlace_type == PNG_INTERLACE_NONE) {
+- row = xtalloc(png_info(img)->rowbytes, png_byte);
+- for (i = 0; i < (int)png_info(img)->height; i++) {
++ if (png_get_interlace_type(png_ptr(img), png_info(img)) == PNG_INTERLACE_NONE) {
++ row = xtalloc(png_get_rowbytes(png_ptr(img), png_info(img)), png_byte);
++ for (i = 0; i < (int)png_get_image_height(png_ptr(img), png_info(img)); i++) {
+ png_read_row(png_ptr(img), row, NULL);
+ r = row;
+- k = png_info(img)->rowbytes;
++ k = png_get_rowbytes(png_ptr(img), png_info(img));
+ while(k > 0) {
+ l = (k > pdfbufsize)? pdfbufsize : k;
+ pdfroom(l);
+- for (j = 0; j < l; j++)
++ for (j = 0; j < (int)png_get_rowbytes(png_ptr(img), png_info(img)); j++)
+ pdfbuf[pdfptr++] = *r++;
+ k -= l;
+ }
+@@ -121,19 +124,19 @@
+ xfree(row);
+ }
+ else {
+- if (png_info(img)->height*png_info(img)->rowbytes >= 10240000L)
++ if (png_get_image_height(png_ptr(img), png_info(img))*png_get_rowbytes(png_ptr(img), png_info(img)) >= 10240000L)
+ pdftex_warn("large interlaced PNG might cause out of memory (use non-interlaced PNG to fix this)");
+- rows = xtalloc(png_info(img)->height, png_bytep);
+- for (i = 0; i < png_info(img)->height; i++)
+- rows[i] = xtalloc(png_info(img)->rowbytes, png_byte);
++ rows = xtalloc(png_get_image_height(png_ptr(img), png_info(img)), png_bytep);
++ for (i = 0; i < png_get_image_height(png_ptr(img), png_info(img)); i++)
++ rows[i] = xtalloc(png_get_rowbytes(png_ptr(img), png_info(img)), png_byte);
+ png_read_image(png_ptr(img), rows);
+- for (i = 0; i < (int)png_info(img)->height; i++) {
++ for (i = 0; i < (int)png_get_image_height(png_ptr(img), png_info(img)); i++) {
+ row = rows[i];
+- k = png_info(img)->rowbytes;
++ k = png_get_rowbytes(png_ptr(img), png_info(img));
+ while(k > 0) {
+ l = (k > pdfbufsize)? pdfbufsize : k;
+- pdfroom(l);
+- for (j = 0; j < l; j++)
++ pdfroom(png_get_rowbytes(png_ptr(img), png_info(img)));
++ for (j = 0; j < (int)png_get_rowbytes(png_ptr(img), png_info(img)); j++)
+ pdfbuf[pdfptr++] = *row++;
+ k -= l;
+ }
+@@ -145,11 +148,11 @@
+ if (palette_objnum > 0) {
+ pdfbegindict(palette_objnum);
+ pdfbeginstream();
+- for (i = 0; i < png_info(img)->num_palette; i++) {
++ for (i = 0; i < num_palette; i++) {
+ pdfroom(3);
+- pdfbuf[pdfptr++] = png_info(img)->palette[i].red;
+- pdfbuf[pdfptr++] = png_info(img)->palette[i].green;
+- pdfbuf[pdfptr++] = png_info(img)->palette[i].blue;
++ pdfbuf[pdfptr++] = png_palette[i].red;
++ pdfbuf[pdfptr++] = png_palette[i].green;
++ pdfbuf[pdfptr++] = png_palette[i].blue;
+ }
+ pdfendstream();
+ }