https://github.com/libsdl-org/libtiff/commit/39940d6e69868177fc811ef39c5d13dd7ec4779a
From 39940d6e69868177fc811ef39c5d13dd7ec4779a Mon Sep 17 00:00:00 2001
From: Lee Howard <[EMAIL REDACTED]>
Date: Mon, 13 Dec 2010 05:41:11 +0000
Subject: [PATCH] * tools/tiff2pdf.c: fix colors for images with RGBA
interleaved data
http://bugzilla.maptools.org/show_bug.cgi?id=2250
---
ChangeLog | 6 ++++++
tools/tiff2pdf.c | 11 +++++------
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 166346c1..69b064d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-12-12 Lee Howard <faxguy@howardsilvan.com>
+
+ * tools/tiff2pdf.c: fix colors for images with RGBA
+ interleaved data
+ http://bugzilla.maptools.org/show_bug.cgi?id=2250
+
2010-12-11 Lee Howard <faxguy@howardsilvan.com>
* tools/tiff2pdf.c: remove invalid duplication for Lab
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index c0bba31e..7b1549e9 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2pdf.c,v 1.37.2.18 2010-12-12 06:59:00 faxguy Exp $
+/* $Id: tiff2pdf.c,v 1.37.2.19 2010-12-13 05:41:11 faxguy Exp $
*
* tiff2pdf - converts a TIFF image to a PDF document
*
@@ -3478,11 +3478,10 @@ t2p_sample_rgba_to_rgb(tdata_t data, uint32 samplecount)
for (i = 0; i < samplecount; i++) {
sample=((uint32*)data)[i];
- alpha=(uint8)((255 - (sample & 0xff)));
- ((uint8 *)data)[i * 3] = (uint8) ((sample >> 24) & 0xff) + alpha;
- ((uint8 *)data)[i * 3 + 1] = (uint8) ((sample >> 16) & 0xff) + alpha;
- ((uint8 *)data)[i * 3 + 2] = (uint8) ((sample >> 8) & 0xff) + alpha;
-
+ alpha=(uint8)((255 - ((sample >> 24) & 0xff)));
+ ((uint8 *)data)[i * 3] = (uint8) ((sample >> 16) & 0xff) + alpha;
+ ((uint8 *)data)[i * 3 + 1] = (uint8) ((sample >> 8) & 0xff) + alpha;
+ ((uint8 *)data)[i * 3 + 2] = (uint8) (sample & 0xff) + alpha;
}
return (i * 3);