summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2013-04-16 12:29:49 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-04-16 12:39:49 +0100
commit9e1753e6b571da4f86e2daa134667d4d00b69ce8 (patch)
treefef04db5b5aa78b83f564df0f11e82bb5af20cfc /meta/recipes-graphics
parentdf2aeee419d0a8374f959ff79cb8b7dafcd01d1b (diff)
downloadpoky-9e1753e6b571da4f86e2daa134667d4d00b69ce8.tar.gz
cairo: fix builds with libpng 1.6
libpng 1.6 emits more warnings than before, and is also stricter with function ordering. Fix the function ordering when reading PNGs, and stop treating all warnings as errors. (From OE-Core rev: 55d00b750f5c45e583abef406c96416cd6a8caa7) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics')
-rw-r--r--meta/recipes-graphics/cairo/cairo/png.patch123
-rw-r--r--meta/recipes-graphics/cairo/cairo_1.12.14.bb3
2 files changed, 125 insertions, 1 deletions
diff --git a/meta/recipes-graphics/cairo/cairo/png.patch b/meta/recipes-graphics/cairo/cairo/png.patch
new file mode 100644
index 0000000000..15ce80ad62
--- /dev/null
+++ b/meta/recipes-graphics/cairo/cairo/png.patch
@@ -0,0 +1,123 @@
1libpng 1.6 is stricter in various ways, which trips up Cairo's PNG loader.
2
3Upstream-Status: Submitted (first)/Backport (second)
4Signed-off-by: Ross Burton <ross.burton@intel.com>
5
6
7From 1535e4eeda7e0792fe5e7e5ab377c5253ee89ce7 Mon Sep 17 00:00:00 2001
8From: Ingmar Runge <ingmar@irsoft.de>
9Date: Tue, 16 Apr 2013 10:48:59 +0100
10Subject: [PATCH 1/2] png: fix transform ordering
11
12libpng 1.6 is stricter with the function ordering, emitting the warning "invalid
13before the PNG header has been read" when calling png_set_read_user_transform_fn
14whilst loading a PNG.
15
16So, re-order the functions to the order that libpng is happy with.
17
18Signed-off-by: Ross Burton <ross.burton@intel.com>
19---
20 src/cairo-png.c | 21 +++++++++++++++++++--
21 1 file changed, 19 insertions(+), 2 deletions(-)
22
23diff --git a/src/cairo-png.c b/src/cairo-png.c
24index e74a4a8..3aec86a 100644
25--- a/src/cairo-png.c
26+++ b/src/cairo-png.c
27@@ -497,6 +497,20 @@ convert_bytes_to_data (png_structp png, png_row_infop row_info, png_bytep data)
28 }
29 }
30
31+/* branches into premultiply_data or convert_bytes_to_data depending on color type */
32+static void read_user_transform_func (png_structp png, png_row_infop row_info, png_bytep data)
33+{
34+ switch ((cairo_format_t) png_get_user_transform_ptr (png)) {
35+ case CAIRO_FORMAT_ARGB32:
36+ premultiply_data (png, row_info, data);
37+ break;
38+
39+ case CAIRO_FORMAT_RGB24:
40+ convert_bytes_to_data (png, row_info, data);
41+ break;
42+ }
43+}
44+
45 static cairo_status_t
46 stdio_read_func (void *closure, unsigned char *data, unsigned int size)
47 {
48@@ -623,6 +637,9 @@ read_png (struct png_read_closure_t *png_closure)
49
50 png_set_filler (png, 0xff, PNG_FILLER_AFTER);
51
52+ /* this must be stored before calling png_read_update_info */
53+ png_set_read_user_transform_fn (png, read_user_transform_func);
54+
55 /* recheck header after setting EXPAND options */
56 png_read_update_info (png, info);
57 png_get_IHDR (png, info,
58@@ -643,15 +660,15 @@ read_png (struct png_read_closure_t *png_closure)
59
60 case PNG_COLOR_TYPE_RGB_ALPHA:
61 format = CAIRO_FORMAT_ARGB32;
62- png_set_read_user_transform_fn (png, premultiply_data);
63 break;
64
65 case PNG_COLOR_TYPE_RGB:
66 format = CAIRO_FORMAT_RGB24;
67- png_set_read_user_transform_fn (png, convert_bytes_to_data);
68 break;
69 }
70
71+ png_set_user_transform_info (png, (void*) format, 0, 0);
72+
73 stride = cairo_format_stride_for_width (format, png_width);
74 if (stride < 0) {
75 surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
76--
771.7.10.4
78
79From 2dd2c826a5b367d32cf2d48ed69754795990c5db Mon Sep 17 00:00:00 2001
80From: Chris Wilson <chris@chris-wilson.co.uk>
81Date: Tue, 16 Apr 2013 10:58:56 +0100
82Subject: [PATCH] png: Avoid marking the surface as in error after a png
83 warning
84
85It turns out that libpng will continue to load an image after throwing a
86warning, and that libpng16 now throws warnings for images that libpng15
87and earlier loaded without error. As we were happily loading those
88images into cairo surfaces before, we are therefore being overzealous
89in throwing an error now - so just squelch the warning.
90
91Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
92---
93 src/cairo-png.c | 14 +++++++-------
94 1 file changed, 7 insertions(+), 7 deletions(-)
95
96diff --git a/src/cairo-png.c b/src/cairo-png.c
97index e74a4a8..068617d 100644
98--- a/src/cairo-png.c
99+++ b/src/cairo-png.c
100@@ -149,13 +149,13 @@ static void
101 png_simple_warning_callback (png_structp png,
102 png_const_charp error_msg)
103 {
104- cairo_status_t *error = png_get_error_ptr (png);
105-
106- /* default to the most likely error */
107- if (*error == CAIRO_STATUS_SUCCESS)
108- *error = _cairo_error (CAIRO_STATUS_NO_MEMORY);
109-
110- /* png does not expect to abort and will try to tidy up after a warning */
111+ /* png does not expect to abort and will try to tidy up and continue
112+ * loading the image after a warning. So we also want to return the
113+ * (incorrect?) surface.
114+ *
115+ * We use our own warning callback to squelch any attempts by libpng
116+ * to write to stderr as we may not be in control of that output.
117+ */
118 }
119
120
121--
1221.7.10.4
123
diff --git a/meta/recipes-graphics/cairo/cairo_1.12.14.bb b/meta/recipes-graphics/cairo/cairo_1.12.14.bb
index 16f9d7b5a7..40aa169abe 100644
--- a/meta/recipes-graphics/cairo/cairo_1.12.14.bb
+++ b/meta/recipes-graphics/cairo/cairo_1.12.14.bb
@@ -4,7 +4,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=e73e999e0c72b5ac9012424fa157ad77"
4 4
5PR = "r0" 5PR = "r0"
6 6
7SRC_URI = "http://cairographics.org/releases/cairo-${PV}.tar.xz" 7SRC_URI = "http://cairographics.org/releases/cairo-${PV}.tar.xz \
8 file://png.patch"
8 9
9SRC_URI[md5sum] = "27b634113d0f52152d60ae8e2ec7daa7" 10SRC_URI[md5sum] = "27b634113d0f52152d60ae8e2ec7daa7"
10SRC_URI[sha256sum] = "96d0d1e3f9b74d2ca3469ff187c5e5f25649b1ad35cf06f4f3a83847dff4ac13" 11SRC_URI[sha256sum] = "96d0d1e3f9b74d2ca3469ff187c5e5f25649b1ad35cf06f4f3a83847dff4ac13"