Dominique Leuenberger 2013-05-25 21:01:33 +00:00 committed by Git OBS Bridge
parent 798a97a9d7
commit 1358a77b81
3 changed files with 8 additions and 56 deletions

View File

@ -1,52 +0,0 @@
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,9 +1,16 @@
-------------------------------------------------------------------
Sat May 25 20:58:42 UTC 2013 - dimstar@opensuse.org
- Drop cairo-libpng16-v2.patch: in its current form, this patch
causes issues as that cairo.ImageSurface.create_from_png errors
out with 'MemoryError' in all cases (bnc#821766).
-------------------------------------------------------------------
Tue Apr 2 11:57:02 UTC 2013 - pgajdos@suse.com
- Add cairo-libpng16-v2.patch: Fix png usage with libpng 1.6:
call png_set_read_user_transform_fn() before
png_read_update_info() (bnc#810701)..
png_read_update_info() (bnc#810701).
-------------------------------------------------------------------
Thu Feb 14 17:42:09 UTC 2013 - zaitor@opensuse.org

View File

@ -30,8 +30,6 @@ 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-libpng16-v2.patch fdo#62779 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
@ -150,7 +148,6 @@ cairo.
%prep
%setup -q
%patch0 -p1
%patch1
%build
# Needed by patch0