SHA256
1
0
forked from pool/cairo

Accepting request 162152 from home:pgajdos:libpng16

- call png_set_read_user_transform_fn() before png_read_update_info()
  [bnc#810701]
  * libpng16-v2.patch

OBS-URL: https://build.opensuse.org/request/show/162152
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/cairo?expand=0&rev=68
This commit is contained in:
Dominique Leuenberger 2013-04-06 15:14:46 +00:00 committed by Git OBS Bridge
parent 476c461ecc
commit 35e2be6cf1
3 changed files with 62 additions and 0 deletions

52
cairo-libpng16-v2.patch Normal file
View File

@ -0,0 +1,52 @@
http://lists.cairographics.org/archives/cairo/2013-March/024195.html
--- src/cairo-png.c 2012-03-29 12:05:32.000000000 +0200
+++ src/cairo-png.c 2013-03-30 09:13:50.817181600 +0100
@@ -497,6 +497,20 @@
}
}
+/* 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 @@
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 @@
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));

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 2 11:57:02 UTC 2013 - pgajdos@suse.com
- call png_set_read_user_transform_fn() before png_read_update_info()
[bnc#810701]
* libpng16-v2.patch
-------------------------------------------------------------------
Thu Feb 14 17:42:09 UTC 2013 - zaitor@opensuse.org

View File

@ -30,6 +30,8 @@ Source: http://cairographics.org/releases/%{name}-%{version}.tar.xz
Source99: baselibs.conf
# PATCH-FIX-UPSTREAM cairo-modules-no-version.patch fdo#29319 dimstar@opensuse.org -- Build modules with -module -avoid-version.
Patch0: cairo-modules-no-version.patch
# PATCH-FIX-UPSTREAM cairo-modules-no-version.patch bnc#810701 pgajdos@suse.com -- call png_set_read_user_transform_fn() before png_read_update_info()
Patch1: cairo-libpng16-v2.patch
# These libraries are needed only for tests.
# Do not enable tests in build systems, it causes build loop!
#BuildRequires: librsvg-devel poppler-devel
@ -148,6 +150,7 @@ cairo.
%prep
%setup -q
%patch0 -p1
%patch1
%build
# Needed by patch0