Blame SOURCES/0001-Revert-Correctly-decode-Adobe-CMYK-JPEGs-in-PDF-expo.patch

145c16
From bf597b89288b6271f56031d5a20bfaf59f146d4c Mon Sep 17 00:00:00 2001
145c16
From: Bryce Harrington <bryce@bryceharrington.org>
145c16
Date: Tue, 16 Oct 2018 09:13:23 -0700
145c16
Subject: [PATCH] Revert "Correctly decode Adobe CMYK JPEGs in PDF export"
145c16
145c16
From further testing and investigation it appears that many PDF viewers
145c16
already have a workaround to invert Adobe CMYK JPEGs, so our generated
145c16
PDFs display incorrectly with those viewers due to double-inversion.
145c16
145c16
Further investigation will be needed to find a better solution that
145c16
doesn't cause regression for some PDF viewers; perhaps PDF viewers that
145c16
lack this inversion workaround should be changed to include it.  For now
145c16
we'll drop the patch to avoid shipping the regression in 1.16.0.
145c16
145c16
This reverts commit b207a932a2d3740984319dffd58a0791580597cd.
145c16
145c16
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=97612
145c16
Fixes: https://gitlab.freedesktop.org/cairo/cairo/issues/156
145c16
---
145c16
 src/cairo-image-info-private.h |  1 -
145c16
 src/cairo-image-info.c         | 21 ---------------------
145c16
 src/cairo-pdf-surface.c        |  2 --
145c16
 3 files changed, 24 deletions(-)
145c16
145c16
diff --git a/src/cairo-image-info-private.h b/src/cairo-image-info-private.h
145c16
index 99cbbcc02..e64928e40 100644
145c16
--- a/src/cairo-image-info-private.h
145c16
+++ b/src/cairo-image-info-private.h
145c16
@@ -43,7 +43,6 @@ typedef struct _cairo_image_info {
145c16
     int		 height;
145c16
     int		 num_components;
145c16
     int		 bits_per_component;
145c16
-    int		 is_adobe_jpeg;
145c16
 } cairo_image_info_t;
145c16
 
145c16
 cairo_private cairo_int_status_t
145c16
diff --git a/src/cairo-image-info.c b/src/cairo-image-info.c
145c16
index 3b4cf6edb..d147e3723 100644
145c16
--- a/src/cairo-image-info.c
145c16
+++ b/src/cairo-image-info.c
145c16
@@ -67,9 +67,6 @@
145c16
 #define SOF14 0xce
145c16
 #define SOF15 0xcf
145c16
 
145c16
-/* Start of tag markers */
145c16
-#define APP14 0xee	/* Adobe */
145c16
-
145c16
 static const unsigned char *
145c16
 _jpeg_skip_segment (const unsigned char *p)
145c16
 {
145c16
@@ -97,8 +94,6 @@ _cairo_image_info_get_jpeg_info (cairo_image_info_t	*info,
145c16
 {
145c16
     const unsigned char *p = data;
145c16
 
145c16
-    info->is_adobe_jpeg = FALSE;
145c16
-
145c16
     while (p + 1 < data + length) {
145c16
 	if (*p != 0xff)
145c16
 	    return CAIRO_INT_STATUS_UNSUPPORTED;
145c16
@@ -136,18 +131,6 @@ _cairo_image_info_get_jpeg_info (cairo_image_info_t	*info,
145c16
 	    _jpeg_extract_info (info, p);
145c16
 	    return CAIRO_STATUS_SUCCESS;
145c16
 
145c16
-	case APP14:
145c16
-	    /* "Adobe" tags segment indicates inverted CMYK (in
145c16
-	     * CMYK images). */
145c16
-	    if (p + 12 > data + length)
145c16
-		return CAIRO_INT_STATUS_UNSUPPORTED;
145c16
-
145c16
-	    info->is_adobe_jpeg =
145c16
-		(0 == strncmp((const char *)(p + 3), "Adobe", 5));
145c16
-
145c16
-	    p = _jpeg_skip_segment(p);
145c16
-	    break;
145c16
-
145c16
 	default:
145c16
 	    if (*p >= RST_begin && *p <= RST_end) {
145c16
 		p++;
145c16
@@ -223,7 +206,6 @@ _jpx_extract_info (const unsigned char *p, cairo_image_info_t *info)
145c16
     info->width = get_unaligned_be32 (p + 4);
145c16
     info->num_components = (p[8] << 8) + p[9];
145c16
     info->bits_per_component = p[10];
145c16
-    info->is_adobe_jpeg = FALSE;
145c16
 }
145c16
 
145c16
 cairo_int_status_t
145c16
@@ -301,8 +283,6 @@ _cairo_image_info_get_png_info (cairo_image_info_t     *info,
145c16
     p += 4;
145c16
     info->height = get_unaligned_be32 (p);
145c16
 
145c16
-    info->is_adobe_jpeg = FALSE;
145c16
-
145c16
     return CAIRO_STATUS_SUCCESS;
145c16
 }
145c16
 
145c16
@@ -415,7 +395,6 @@ _jbig2_extract_info (cairo_image_info_t *info, const unsigned char *p)
145c16
     info->height = get_unaligned_be32 (p + 4);
145c16
     info->num_components = 1;
145c16
     info->bits_per_component = 1;
145c16
-    info->is_adobe_jpeg = FALSE;
145c16
 }
145c16
 
145c16
 cairo_int_status_t
145c16
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
145c16
index ab6781340..7eb61aa1e 100644
145c16
--- a/src/cairo-pdf-surface.c
145c16
+++ b/src/cairo-pdf-surface.c
145c16
@@ -3169,7 +3169,6 @@ _cairo_pdf_surface_emit_jpeg_image (cairo_pdf_surface_t              *surface,
145c16
 						 "   /Height %d\n"
145c16
 						 "   /ColorSpace %s\n"
145c16
 						 "   /Interpolate %s\n"
145c16
-						 "%s"
145c16
 						 "   /BitsPerComponent %d\n"
145c16
 						 "%s"
145c16
 						 "   /Filter /DCTDecode\n",
145c16
@@ -3177,7 +3176,6 @@ _cairo_pdf_surface_emit_jpeg_image (cairo_pdf_surface_t              *surface,
145c16
 						 info.height,
145c16
 						 colorspace,
145c16
 						 surface_entry->interpolate ? "true" : "false",
145c16
-						 info.is_adobe_jpeg && info.num_components == 4 ? "   /Decode [ 1 0 1 0 1 0 1 0 ]\n" : "",
145c16
 						 info.bits_per_component,
145c16
 						 smask_buf);
145c16
     }
145c16
-- 
145c16
2.20.1
145c16