Patchwork [2/2] cairo: drop transform patch, it's been rejected upstream

login
register
mail settings
Submitter Ross Burton
Date April 17, 2013, 1:34 p.m.
Message ID <1366205668-19096-2-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/48433/
State Accepted
Commit f7f8ec1197ec64620c80e13214dc395ab3e12afc
Headers show

Comments

Ross Burton - April 17, 2013, 1:34 p.m.
This fix was rejected by upstream, the correct fix is actually to fix libpng.

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 meta/recipes-graphics/cairo/cairo/png.patch |   77 ++-------------------------
 1 file changed, 3 insertions(+), 74 deletions(-)
Koen Kooi - April 17, 2013, 1:46 p.m.
Op 17 apr. 2013, om 15:34 heeft Ross Burton <ross.burton@intel.com> het volgende geschreven:

> This fix was rejected by upstream, the correct fix is actually to fix libpng.

That fix is supposed to be in libpng HEAD and appear in 1.6.2:

"The git head of libpng16 (and libpng17) has a fix that should allow user
transforms (but not png_set_user_transform_info) to be called after
png_read_update_info." - John Bowler

regards,

Koen


> 
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
> meta/recipes-graphics/cairo/cairo/png.patch |   77 ++-------------------------
> 1 file changed, 3 insertions(+), 74 deletions(-)
> 
> diff --git a/meta/recipes-graphics/cairo/cairo/png.patch b/meta/recipes-graphics/cairo/cairo/png.patch
> index 15ce80a..bf00332 100644
> --- a/meta/recipes-graphics/cairo/cairo/png.patch
> +++ b/meta/recipes-graphics/cairo/cairo/png.patch
> @@ -1,81 +1,10 @@
> -libpng 1.6 is stricter in various ways, which trips up Cairo's PNG loader.
> +libpng 1.6 is stricter in various ways, which can trip up the PNG loader as it
> +considers all warnings fatal.
> 
> -Upstream-Status: Submitted (first)/Backport (second)
> +Upstream-Status: Backport
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> 
> 
> -From 1535e4eeda7e0792fe5e7e5ab377c5253ee89ce7 Mon Sep 17 00:00:00 2001
> -From: Ingmar Runge <ingmar@irsoft.de>
> -Date: Tue, 16 Apr 2013 10:48:59 +0100
> -Subject: [PATCH 1/2] png: fix transform ordering
> -
> -libpng 1.6 is stricter with the function ordering, emitting the warning "invalid
> -before the PNG header has been read" when calling png_set_read_user_transform_fn
> -whilst loading a PNG.
> -
> -So, re-order the functions to the order that libpng is happy with.
> -
> -Signed-off-by: Ross Burton <ross.burton@intel.com>
> ----
> - src/cairo-png.c |   21 +++++++++++++++++++--
> - 1 file changed, 19 insertions(+), 2 deletions(-)
> -
> -diff --git a/src/cairo-png.c b/src/cairo-png.c
> -index e74a4a8..3aec86a 100644
> ---- a/src/cairo-png.c
> -+++ b/src/cairo-png.c
> -@@ -497,6 +497,20 @@ convert_bytes_to_data (png_structp png, png_row_infop row_info, png_bytep data)
> -     }
> - }
> - 
> -+/* branches into premultiply_data or convert_bytes_to_data depending on color type */
> -+static void read_user_transform_func (png_structp png, png_row_infop row_info, png_bytep data)
> -+{
> -+    switch ((cairo_format_t) png_get_user_transform_ptr (png)) {
> -+        case CAIRO_FORMAT_ARGB32:
> -+            premultiply_data (png, row_info, data);
> -+            break;
> -+
> -+        case CAIRO_FORMAT_RGB24:
> -+            convert_bytes_to_data (png, row_info, data);
> -+            break;
> -+    }
> -+}
> -+
> - static cairo_status_t
> - stdio_read_func (void *closure, unsigned char *data, unsigned int size)
> - {
> -@@ -623,6 +637,9 @@ read_png (struct png_read_closure_t *png_closure)
> - 
> -     png_set_filler (png, 0xff, PNG_FILLER_AFTER);
> - 
> -+    /* this must be stored before calling png_read_update_info */
> -+    png_set_read_user_transform_fn (png, read_user_transform_func);
> -+
> -     /* recheck header after setting EXPAND options */
> -     png_read_update_info (png, info);
> -     png_get_IHDR (png, info,
> -@@ -643,15 +660,15 @@ read_png (struct png_read_closure_t *png_closure)
> - 
> - 	case PNG_COLOR_TYPE_RGB_ALPHA:
> - 	    format = CAIRO_FORMAT_ARGB32;
> --	    png_set_read_user_transform_fn (png, premultiply_data);
> - 	    break;
> - 
> - 	case PNG_COLOR_TYPE_RGB:
> - 	    format = CAIRO_FORMAT_RGB24;
> --	    png_set_read_user_transform_fn (png, convert_bytes_to_data);
> - 	    break;
> -     }
> - 
> -+    png_set_user_transform_info (png, (void*) format, 0, 0);
> -+
> -     stride = cairo_format_stride_for_width (format, png_width);
> -     if (stride < 0) {
> - 	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
> --- 
> -1.7.10.4
> -
> From 2dd2c826a5b367d32cf2d48ed69754795990c5db Mon Sep 17 00:00:00 2001
> From: Chris Wilson <chris@chris-wilson.co.uk>
> Date: Tue, 16 Apr 2013 10:58:56 +0100
> -- 
> 1.7.10.4
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
Ross Burton - April 17, 2013, 1:54 p.m.
On 17 April 2013 14:46, Koen Kooi <koen@dominion.thruhere.net> wrote:
> Op 17 apr. 2013, om 15:34 heeft Ross Burton <ross.burton@intel.com> het volgende geschreven:
>
>> This fix was rejected by upstream, the correct fix is actually to fix libpng.
>
> That fix is supposed to be in libpng HEAD and appear in 1.6.2:

Yes, that's where the patch in 1/2 comes from.

Ross

Patch

diff --git a/meta/recipes-graphics/cairo/cairo/png.patch b/meta/recipes-graphics/cairo/cairo/png.patch
index 15ce80a..bf00332 100644
--- a/meta/recipes-graphics/cairo/cairo/png.patch
+++ b/meta/recipes-graphics/cairo/cairo/png.patch
@@ -1,81 +1,10 @@ 
-libpng 1.6 is stricter in various ways, which trips up Cairo's PNG loader.
+libpng 1.6 is stricter in various ways, which can trip up the PNG loader as it
+considers all warnings fatal.
 
-Upstream-Status: Submitted (first)/Backport (second)
+Upstream-Status: Backport
 Signed-off-by: Ross Burton <ross.burton@intel.com>
 
 
-From 1535e4eeda7e0792fe5e7e5ab377c5253ee89ce7 Mon Sep 17 00:00:00 2001
-From: Ingmar Runge <ingmar@irsoft.de>
-Date: Tue, 16 Apr 2013 10:48:59 +0100
-Subject: [PATCH 1/2] png: fix transform ordering
-
-libpng 1.6 is stricter with the function ordering, emitting the warning "invalid
-before the PNG header has been read" when calling png_set_read_user_transform_fn
-whilst loading a PNG.
-
-So, re-order the functions to the order that libpng is happy with.
-
-Signed-off-by: Ross Burton <ross.burton@intel.com>
----
- src/cairo-png.c |   21 +++++++++++++++++++--
- 1 file changed, 19 insertions(+), 2 deletions(-)
-
-diff --git a/src/cairo-png.c b/src/cairo-png.c
-index e74a4a8..3aec86a 100644
---- a/src/cairo-png.c
-+++ b/src/cairo-png.c
-@@ -497,6 +497,20 @@ convert_bytes_to_data (png_structp png, png_row_infop row_info, png_bytep data)
-     }
- }
- 
-+/* branches into premultiply_data or convert_bytes_to_data depending on color type */
-+static void read_user_transform_func (png_structp png, png_row_infop row_info, png_bytep data)
-+{
-+    switch ((cairo_format_t) png_get_user_transform_ptr (png)) {
-+        case CAIRO_FORMAT_ARGB32:
-+            premultiply_data (png, row_info, data);
-+            break;
-+
-+        case CAIRO_FORMAT_RGB24:
-+            convert_bytes_to_data (png, row_info, data);
-+            break;
-+    }
-+}
-+
- static cairo_status_t
- stdio_read_func (void *closure, unsigned char *data, unsigned int size)
- {
-@@ -623,6 +637,9 @@ read_png (struct png_read_closure_t *png_closure)
- 
-     png_set_filler (png, 0xff, PNG_FILLER_AFTER);
- 
-+    /* this must be stored before calling png_read_update_info */
-+    png_set_read_user_transform_fn (png, read_user_transform_func);
-+
-     /* recheck header after setting EXPAND options */
-     png_read_update_info (png, info);
-     png_get_IHDR (png, info,
-@@ -643,15 +660,15 @@ read_png (struct png_read_closure_t *png_closure)
- 
- 	case PNG_COLOR_TYPE_RGB_ALPHA:
- 	    format = CAIRO_FORMAT_ARGB32;
--	    png_set_read_user_transform_fn (png, premultiply_data);
- 	    break;
- 
- 	case PNG_COLOR_TYPE_RGB:
- 	    format = CAIRO_FORMAT_RGB24;
--	    png_set_read_user_transform_fn (png, convert_bytes_to_data);
- 	    break;
-     }
- 
-+    png_set_user_transform_info (png, (void*) format, 0, 0);
-+
-     stride = cairo_format_stride_for_width (format, png_width);
-     if (stride < 0) {
- 	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
--- 
-1.7.10.4
-
 From 2dd2c826a5b367d32cf2d48ed69754795990c5db Mon Sep 17 00:00:00 2001
 From: Chris Wilson <chris@chris-wilson.co.uk>
 Date: Tue, 16 Apr 2013 10:58:56 +0100