* [gentoo-commits] gentoo-x86 commit in dev-tex/pdftex/files: pdftex-1.40.11-libpng15.patch
@ 2011-02-16 13:00 Alexis Ballier (aballier)
0 siblings, 0 replies; 2+ messages in thread
From: Alexis Ballier (aballier) @ 2011-02-16 13:00 UTC (permalink / raw
To: gentoo-commits
aballier 11/02/16 13:00:10
Added: pdftex-1.40.11-libpng15.patch
Log:
Import a fix from upstream for libpng 1.5 compatibility.
(Portage version: 2.2.0_alpha24/cvs/Linux x86_64)
Revision Changes Path
1.1 dev-tex/pdftex/files/pdftex-1.40.11-libpng15.patch
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tex/pdftex/files/pdftex-1.40.11-libpng15.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-tex/pdftex/files/pdftex-1.40.11-libpng15.patch?rev=1.1&content-type=text/plain
Index: pdftex-1.40.11-libpng15.patch
===================================================================
Index: source/texk/web2c/pdftexdir/writepng.c
===================================================================
--- source/texk/web2c/pdftexdir/writepng.c (revision 21236)
+++ source/texk/web2c/pdftexdir/writepng.c (revision 21237)
@@ -21,47 +21,19 @@
#include "ptexlib.h"
#include "image.h"
-#if PNG_LIBPNG_VER_MINOR > 2
-
/* ToDo:
- * use png_get_PLTE() to access num_palette and palette
- * use xxx to access transformations
+ * Check if multiple use of, e.g., png_bit_depth(img) should be
+ * replaced by
+ * int bitdepth = png_bit_depth(img);
+ * and subsequent use of bitdepth
*/
-
#define png_bit_depth(N) png_get_bit_depth(png_ptr(N), png_info(N))
#define png_color_type(N) png_get_color_type(png_ptr(N), png_info(N))
#define png_height(N) png_get_image_height(png_ptr(N), png_info(N))
#define png_interlace_type(N) png_get_interlace_type(png_ptr(N), png_info(N))
-#define png_io_ptr(N) png_get_io_ptr(png_ptr(N))
-#define png_num_palette(N) png_info(N)->num_palette
-#define png_palette(N) png_info(N)->palette
#define png_rowbytes(N) png_get_rowbytes(png_ptr(N), png_info(N))
-#define png_transformations(N) png_ptr(N)->transformations
-#define png_valid(N,flag) png_get_valid(png_ptr(N), png_info(N), flag)
#define png_width(N) png_get_image_width(png_ptr(N), png_info(N))
-#define png_ptr_bit_depth(N) png_get_bit_depth(png_ptr(N), png_info(N))
-#define png_ptr_color_type(N) png_get_color_type(png_ptr(N), png_info(N))
-
-#else
-
-#define png_bit_depth(N) png_info(N)->bit_depth
-#define png_color_type(N) png_info(N)->color_type
-#define png_height(N) png_info(N)->height
-#define png_interlace_type(N) png_info(N)->interlace_type
-#define png_io_ptr(N) png_ptr(N)->io_ptr
-#define png_num_palette(N) png_info(N)->num_palette
-#define png_palette(N) png_info(N)->palette
-#define png_rowbytes(N) png_info(N)->rowbytes
-#define png_transformations(N) png_ptr(N)->transformations
-#define png_valid(N,flag) png_info(N)->valid & (flag)
-#define png_width(N) png_info(N)->width
-
-#define png_ptr_bit_depth(N) png_ptr(N)->bit_depth
-#define png_ptr_color_type(N) png_ptr(N)->color_type
-
-#endif
-
static int transparent_page_group = -1;
void read_png_info(integer img)
@@ -84,7 +56,7 @@
}
/* alpha channel support */
if (fixedpdfminorversion < 4
- && png_ptr_color_type(img) | PNG_COLOR_MASK_ALPHA)
+ && png_color_type(img) | PNG_COLOR_MASK_ALPHA)
png_set_strip_alpha(png_ptr(img));
/* 16bit depth support */
if (fixedpdfminorversion < 5)
@@ -104,7 +76,7 @@
/* resolution support */
img_width(img) = png_width(img);
img_height(img) = png_height(img);
- if (png_valid(img, PNG_INFO_pHYs)) {
+ 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)));
@@ -201,14 +173,18 @@
int i, j, k, l;
png_bytep row, r, *rows;
integer palette_objnum = 0;
+ png_colorp palette;
+ int num_palette;
+
+ png_get_PLTE(png_ptr(img), png_info(img), &palette, &num_palette);
+
pdfcreateobj(0, 0);
palette_objnum = objptr;
if (img_colorspace_ref(img) != 0) {
pdf_printf("%i 0 R\n", (int) img_colorspace_ref(img));
} else {
pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n",
- (int) (png_num_palette(img) - 1),
- (int) palette_objnum);
+ num_palette -1, (int) palette_objnum);
}
pdfbeginstream();
if (png_interlace_type(img) == PNG_INTERLACE_NONE) {
@@ -230,11 +206,11 @@
if (palette_objnum > 0) {
pdfbegindict(palette_objnum, 0);
pdfbeginstream();
- for (i = 0; (unsigned) i < png_num_palette(img); i++) {
+ for (i = 0; (unsigned) i < num_palette; i++) {
pdfroom(3);
- pdfbuf[pdfptr++] = png_palette(img)[i].red;
- pdfbuf[pdfptr++] = png_palette(img)[i].green;
- pdfbuf[pdfptr++] = png_palette(img)[i].blue;
+ pdfbuf[pdfptr++] = palette[i].red;
+ pdfbuf[pdfptr++] = palette[i].green;
+ pdfbuf[pdfptr++] = palette[i].blue;
}
pdfendstream();
}
@@ -461,7 +437,7 @@
static void copy_png(integer img)
{
- FILE *fp = (FILE *) png_io_ptr(img);
+ FILE *fp = (FILE *) png_get_io_ptr(png_ptr(img));
int i, len, type, streamlength = 0;
boolean endflag = false;
int idat = 0; /* flag to check continuous IDAT chunks sequence */
@@ -553,7 +529,12 @@
double gamma, checked_gamma;
int i;
integer palette_objnum = 0;
+ png_colorp palette;
+ int num_palette;
last_png_needs_page_group = false;
+
+ png_get_PLTE(png_ptr(img), png_info(img), &palette, &num_palette);
+
if (fixedpdfminorversion < 5)
fixedimagehicolor = 0;
@@ -570,16 +551,12 @@
checked_gamma = (fixedgamma / 1000.0) * (1000.0 / fixedimagegamma);
}
}
- /* the switching between |png_info| and |png_ptr| queries has been trial and error.
- */
if (fixedpdfminorversion > 1
&& png_interlace_type(img) == PNG_INTERLACE_NONE
- && (png_transformations(img) == PNG_TRANSFORM_IDENTITY
- || png_transformations(img) == 0x2000)
/* gamma */
- && !(png_ptr_color_type(img) == PNG_COLOR_TYPE_GRAY_ALPHA ||
- png_ptr_color_type(img) == PNG_COLOR_TYPE_RGB_ALPHA)
- && (fixedimagehicolor || (png_ptr_bit_depth(img) <= 8))
+ && !(png_color_type(img) == PNG_COLOR_TYPE_GRAY_ALPHA ||
+ png_color_type(img) == PNG_COLOR_TYPE_RGB_ALPHA)
+ && (fixedimagehicolor || (png_bit_depth(img) <= 8))
&& (checked_gamma <= 1.01 && checked_gamma > 0.99)
) {
if (img_colorspace_ref(img) != 0) {
@@ -590,8 +567,7 @@
pdfcreateobj(0, 0);
palette_objnum = objptr;
pdf_printf("[/Indexed /DeviceRGB %i %i 0 R]\n",
- (int) (png_num_palette(img) - 1),
- (int) palette_objnum);
+ num_palette - 1, (int) palette_objnum);
break;
case PNG_COLOR_TYPE_GRAY:
pdf_puts("/DeviceGray\n");
@@ -605,11 +581,11 @@
if (palette_objnum > 0) {
pdfbegindict(palette_objnum, 0);
pdfbeginstream();
- for (i = 0; i < png_num_palette(img); i++) {
+ for (i = 0; i < num_palette; i++) {
pdfroom(3);
- pdfbuf[pdfptr++] = png_palette(img)[i].red;
- pdfbuf[pdfptr++] = png_palette(img)[i].green;
- pdfbuf[pdfptr++] = png_palette(img)[i].blue;
+ pdfbuf[pdfptr++] = palette[i].red;
+ pdfbuf[pdfptr++] = palette[i].green;
+ pdfbuf[pdfptr++] = palette[i].blue;
}
pdfendstream();
}
@@ -619,9 +595,6 @@
if (fixedimageapplygamma &&
(checked_gamma > 1.01 || checked_gamma < 0.99))
tex_printf("gamma delta=%lf ", checked_gamma);
- if (png_transformations(img) != PNG_TRANSFORM_IDENTITY)
- tex_printf("transform=%lu",
- (long) png_transformations(img));
if ((png_color_type(img) != PNG_COLOR_TYPE_GRAY)
&& (png_color_type(img) != PNG_COLOR_TYPE_RGB)
&& (png_color_type(img) != PNG_COLOR_TYPE_PALETTE))
Index: source/texk/web2c/pdftexdir/writeimg.c
===================================================================
--- source/texk/web2c/pdftexdir/writeimg.c (revision 19947)
+++ source/texk/web2c/pdftexdir/writeimg.c (revision 19948)
@@ -137,7 +137,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_JBIG2:
@@ -389,7 +389,7 @@
epdf_delete();
break;
case IMAGE_TYPE_PNG:
- xfclose((FILE *) png_ptr(img)->io_ptr, cur_file_name);
+ xfclose((FILE *) 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:
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gentoo-commits] gentoo-x86 commit in dev-tex/pdftex/files: pdftex-1.40.11-libpng15.patch
@ 2015-03-17 11:14 Alexis Ballier (aballier)
0 siblings, 0 replies; 2+ messages in thread
From: Alexis Ballier (aballier) @ 2015-03-17 11:14 UTC (permalink / raw
To: gentoo-commits
aballier 15/03/17 11:14:16
Removed: pdftex-1.40.11-libpng15.patch
Log:
remove standalone pdftex
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-17 11:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-17 11:14 [gentoo-commits] gentoo-x86 commit in dev-tex/pdftex/files: pdftex-1.40.11-libpng15.patch Alexis Ballier (aballier)
-- strict thread matches above, loose matches on Subject: below --
2011-02-16 13:00 Alexis Ballier (aballier)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox