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

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