Merge lp:~attente/gdk-pixbuf/gicon-upstream into lp:ubuntu/saucy/gdk-pixbuf

Proposed by William Hua
Status: Merged
Merge reported by: Sebastien Bacher
Merged at revision: not available
Proposed branch: lp:~attente/gdk-pixbuf/gicon-upstream
Merge into: lp:ubuntu/saucy/gdk-pixbuf
Diff against target: 2540 lines (+2389/-8)
13 files modified
.pc/applied-patches (+1/-0)
.pc/gicon-serialization-support.patch/configure.ac (+1057/-0)
.pc/gicon-serialization-support.patch/gdk-pixbuf/gdk-pixbuf.c (+892/-0)
.pc/gicon-serialization-support.patch/tests/Makefile.am (+30/-0)
configure.ac (+1/-1)
debian/changelog (+7/-0)
debian/control (+2/-2)
debian/control.in (+2/-2)
debian/patches/gicon-serialization-support.patch (+229/-0)
debian/patches/series (+1/-0)
gdk-pixbuf/gdk-pixbuf.c (+102/-2)
tests/Makefile.am (+5/-1)
tests/pixbuf-icon-serialize.c (+60/-0)
To merge this branch: bzr merge lp:~attente/gdk-pixbuf/gicon-upstream
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Information
Ubuntu branches Pending
Review via email: mp+162431@code.launchpad.net

Commit message

* debian/patches/gicon-serialization-support.patch:
  - Add upstream's GdkPixbuf serialization support.

Description of the change

Take upstream's update of GdkPixbuf to implement the GLoadableIcon interface. Requires https://code.launchpad.net/~attente/glib/gicon-upstream/+merge/162430.

To post a comment you must log in.
55. By Sebastien Bacher

* Resynchronize on Debian, remaining changes:
* debian/control.in:
  - B-D on libtiff5-dev | libtiff-dev instead of libtiff-dev, as we
    have made this transition ahead of Debian.

56. By Sebastien Bacher

* Resynchronize on Debian, remaining changes:
* debian/control.in:
  - B-D on libtiff5-dev | libtiff-dev instead of libtiff-dev, as we
    have made this transition ahead of Debian.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work, the patch require glib 2.36 and the debian/control 2.34 ... should that be bumped to 2.34? Did you try it with glib 2.37.0 which landed this week? out of the glib requirement issue it should be fine to upload to the ppa for some testing and then to ubuntu

review: Needs Information
58. By William Hua

Depend on GLib 2.37 for GIcon changes.

Revision history for this message
William Hua (attente) wrote :

Thanks, I bumped the GLib version number required, so we should be good now. I'm running it on my system against 2.37 and everything is working fine.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, I've renamed the patch to append "git-" (which we use as a convention to indicator it's an upstream git backport, makes easier to figure out it can be dropped later), added the git description to the patch and uploaded to Ubuntu

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.pc/applied-patches'
2--- .pc/applied-patches 1970-01-01 00:00:00 +0000
3+++ .pc/applied-patches 2013-05-17 06:11:25 +0000
4@@ -0,0 +1,1 @@
5+gicon-serialization-support.patch
6
7=== removed file '.pc/applied-patches'
8=== added directory '.pc/gicon-serialization-support.patch'
9=== added file '.pc/gicon-serialization-support.patch/configure.ac'
10--- .pc/gicon-serialization-support.patch/configure.ac 1970-01-01 00:00:00 +0000
11+++ .pc/gicon-serialization-support.patch/configure.ac 2013-05-17 06:11:25 +0000
12@@ -0,0 +1,1057 @@
13+# Process this file with autoconf to produce a configure script.
14+AC_PREREQ([2.63])
15+
16+# Making point releases:
17+# gdk_pixbuf_micro_version += 1;
18+# gdk_pixbuf_interface_age += 1;
19+# gdk_pixbuf_binary_age += 1;
20+#
21+# if any functions have been added, set gdk_pixbuf_interface_age to 0.
22+#
23+# if backwards compatibility has been broken:
24+# gdk_pixbuf_major_version += 1;
25+# gdk_pixbuf_interface_age = 0;
26+# gdk_pixbuf_binary_age = 0;
27+
28+m4_define([gdk_pixbuf_major_version], [2])
29+m4_define([gdk_pixbuf_minor_version], [28])
30+m4_define([gdk_pixbuf_micro_version], [1])
31+m4_define([gdk_pixbuf_interface_age], [1])
32+m4_define([gdk_pixbuf_binary_age],
33+ [m4_eval(100 * gdk_pixbuf_minor_version + gdk_pixbuf_micro_version)])
34+m4_define([gdk_pixbuf_version],
35+ [gdk_pixbuf_major_version.gdk_pixbuf_minor_version.gdk_pixbuf_micro_version])
36+m4_define([gdk_pixbuf_api_version], [2.0])
37+m4_define([gdk_pixbuf_binary_version], [2.10.0])
38+
39+
40+# required versions of other packages
41+m4_define([glib_required_version], [2.34.0])
42+
43+AC_INIT([gdk-pixbuf], [gdk_pixbuf_version],
44+ [http://bugzilla.gnome.org/enter_bug.cgi?product=gdk-pixbuf],
45+ [gdk-pixbuf])
46+
47+AC_CONFIG_HEADER([config.h])
48+AC_CONFIG_SRCDIR([gdk-pixbuf/gdk-pixbuf.h])
49+AC_CONFIG_MACRO_DIR([m4])
50+
51+# Save this value here, since automake will set cflags later
52+cflags_set=${CFLAGS+set}
53+
54+AM_INIT_AUTOMAKE([1.11 foreign no-define -Wno-portability dist-xz no-dist-gzip tar-ustar])
55+AM_MAINTAINER_MODE([enable])
56+
57+# Support silent build rules. Disable
58+# by either passing --disable-silent-rules to configure or passing V=0
59+# to make
60+AM_SILENT_RULES([yes])
61+
62+#
63+# For each of the libraries we build, we define the following
64+# substituted variables:
65+#
66+# foo_PACKAGES: pkg-config packages this library requires
67+# foo_EXTRA_LIBS: Libraries this module requires not pulled in by pkg-config
68+# foo_EXTRA_CFLAGS: cflags this module requires not pulled in by pkg-config
69+# foo_DEP_LIBS: All libraries this module requires
70+# foo_DEP_CFLAGS: All cflags this module requires
71+
72+GDK_PIXBUF_MAJOR=gdk_pixbuf_major_version
73+GDK_PIXBUF_MINOR=gdk_pixbuf_minor_version
74+GDK_PIXBUF_MICRO=gdk_pixbuf_micro_version
75+GDK_PIXBUF_VERSION=gdk_pixbuf_version
76+GDK_PIXBUF_API_VERSION=gdk_pixbuf_api_version
77+GDK_PIXBUF_BINARY_VERSION=gdk_pixbuf_binary_version
78+AC_SUBST(GDK_PIXBUF_MAJOR)
79+AC_SUBST(GDK_PIXBUF_MINOR)
80+AC_SUBST(GDK_PIXBUF_MICRO)
81+AC_SUBST(GDK_PIXBUF_VERSION)
82+AC_SUBST(GDK_PIXBUF_API_VERSION)
83+AC_SUBST(GDK_PIXBUF_BINARY_VERSION)
84+
85+# libtool versioning
86+#LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
87+#LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
88+#LT_REVISION=$GTK_INTERFACE_AGE
89+#LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
90+#LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
91+
92+m4_define([lt_current], [m4_eval(100 * gdk_pixbuf_minor_version + gdk_pixbuf_micro_version - gdk_pixbuf_interface_age)])
93+m4_define([lt_revision], [gdk_pixbuf_interface_age])
94+m4_define([lt_age], [m4_eval(gdk_pixbuf_binary_age - gdk_pixbuf_interface_age)])
95+LT_VERSION_INFO="lt_current:lt_revision:lt_age"
96+LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
97+AC_SUBST(LT_VERSION_INFO)
98+AC_SUBST(LT_CURRENT_MINUS_AGE)
99+
100+# Checks for programs.
101+AC_PROG_CC
102+AC_PROG_CC_C_O
103+AC_PROG_CC_STDC
104+AC_PROG_INSTALL
105+AC_PROG_MAKE_SET
106+PKG_PROG_PKG_CONFIG
107+
108+AC_CANONICAL_HOST
109+
110+AC_ARG_ENABLE(gio-sniffing,
111+ [AC_HELP_STRING([--enable-gio-sniffing=@<:@no/yes/auto@:>@],
112+ [enable or disable gio sniffing [default=auto]])],,
113+ [enable_gio_sniffing=auto])
114+
115+MATH_LIB=-lm
116+AC_MSG_CHECKING([for native Win32])
117+LIB_EXE_MACHINE_FLAG=X86
118+EXE_MANIFEST_ARCHITECTURE=X86
119+case "$host" in
120+ *-*-mingw*)
121+ os_win32=yes
122+ gio_can_sniff=no
123+ MATH_LIB=
124+ case "$host" in
125+ x86_64-*-*)
126+ LIB_EXE_MACHINE_FLAG=X64
127+ EXE_MANIFEST_ARCHITECTURE=AMD64
128+ ;;
129+ esac
130+ ;;
131+ *)
132+ os_win32=no
133+ ;;
134+esac
135+AC_MSG_RESULT([$os_win32])
136+
137+AC_SUBST(LIB_EXE_MACHINE_FLAG)
138+AC_SUBST(EXE_MANIFEST_ARCHITECTURE)
139+
140+case $host in
141+ *-*-linux*)
142+ os_linux=yes
143+ ;;
144+esac
145+
146+if test "$os_win32" = "yes"; then
147+ if test x$enable_static = xyes -o x$enable_static = x; then
148+ AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
149+ enable_static=no
150+ fi
151+ if test x$enable_shared = xno; then
152+ AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
153+ fi
154+ enable_shared=yes
155+fi
156+
157+dnl Initialize libtool
158+LT_PREREQ([2.2.6])
159+LT_INIT([disable-static win32-dll])
160+# Create libtool early, because it's used in configure
161+LT_OUTPUT
162+
163+# Make sure we use 64-bit versions of various file stuff.
164+AC_SYS_LARGEFILE
165+
166+AM_PROG_AS
167+AC_CHECK_TOOLS(NM, nm, nm)
168+
169+AC_MSG_CHECKING([for some Win32 platform])
170+AS_CASE(["$host"],
171+ [*-*-mingw*|*-*-cygwin*], [platform_win32=yes],
172+ [platform_win32=no]
173+)
174+AC_MSG_RESULT([$platform_win32])
175+AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
176+
177+AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
178+AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
179+AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
180+
181+if test "$os_win32" = "yes"; then
182+ AC_CHECK_TOOL(WINDRES, windres, no)
183+ if test "$WINDRES" = no; then
184+ AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
185+ fi
186+ AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
187+fi
188+AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
189+
190+m4_define([debug_default],
191+ m4_if(m4_eval(gdk_pixbuf_minor_version % 2), [1], [yes], [minimum]))
192+
193+dnl declare --enable-* args and collect ac_help strings
194+AC_ARG_ENABLE(debug,
195+ AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
196+ [turn on debugging @<:@default=debug_default@:>@]),,
197+ enable_debug=debug_default)
198+AC_ARG_ENABLE(rebuilds,
199+ [AC_HELP_STRING([--disable-rebuilds],
200+ [disable all source autogeneration rules])],,
201+ [enable_rebuilds=yes])
202+
203+AS_CASE([$enable_debug],
204+ [yes],
205+ [
206+ test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
207+ GDK_PIXBUF_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES"
208+ ],
209+
210+ [no], [GDK_PIXBUF_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"],
211+
212+ [minimum], [GDK_PIXBUF_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"]
213+)
214+
215+# Build time sanity check...
216+AM_SANITY_CHECK
217+
218+changequote(,)dnl
219+if test "x$GCC" = "xyes"; then
220+ case " $CFLAGS " in
221+ *[\ \ ]-Wall[\ \ ]*) ;;
222+ *) CFLAGS="$CFLAGS -Wall" ;;
223+ esac
224+
225+ if test "x$enable_ansi" = "xyes"; then
226+ case " $CFLAGS " in
227+ *[\ \ ]-ansi[\ \ ]*) ;;
228+ *) CFLAGS="$CFLAGS -ansi" ;;
229+ esac
230+
231+ case " $CFLAGS " in
232+ *[\ \ ]-pedantic[\ \ ]*) ;;
233+ *) CFLAGS="$CFLAGS -pedantic" ;;
234+ esac
235+ fi
236+fi
237+changequote([,])dnl
238+
239+CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES"
240+
241+# Ensure MSVC-compatible struct packing convention is used when
242+# compiling for Win32 with gcc.
243+# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
244+# gcc2 uses "-fnative-struct".
245+if test x"$os_win32" = xyes; then
246+ if test x"$GCC" = xyes; then
247+ msnative_struct=''
248+ AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
249+ if test -z "$ac_cv_prog_CC"; then
250+ our_gcc="$CC"
251+ else
252+ our_gcc="$ac_cv_prog_CC"
253+ fi
254+ case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
255+ 2.)
256+ if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
257+ msnative_struct='-fnative-struct'
258+ fi
259+ ;;
260+ *)
261+ if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
262+ msnative_struct='-mms-bitfields'
263+ fi
264+ ;;
265+ esac
266+ if test x"$msnative_struct" = x ; then
267+ AC_MSG_RESULT([no way])
268+ AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
269+ else
270+ CFLAGS="$CFLAGS $msnative_struct"
271+ AC_MSG_RESULT([${msnative_struct}])
272+ fi
273+ fi
274+fi
275+
276+## Initial sanity check, done here so that users get told they
277+## have the wrong dependencies as early in the process as possible.
278+## Later on we actually use the cflags/libs from separate pkg-config
279+## calls. Oh, also the later pkg-config calls don't include
280+## the version requirements since those make the module lists
281+## annoying to construct
282+PKG_CHECK_MODULES(BASE_DEPENDENCIES, [glib-2.0 >= glib_required_version])
283+
284+if test "$os_win32" != yes; then
285+ # libtool option to control which symbols are exported
286+ # right now, symbols starting with _ are not exported
287+ LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
288+else
289+ # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
290+ LIBTOOL_EXPORT_OPTIONS=
291+fi
292+AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
293+
294+dnl ******************************************************
295+dnl * See whether to include shared library dependencies *
296+dnl ******************************************************
297+
298+AC_ARG_ENABLE(explicit-deps,
299+ [AC_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@],
300+ [use explicit dependencies in .pc files [default=auto]])],,
301+ [enable_explicit_deps=auto])
302+
303+AC_MSG_CHECKING([Whether to write dependencies into .pc files])
304+case $enable_explicit_deps in
305+ auto)
306+ export SED
307+ deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
308+ if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then
309+ enable_explicit_deps=yes
310+ else
311+ enable_explicit_deps=no
312+ fi
313+ ;;
314+ yes|no)
315+ ;;
316+ *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
317+ ;;
318+esac
319+AC_MSG_RESULT($enable_explicit_deps)
320+
321+AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
322+
323+# define a MAINT-like variable REBUILD which is set if Perl
324+# and awk are found, so autogenerated sources can be rebuilt
325+
326+AC_PATH_PROGS(PERL, perl5 perl)
327+
328+REBUILD=\#
329+if test "x$enable_rebuilds" = "xyes" && \
330+ test -n "$PERL" && \
331+ $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
332+ REBUILD=
333+fi
334+AC_SUBST(REBUILD)
335+
336+# sigsetjmp is a macro on some platforms, so AC_CHECK_FUNCS is not reliable
337+AC_MSG_CHECKING(for sigsetjmp)
338+AC_TRY_LINK([#include <setjmp.h>], [
339+sigjmp_buf env;
340+sigsetjmp(env, 0);
341+], gtk_ok=yes, gtk_ok=no)
342+AC_MSG_RESULT($gtk_ok)
343+if test "$gtk_ok" = "yes"; then
344+ AC_DEFINE(HAVE_SIGSETJMP, 1,
345+ [Define to 1 if sigsetjmp is available])
346+fi
347+
348+# i18n stuff
349+AM_GNU_GETTEXT_VERSION([0.17])
350+AM_GNU_GETTEXT([external])
351+
352+GETTEXT_PACKAGE="$PACKAGE"
353+AC_SUBST(GETTEXT_PACKAGE)
354+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
355+ [The prefix for our gettext translation domains.])
356+
357+dnl The DU4 header files don't provide library prototypes unless
358+dnl -std1 is given to the native cc.
359+AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
360+
361+gtk_save_LIBS=$LIBS
362+LIBS="$LIBS -lm"
363+AC_TRY_RUN([#include <math.h>
364+ int main (void) { return (log(1) != log(1.)); }],
365+ AC_MSG_RESULT(none needed),
366+ gtk_save_CFLAGS="$CFLAGS"
367+ CFLAGS="$CFLAGS -std1"
368+ AC_TRY_RUN([#include <math.h>
369+ int main (void) { return (log(1) != log(1.)); }],
370+ AC_MSG_RESULT(-std1),
371+ AC_MSG_RESULT()
372+ CFLAGS="$gtk_save_CFLAGS"
373+ AC_MSG_WARN(
374+ [No ANSI prototypes found in library. (-std1 didn't work.)]),
375+ true
376+ ),
377+ AC_MSG_RESULT(none needed)
378+)
379+LIBS=$gtk_save_LIBS
380+
381+AC_MSG_CHECKING(for the BeOS)
382+case $host in
383+ *-*-beos*)
384+ AC_MSG_RESULT(yes)
385+ MATH_LIB=
386+ ;;
387+ *)
388+ AC_MSG_RESULT(no)
389+ ;;
390+esac
391+
392+AC_SUBST(MATH_LIB)
393+#
394+# see bug 162979
395+#
396+AC_MSG_CHECKING(for HP-UX)
397+case $host_os in
398+ hpux9* | hpux10* | hpux11*)
399+ AC_MSG_RESULT(yes)
400+ CFLAGS="$CFLAGS -DHPPEX -DSHMLINK"
401+ ;;
402+ *)
403+ AC_MSG_RESULT(no)
404+ ;;
405+esac
406+
407+dnl NeXTStep cc seems to need this
408+AC_MSG_CHECKING([for extra flags for POSIX compliance])
409+AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
410+ AC_MSG_RESULT(none needed),
411+ gtk_save_CFLAGS="$CFLAGS"
412+ CFLAGS="$CFLAGS -posix"
413+ AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
414+ AC_MSG_RESULT(-posix),
415+ AC_MSG_RESULT()
416+ CFLAGS="$gtk_save_CFLAGS"
417+ AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
418+
419+#
420+# Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
421+#
422+
423+GLIB_PACKAGES="gobject-2.0 gio-2.0 gmodule-no-export-2.0"
424+
425+AM_PATH_GLIB_2_0(glib_required_version, :,
426+ AC_MSG_ERROR([
427+*** GLIB glib_required_version or better is required. The latest version of
428+*** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
429+ gobject gmodule-no-export gthread)
430+
431+dnl
432+dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
433+dnl
434+gtk_save_LIBS=$LIBS
435+LIBS="$LIBS $GLIB_LIBS"
436+AC_CHECK_FUNCS(bind_textdomain_codeset)
437+LIBS=$gtk_save_LIBS
438+
439+AC_CHECK_HEADERS(unistd.h,
440+ AC_DEFINE(HAVE_UNISTD_H, 1,
441+ [Define to 1 if unistd.h is available]))
442+
443+saved_cflags="$CFLAGS"
444+saved_ldflags="$LDFLAGS"
445+
446+
447+# Checks for header files.
448+AC_HEADER_STDC
449+
450+# Checks for typedefs, structures, and compiler characteristics.
451+AC_C_CONST
452+
453+##################################################
454+# Checks for gdk-pixbuf
455+##################################################
456+
457+dnl ********************************************************
458+dnl * See whether we need to load our modules as .la files *
459+dnl ********************************************************
460+
461+use_la_modules=false
462+case $host in
463+ *-aix*) use_la_modules=true
464+esac
465+
466+if $use_la_modules ; then
467+ AC_DEFINE(USE_LA_MODULES, 1,
468+ [Whether to load modules via .la files rather than directly])
469+fi
470+
471+
472+AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
473+
474+AC_ARG_ENABLE(modules,
475+ [AC_HELP_STRING([--disable-modules],
476+ [disable dynamic module loading])])
477+
478+dynworks=false
479+deps=
480+if test x$enable_modules = xno; then
481+ AC_MSG_RESULT(no)
482+else
483+ AC_MSG_RESULT(yes)
484+ AC_MSG_CHECKING(whether dynamic modules work)
485+ ## for loop is to strip newline
486+ tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-no-export-2.0`
487+ for I in $tmp; do
488+ dynworks=$I
489+ done
490+
491+ dnl Now we check to see if our libtool supports shared lib deps
492+ dnl (in a rather ugly way even)
493+ if $dynworks; then
494+ pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
495+ pixbuf_deplibs_check=`$pixbuf_libtool_config | \
496+ grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
497+ sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
498+ if test "x$pixbuf_deplibs_check" = "xnone" || \
499+ test "x$pixbuf_deplibs_check" = "xunknown" || \
500+ test "x$pixbuf_deplibs_check" = "x"; then
501+ dynworks=false
502+ fi
503+ fi
504+
505+ if $dynworks; then
506+ AC_DEFINE(USE_GMODULE, 1,
507+ [Define to 1 if gmodule works and should be used])
508+ AC_MSG_RESULT(yes)
509+ else
510+ AC_MSG_RESULT(no)
511+ fi
512+fi
513+
514+dnl We allow people to disable image loaders explicitely, but if they don't we error
515+dnl out so that people don't accidentally build without them.
516+
517+AC_ARG_WITH(libpng,
518+ [AC_HELP_STRING([--without-libpng],
519+ [disable PNG loader for gdk-pixbuf])])
520+AC_ARG_WITH(libjpeg,
521+ [AC_HELP_STRING([--without-libjpeg],
522+ [disable JPEG loader for gdk-pixbuf])])
523+AC_ARG_WITH(libtiff,
524+ [AC_HELP_STRING([--without-libtiff],
525+ [disable TIFF loader for gdk-pixbuf])])
526+AC_ARG_WITH(libjasper,
527+ [AC_HELP_STRING([--with-libjasper],
528+ [enable JPEG2000 loader for gdk-pixbuf])])
529+AC_ARG_WITH(gdiplus,
530+ [AC_HELP_STRING([--without-gdiplus],
531+ [disable GDI+ loaders for gdk-pixbuf on Windows])])
532+
533+AM_CONDITIONAL(BUILD_GDIPLUS_LOADERS, [ test x$os_win32 = xyes && test x$with_gdiplus != xno ])
534+
535+dnl Test for libtiff
536+if test x$os_win32 = xno || test x$with_gdiplus = xno; then
537+ if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
538+ AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
539+ [AC_CHECK_HEADER(tiffio.h,
540+ TIFF='tiff'; LIBTIFF='-ltiff',
541+ AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
542+ [AC_CHECK_LIB(tiff, TIFFWriteScanline,
543+ [AC_CHECK_HEADER(tiffio.h,
544+ TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
545+ AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
546+ [AC_CHECK_LIB(tiff34, TIFFFlushData,
547+ [AC_CHECK_HEADER(tiffio.h,
548+ TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
549+ AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
550+ AC_MSG_WARN(*** TIFF loader will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
551+ fi
552+
553+ if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
554+ AC_MSG_ERROR([
555+*** Checks for TIFF loader failed. You can build without it by passing
556+*** --without-libtiff to configure but some programs using GTK+ may
557+*** not work properly])
558+ fi
559+fi
560+
561+dnl Test for libjpeg
562+if test x$os_win32 = xno || test x$with_gdiplus = xno; then
563+ if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
564+ AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
565+ jpeg_ok=yes,
566+ jpeg_ok=no
567+ AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
568+ if test "$jpeg_ok" = yes; then
569+ AC_MSG_CHECKING([for jpeglib.h])
570+ AC_TRY_CPP(
571+[#include <stdio.h>
572+#undef PACKAGE
573+#undef VERSION
574+#undef HAVE_STDLIB_H
575+#include <jpeglib.h>],
576+ jpeg_ok=yes,
577+ jpeg_ok=no)
578+ AC_MSG_RESULT($jpeg_ok)
579+ if test "$jpeg_ok" = yes; then
580+ LIBJPEG='-ljpeg'
581+ AC_CHECK_LIB(jpeg, jpeg_simple_progression,
582+ AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1,
583+ [Define to 1 is libjpeg supports progressive JPEG]),
584+ AC_MSG_WARN(JPEG library does not support progressive saving.))
585+ else
586+ AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
587+ fi
588+ fi
589+ fi
590+
591+ if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
592+ AC_MSG_ERROR([
593+*** Checks for JPEG loader failed. You can build without it by passing
594+*** --without-libjpeg to configure but some programs using GTK+ may
595+*** not work properly])
596+ fi
597+fi
598+
599+dnl Test for libpng
600+ if test x$with_libpng != xno && test -z "$LIBPNG"; then
601+ for l in libpng16 libpng15 libpng14 libpng12 libpng13 libpng10; do
602+ AC_MSG_CHECKING(for $l)
603+ if $PKG_CONFIG --exists $l ; then
604+ AC_MSG_RESULT(yes)
605+ PNG='png'
606+ PNG_DEP_CFLAGS_PACKAGES=$l
607+ LIBPNG=`$PKG_CONFIG --libs $l`
608+ break
609+ else
610+ AC_MSG_RESULT(no)
611+ fi
612+ done
613+ if test x$PNG != xpng; then
614+ AC_MSG_RESULT(no)
615+ AC_CHECK_LIB(png, png_read_info,
616+ [AC_CHECK_HEADER(png.h,
617+ png_ok=yes,
618+ png_ok=no)],
619+ AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
620+ if test "$png_ok" = yes; then
621+ AC_MSG_CHECKING([for png_structp in png.h])
622+ AC_TRY_COMPILE([#include <png.h>],
623+ [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
624+ png_ok=yes,
625+ png_ok=no)
626+ AC_MSG_RESULT($png_ok)
627+ if test "$png_ok" = yes; then
628+ PNG='png'; LIBPNG='-lpng -lz'
629+ else
630+ AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
631+ fi
632+ else
633+ AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
634+ fi
635+ fi
636+ fi
637+
638+ if test x$with_libpng != xno && test -z "$LIBPNG"; then
639+ AC_MSG_ERROR([
640+*** Checks for PNG loader failed. You can build without it by passing
641+*** --without-libpng to configure but many programs using GTK+ will
642+*** not work properly. The PNG loader is also needed if you are compiling
643+*** from Git.])
644+ fi
645+
646+dnl Test for libjasper
647+ if test x$with_libjasper = xyes && test -z "$LIBJASPER"; then
648+ AC_CHECK_LIB(jasper, jas_init, LIBJASPER=-ljasper, [], -ljpeg -lm)
649+ fi
650+
651+ if test x$with_libjasper = xyes && test -z "$LIBJASPER"; then
652+ AC_MSG_ERROR([
653+*** Checks for JPEG2000 loader failed. You can build without it by passing
654+*** --without-libjasper to configure])
655+ fi
656+
657+AC_SUBST(LIBTIFF)
658+AC_SUBST(LIBJPEG)
659+AC_SUBST(LIBPNG)
660+AC_SUBST(LIBJASPER)
661+
662+AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
663+
664+#
665+# Allow building some or all gdk-pixbuf loaders included
666+#
667+AC_MSG_CHECKING(pixbuf loaders to build)
668+
669+dnl due to an autoconf bug, commas in the first arg to
670+dnl AC_HELP_STRING cause problems.
671+dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
672+dnl [build the specified loaders into gdk-pixbuf])
673+AC_ARG_WITH(included_loaders,
674+[ --with-included-loaders=LOADER1,LOADER2,...
675+ build the specified loaders into gdk-pixbuf])
676+
677+if $dynworks; then
678+ :
679+else
680+ ## if the option was specified, leave it; otherwise disable included loaders
681+ if test x$with_included_loaders = xno; then
682+ with_included_loaders=yes
683+ fi
684+fi
685+
686+# Use the traditional png loader instead of the GDI+ one on Windows,
687+# because some important apps like GIMP need to read and write
688+# arbitrary tEXt chunks which doesn't seem to be possible through GDI+
689+
690+all_loaders="ani,icns,pcx,ras,tga,png,pnm,wbmp,xbm,xpm,qtif"
691+if test x$with_libjasper = xyes; then
692+ all_loaders="$all_loaders,jasper"
693+fi
694+if test x$os_win32 = xyes && test x$with_gdiplus != xno; then
695+ # Skip PNG, see comment above
696+ gdip_formats="bmp emf gif ico jpeg tiff wmf"
697+ for f in $gdip_formats; do
698+ all_loaders="$all_loaders,gdip-$f"
699+ done
700+else
701+ all_loaders="$all_loaders,bmp,gif,ico,jpeg,tiff"
702+fi
703+included_loaders=""
704+# If no loaders specified, include all
705+if test "x$with_included_loaders" = xyes ; then
706+ included_loaders="$all_loaders"
707+else
708+ included_loaders="$with_included_loaders"
709+fi
710+
711+AC_MSG_RESULT($included_loaders)
712+
713+INCLUDED_LOADER_OBJ=
714+INCLUDED_LOADER_DEFINE=
715+
716+IFS="${IFS= }"; gtk_save_ifs="$IFS"; IFS=","
717+for loader in $included_loaders; do
718+ if echo "$all_loaders" | egrep "(^|,)$loader(\$|,)" > /dev/null; then
719+ :
720+ else
721+ AC_MSG_ERROR([the specified loader $loader does not exist])
722+ fi
723+
724+ loader_underscores=`echo $loader | sed -e 's/-/_/g'`
725+ INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libstatic-pixbufloader-$loader.la"
726+
727+ # Don't bother defining separate -DINCLUDE_gdip_foo for each gdip-foo loader
728+ case $loader in
729+ gdip-*) ;;
730+ *) INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader_underscores";;
731+ esac
732+ eval INCLUDE_$loader_underscores=yes
733+done
734+
735+# Just define one -DINCLUDE_gdiplus for all the gdip-foo loaders
736+# (except gdip-png, which isn't built at all)
737+if test x"$INCLUDE_gdip_ico" = xyes; then
738+ INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_gdiplus"
739+fi
740+
741+IFS="$gtk_save_ifs"
742+AC_SUBST(INCLUDED_LOADER_OBJ)
743+AC_SUBST(INCLUDED_LOADER_DEFINE)
744+
745+AM_CONDITIONAL(INCLUDE_PNG, [test x"$INCLUDE_png" = xyes])
746+AM_CONDITIONAL(INCLUDE_BMP, [test x"$INCLUDE_bmp" = xyes])
747+AM_CONDITIONAL(INCLUDE_WBMP, [test x"$INCLUDE_wbmp" = xyes])
748+AM_CONDITIONAL(INCLUDE_GIF, [test x"$INCLUDE_gif" = xyes])
749+AM_CONDITIONAL(INCLUDE_ICO, [test x"$INCLUDE_ico" = xyes])
750+AM_CONDITIONAL(INCLUDE_ANI, [test x"$INCLUDE_ani" = xyes])
751+AM_CONDITIONAL(INCLUDE_JPEG, [test x"$INCLUDE_jpeg" = xyes])
752+AM_CONDITIONAL(INCLUDE_PNM, [test x"$INCLUDE_pnm" = xyes])
753+AM_CONDITIONAL(INCLUDE_RAS, [test x"$INCLUDE_ras" = xyes])
754+AM_CONDITIONAL(INCLUDE_TIFF, [test x"$INCLUDE_tiff" = xyes])
755+AM_CONDITIONAL(INCLUDE_XPM, [test x"$INCLUDE_xpm" = xyes])
756+AM_CONDITIONAL(INCLUDE_XBM, [test x"$INCLUDE_xbm" = xyes])
757+AM_CONDITIONAL(INCLUDE_TGA, [test x"$INCLUDE_tga" = xyes])
758+AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
759+AM_CONDITIONAL(INCLUDE_ICNS, [test x"$INCLUDE_icns" = xyes])
760+AM_CONDITIONAL(INCLUDE_JASPER, [test x"$INCLUDE_jasper" = xyes])
761+AM_CONDITIONAL(INCLUDE_QTIF, [test x"$INCLUDE_qtif" = xyes])
762+# As all GDI+ loaders are either built-in or not, arbitrarily just
763+# check one of the variables here
764+AM_CONDITIONAL(INCLUDE_GDIPLUS, [test x"$INCLUDE_gdip_ico" = xyes])
765+
766+if test x$enable_gio_sniffing = xauto && test x$gio_can_sniff = x; then
767+ AC_MSG_CHECKING([if gio can sniff png])
768+ gtk_save_LIBS="$LIBS"
769+ gtk_save_CFLAGS="$CFLAGS"
770+ LIBS="`$PKG_CONFIG --libs gio-2.0`"
771+ CFLAGS="`$PKG_CONFIG --cflags gio-2.0`"
772+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
773+ #include <gio/gio.h>
774+ static const gsize data_size = 159;
775+ static const guint8 data[] =
776+ {
777+ 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
778+ 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
779+ 0x08, 0x02, 0x00, 0x00, 0x00, 0x90, 0x77, 0x53, 0xde, 0x00, 0x00, 0x00,
780+ 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
781+ 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00,
782+ 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74,
783+ 0x49, 0x4d, 0x45, 0x07, 0xd8, 0x07, 0x0f, 0x10, 0x08, 0x15, 0x61, 0xd8,
784+ 0x35, 0x37, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f,
785+ 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
786+ 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x57,
787+ 0x81, 0x0e, 0x17, 0x00, 0x00, 0x00, 0x0c, 0x49, 0x44, 0x41, 0x54, 0x08,
788+ 0xd7, 0x63, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0x05, 0xfe, 0x02, 0xfe, 0xdc,
789+ 0xcc, 0x59, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
790+ 0x42, 0x60, 0x82
791+ };
792+ int
793+ main (int argc, char **argv)
794+ {
795+ char *content_type;
796+ char *image_png;
797+ g_type_init ();
798+ content_type = g_content_type_guess (NULL, data, data_size, NULL);
799+ image_png = g_content_type_from_mime_type ("image/png");
800+ return !!g_strcmp0 (content_type, image_png);
801+ }]])],
802+ [gio_can_sniff=yes
803+ AC_DEFINE(GDK_PIXBUF_USE_GIO_MIME, 1, [Define if gio can sniff image data])],
804+ [gio_can_sniff=no])
805+ AC_MSG_RESULT($gio_can_sniff)
806+ LIBS="$gtk_save_LIBS"
807+ CFLAGS="$gtk_save_CFLAGS"
808+else
809+ if test x$enable_gio_sniffing = xyes; then
810+ gio_can_sniff=yes
811+ AC_DEFINE(GDK_PIXBUF_USE_GIO_MIME, 1, [Define if gio can sniff image data])
812+ else
813+ gio_can_sniff=no
814+ fi
815+fi
816+
817+AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
818+AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
819+AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
820+AM_CONDITIONAL(HAVE_JASPER, test "x$LIBJASPER" != x)
821+
822+if $dynworks ; then
823+ STATIC_LIB_DEPS=
824+ if echo "$included_loaders" | egrep '(^|,)tiff($|,)' > /dev/null; then
825+ STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
826+ fi
827+ if echo "$included_loaders" | egrep '(^|,)jpeg($|,)' > /dev/null; then
828+ STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJPEG"
829+ fi
830+ if echo "$included_loaders" | egrep '(^|,)png($|,)' > /dev/null; then
831+ if test -z $PNG_DEP_CFLAGS_PACKAGES; then
832+ STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
833+ fi
834+ fi
835+ if echo "$included_loaders" | egrep '(^|,)jasper($|,)' > /dev/null; then
836+ STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJASPER"
837+ fi
838+else
839+ STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG $LIBJASPER"
840+fi
841+
842+# Checks to see whether we should include mediaLib
843+# support.
844+#
845+AC_CHECK_HEADER(sys/systeminfo.h,
846+ AC_DEFINE(HAVE_SYS_SYSTEMINFO_H, 1,
847+ [Define to 1 if sys/systeminfo.h is available]))
848+AC_CHECK_HEADER(sys/sysinfo.h,
849+ AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
850+ [Define to 1 if sys/sysinfo.h is available]))
851+
852+AC_MSG_CHECKING(for mediaLib 2.3)
853+use_mlib25=no
854+# Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
855+# patch requires.
856+AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
857+if test $use_mlib = yes; then
858+ AC_DEFINE(USE_MEDIALIB, 1,
859+ [Define to 1 if medialib is available and should be used])
860+ MEDIA_LIB=-lmlib
861+
862+ AC_MSG_CHECKING(for mediaLib 2.5)
863+ # Check for a mediaLib 2.5 function since that is what is needed for
864+ # gdk_rgb_convert integration.
865+ AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
866+ if test $use_mlib25 = yes; then
867+ AC_DEFINE(USE_MEDIALIB25, 1,
868+ [Define to 1 if medialib 2.5 is available])
869+ fi
870+fi
871+AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
872+AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
873+
874+# Checks to see if we should compile in MMX support (there will be
875+# a runtime test when the code is actually run to see if it should
876+# be used - this just checks if we can compile it.)
877+#
878+# This code is partially taken from Mesa
879+#
880+AC_MSG_CHECKING(for x86 platform)
881+case $host_cpu in
882+ i386|i486|i586|i686|i786|k6|k7)
883+ use_x86_asm=yes
884+ ;;
885+ *)
886+ use_x86_asm=no
887+esac
888+AC_MSG_RESULT($use_x86_asm)
889+
890+use_mmx_asm=no
891+if test $use_x86_asm = yes; then
892+ save_ac_ext=$ac_ext
893+ ac_ext=S
894+
895+ AC_MSG_CHECKING(compiler support for MMX)
896+ cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
897+ if AC_TRY_EVAL(ac_compile); then
898+ use_mmx_asm=yes
899+ fi
900+
901+ rm -rf conftest*
902+
903+ ac_ext=$save_ac_ext
904+ if test $use_mmx_asm = yes; then
905+ AC_DEFINE(USE_MMX, 1,
906+ [Define to 1 if XXM is available and should be used])
907+ AC_MSG_RESULT(yes)
908+ else
909+ AC_MSG_RESULT(no)
910+ fi
911+fi
912+
913+AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
914+
915+REBUILD_PNGS=
916+if test -z "$LIBPNG" && test x"$os_win32" = xno -o x$with_gdiplus = xno; then
917+ REBUILD_PNGS=#
918+fi
919+
920+dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
921+
922+AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
923+
924+if test $cross_compiling = yes; then
925+ AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
926+ AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
927+ if test x$GTK_UPDATE_ICON_CACHE = xno; then
928+ REBUILD_PNGS=#
929+ fi
930+fi
931+
932+GDK_PIXBUF_PACKAGES="gmodule-no-export-2.0 gobject-2.0 gio-2.0"
933+GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB $MEDIA_LIB"
934+GDK_PIXBUF_EXTRA_CFLAGS=
935+GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
936+GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
937+
938+AC_SUBST(PNG_DEP_CFLAGS_PACKAGES)
939+AC_SUBST(GDK_PIXBUF_PACKAGES)
940+AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
941+AC_SUBST(GDK_PIXBUF_EXTRA_CFLAGS)
942+AC_SUBST(GDK_PIXBUF_DEP_LIBS)
943+AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
944+
945+###############
946+# Check for X11
947+###############
948+
949+GDK_PIXBUF_XLIB_PACKAGES=
950+GDK_PIXBUF_XLIB_EXTRA_CFLAGS=
951+GDK_PIXBUF_XLIB_EXTRA_LIBS=
952+
953+AC_ARG_WITH(x11,
954+ [AC_HELP_STRING([--with-x11],
955+ [build X11 support])])
956+
957+if test x$with_x11 = xyes; then
958+ AM_CONDITIONAL(USE_X11, true)
959+ PKG_CHECK_MODULES(GDK_PIXBUF_XLIB_DEP, x11 gobject-2.0)
960+else
961+ AM_CONDITIONAL(USE_X11, false)
962+fi
963+
964+################################################################
965+# Strip -export-dynamic from the link lines of various libraries
966+################################################################
967+
968+#
969+# pkg-config --libs gmodule includes the "export_dynamic" flag,
970+# but this flag is only meaningful for executables. For libraries
971+# the effect is undefined; what it causes on Linux is that the
972+# export list from -export-symbols-regex is ignored and everything
973+# is exported
974+#
975+# We are using gmodule-no-export now, but I'm leaving the stripping
976+# code in place for now, since pango and atk still require gmodule.
977+export SED
978+export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
979+if test -n "$export_dynamic"; then
980+ GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"`
981+fi
982+
983+##################################################
984+# GObject introspection
985+##################################################
986+
987+GOBJECT_INTROSPECTION_CHECK([0.9.3])
988+
989+##################################################
990+# Checks for gtk-doc and docbook-tools
991+##################################################
992+
993+GTK_DOC_CHECK([1.11], [--flavour=no-tmpl])
994+
995+AC_CHECK_PROG(DB2HTML, db2html, true, false)
996+AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
997+
998+AC_ARG_ENABLE(man,
999+ [AC_HELP_STRING([--enable-man],
1000+ [regenerate man pages from Docbook [default=no]])],enable_man=yes,
1001+ enable_man=no)
1002+
1003+if test "${enable_man}" != no; then
1004+ dnl
1005+ dnl Check for xsltproc
1006+ dnl
1007+ AC_PATH_PROG([XSLTPROC], [xsltproc])
1008+ if test -z "$XSLTPROC"; then
1009+ enable_man=no
1010+ fi
1011+fi
1012+
1013+AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
1014+
1015+
1016+##################################################
1017+# Check for -Bsymbolic-functions linker flag used
1018+# to avoid intra-library PLT jumps, if available.
1019+##################################################
1020+
1021+AC_ARG_ENABLE(Bsymbolic,
1022+ [AC_HELP_STRING([--disable-Bsymbolic],
1023+ [avoid linking with -Bsymbolic])],,
1024+ [SAVED_LDFLAGS="${LDFLAGS}"
1025+ AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
1026+ LDFLAGS=-Wl,-Bsymbolic-functions
1027+ AC_TRY_LINK([], [int main (void) { return 0; }],
1028+ AC_MSG_RESULT(yes)
1029+ enable_Bsymbolic=yes,
1030+ AC_MSG_RESULT(no)
1031+ enable_Bsymbolic=no)
1032+ LDFLAGS="${SAVED_LDFLAGS}"])
1033+
1034+if test "x${enable_Bsymbolic}" = "xyes"; then
1035+ GDK_PIXBUF_LINK_FLAGS=-Wl,-Bsymbolic-functions
1036+fi
1037+
1038+AC_SUBST(GDK_PIXBUF_LINK_FLAGS)
1039+
1040+
1041+##################################################
1042+# Output commands
1043+##################################################
1044+
1045+AC_CONFIG_FILES([
1046+Makefile
1047+gdk-pixbuf-2.0.pc
1048+gdk-pixbuf-2.0-uninstalled.pc
1049+gdk-pixbuf/Makefile
1050+gdk-pixbuf/gdk_pixbuf.rc
1051+gdk-pixbuf/gdk-pixbuf-features.h
1052+gdk-pixbuf/pixops/Makefile
1053+build/Makefile
1054+build/win32/Makefile
1055+build/win32/vs9/Makefile
1056+build/win32/vs10/Makefile
1057+docs/Makefile
1058+docs/reference/Makefile
1059+docs/reference/gdk-pixbuf/Makefile
1060+docs/reference/gdk-pixbuf/version.xml
1061+po/Makefile.in
1062+tests/Makefile
1063+contrib/Makefile
1064+contrib/gdk-pixbuf-xlib/Makefile
1065+contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
1066+config.h.win32
1067+])
1068+
1069+AC_OUTPUT
1070
1071=== added directory '.pc/gicon-serialization-support.patch/gdk-pixbuf'
1072=== added file '.pc/gicon-serialization-support.patch/gdk-pixbuf/gdk-pixbuf.c'
1073--- .pc/gicon-serialization-support.patch/gdk-pixbuf/gdk-pixbuf.c 1970-01-01 00:00:00 +0000
1074+++ .pc/gicon-serialization-support.patch/gdk-pixbuf/gdk-pixbuf.c 2013-05-17 06:11:25 +0000
1075@@ -0,0 +1,892 @@
1076+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
1077+/* GdkPixbuf library - Basic memory management
1078+ *
1079+ * Copyright (C) 1999 The Free Software Foundation
1080+ *
1081+ * Authors: Mark Crichton <crichton@gimp.org>
1082+ * Miguel de Icaza <miguel@gnu.org>
1083+ * Federico Mena-Quintero <federico@gimp.org>
1084+ *
1085+ * This library is free software; you can redistribute it and/or
1086+ * modify it under the terms of the GNU Lesser General Public
1087+ * License as published by the Free Software Foundation; either
1088+ * version 2 of the License, or (at your option) any later version.
1089+ *
1090+ * This library is distributed in the hope that it will be useful,
1091+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1092+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1093+ * Lesser General Public License for more details.
1094+ *
1095+ * You should have received a copy of the GNU Lesser General Public
1096+ * License along with this library; if not, write to the
1097+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1098+ * Boston, MA 02111-1307, USA.
1099+ */
1100+
1101+#include "config.h"
1102+
1103+#include <math.h>
1104+#include <stdlib.h>
1105+#include <string.h>
1106+
1107+#define GDK_PIXBUF_C_COMPILATION
1108+#include "gdk-pixbuf-private.h"
1109+#include "gdk-pixbuf-features.h"
1110+#include "gdk-pixbuf-enum-types.h"
1111+
1112+/* Include the marshallers */
1113+#include <glib-object.h>
1114+#include <gio/gio.h>
1115+#include "gdk-pixbuf-marshal.c"
1116+
1117+/**
1118+ * SECTION:creating
1119+ * @Short_description: Creating a pixbuf from image data that is already in memory.
1120+ * @Title: Image Data in Memory
1121+ * @See_also: gdk_pixbuf_finalize().
1122+ *
1123+ * The most basic way to create a pixbuf is to wrap an existing pixel
1124+ * buffer with a #GdkPixbuf structure. You can use the
1125+ * gdk_pixbuf_new_from_data() function to do this You need to specify
1126+ * the destroy notification function that will be called when the
1127+ * data buffer needs to be freed; this will happen when a #GdkPixbuf
1128+ * is finalized by the reference counting functions If you have a
1129+ * chunk of static data compiled into your application, you can pass
1130+ * in %NULL as the destroy notification function so that the data
1131+ * will not be freed.
1132+ *
1133+ *
1134+ * The gdk_pixbuf_new() function can be used as a convenience to
1135+ * create a pixbuf with an empty buffer. This is equivalent to
1136+ * allocating a data buffer using <function>malloc()</function> and
1137+ * then wrapping it with gdk_pixbuf_new_from_data(). The gdk_pixbuf_new()
1138+ * function will compute an optimal rowstride so that rendering can be
1139+ * performed with an efficient algorithm.
1140+ *
1141+ *
1142+ * As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
1143+ * function to create a pixbuf from inline XPM image data.
1144+ *
1145+ *
1146+ * You can also copy an existing pixbuf with the gdk_pixbuf_copy()
1147+ * function. This is not the same as just doing a g_object_ref()
1148+ * on the old pixbuf; the copy function will actually duplicate the
1149+ * pixel data in memory and create a new #GdkPixbuf structure for it.
1150+ */
1151+
1152+/**
1153+ * SECTION:refcounting
1154+ * @Short_description: Functions for reference counting and memory management on pixbufs.
1155+ * @Title: Reference Counting and Memory Mangement
1156+ * @See_also: #GdkPixbuf, gdk_pixbuf_new_from_data().
1157+ *
1158+ * #GdkPixbuf structures are reference counted. This means that an
1159+ * application can share a single pixbuf among many parts of the
1160+ * code. When a piece of the program needs to keep a pointer to a
1161+ * pixbuf, it should add a reference to it by calling g_object_ref().
1162+ * When it no longer needs the pixbuf, it should subtract a reference
1163+ * by calling g_object_unref(). The pixbuf will be destroyed when
1164+ * its reference count drops to zero. Newly-created #GdkPixbuf
1165+ * structures start with a reference count of one.
1166+ *
1167+ *
1168+ * <note>
1169+ * As #GdkPixbuf is derived from #GObject now, gdk_pixbuf_ref() and
1170+ * gdk_pixbuf_unref() are deprecated in favour of g_object_ref()
1171+ * and g_object_unref () resp.
1172+ * </note>
1173+ *
1174+ * <emphasis>Finalizing</emphasis> a pixbuf means to free its pixel
1175+ * data and to free the #GdkPixbuf structure itself. Most of the
1176+ * library functions that create #GdkPixbuf structures create the
1177+ * pixel data by themselves and define the way it should be freed;
1178+ * you do not need to worry about those. The only function that lets
1179+ * you specify how to free the pixel data is
1180+ * gdk_pixbuf_new_from_data(). Since you pass it a pre-allocated
1181+ * pixel buffer, you must also specify a way to free that data. This
1182+ * is done with a function of type #GdkPixbufDestroyNotify. When a
1183+ * pixbuf created with gdk_pixbuf_new_from_data() is finalized, your
1184+ * destroy notification function will be called, and it is its
1185+ * responsibility to free the pixel array.
1186+ */
1187+
1188+static void gdk_pixbuf_finalize (GObject *object);
1189+static void gdk_pixbuf_set_property (GObject *object,
1190+ guint prop_id,
1191+ const GValue *value,
1192+ GParamSpec *pspec);
1193+static void gdk_pixbuf_get_property (GObject *object,
1194+ guint prop_id,
1195+ GValue *value,
1196+ GParamSpec *pspec);
1197+
1198+
1199
1200+enum
1201+{
1202+ PROP_0,
1203+ PROP_COLORSPACE,
1204+ PROP_N_CHANNELS,
1205+ PROP_HAS_ALPHA,
1206+ PROP_BITS_PER_SAMPLE,
1207+ PROP_WIDTH,
1208+ PROP_HEIGHT,
1209+ PROP_ROWSTRIDE,
1210+ PROP_PIXELS
1211+};
1212+
1213+static void gdk_pixbuf_icon_iface_init (GIconIface *iface);
1214+
1215+G_DEFINE_TYPE_WITH_CODE (GdkPixbuf, gdk_pixbuf, G_TYPE_OBJECT,
1216+ G_IMPLEMENT_INTERFACE (G_TYPE_ICON,
1217+ gdk_pixbuf_icon_iface_init))
1218+
1219+static void
1220+gdk_pixbuf_init (GdkPixbuf *pixbuf)
1221+{
1222+}
1223+
1224+static void
1225+gdk_pixbuf_class_init (GdkPixbufClass *klass)
1226+{
1227+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
1228+
1229+ object_class->finalize = gdk_pixbuf_finalize;
1230+ object_class->set_property = gdk_pixbuf_set_property;
1231+ object_class->get_property = gdk_pixbuf_get_property;
1232+
1233+#define PIXBUF_PARAM_FLAGS G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY|\
1234+ G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
1235+ /**
1236+ * GdkPixbuf:n-channels:
1237+ *
1238+ * The number of samples per pixel.
1239+ * Currently, only 3 or 4 samples per pixel are supported.
1240+ */
1241+ g_object_class_install_property (object_class,
1242+ PROP_N_CHANNELS,
1243+ g_param_spec_int ("n-channels",
1244+ P_("Number of Channels"),
1245+ P_("The number of samples per pixel"),
1246+ 0,
1247+ G_MAXINT,
1248+ 3,
1249+ PIXBUF_PARAM_FLAGS));
1250+
1251+ g_object_class_install_property (object_class,
1252+ PROP_COLORSPACE,
1253+ g_param_spec_enum ("colorspace",
1254+ P_("Colorspace"),
1255+ P_("The colorspace in which the samples are interpreted"),
1256+ GDK_TYPE_COLORSPACE,
1257+ GDK_COLORSPACE_RGB,
1258+ PIXBUF_PARAM_FLAGS));
1259+
1260+ g_object_class_install_property (object_class,
1261+ PROP_HAS_ALPHA,
1262+ g_param_spec_boolean ("has-alpha",
1263+ P_("Has Alpha"),
1264+ P_("Whether the pixbuf has an alpha channel"),
1265+ FALSE,
1266+ PIXBUF_PARAM_FLAGS));
1267+
1268+ /**
1269+ * GdkPixbuf:bits-per-sample:
1270+ *
1271+ * The number of bits per sample.
1272+ * Currently only 8 bit per sample are supported.
1273+ */
1274+ g_object_class_install_property (object_class,
1275+ PROP_BITS_PER_SAMPLE,
1276+ g_param_spec_int ("bits-per-sample",
1277+ P_("Bits per Sample"),
1278+ P_("The number of bits per sample"),
1279+ 1,
1280+ 16,
1281+ 8,
1282+ PIXBUF_PARAM_FLAGS));
1283+
1284+ g_object_class_install_property (object_class,
1285+ PROP_WIDTH,
1286+ g_param_spec_int ("width",
1287+ P_("Width"),
1288+ P_("The number of columns of the pixbuf"),
1289+ 1,
1290+ G_MAXINT,
1291+ 1,
1292+ PIXBUF_PARAM_FLAGS));
1293+
1294+ g_object_class_install_property (object_class,
1295+ PROP_HEIGHT,
1296+ g_param_spec_int ("height",
1297+ P_("Height"),
1298+ P_("The number of rows of the pixbuf"),
1299+ 1,
1300+ G_MAXINT,
1301+ 1,
1302+ PIXBUF_PARAM_FLAGS));
1303+
1304+ /**
1305+ * GdkPixbuf:rowstride:
1306+ *
1307+ * The number of bytes between the start of a row and
1308+ * the start of the next row. This number must (obviously)
1309+ * be at least as large as the width of the pixbuf.
1310+ */
1311+ g_object_class_install_property (object_class,
1312+ PROP_ROWSTRIDE,
1313+ g_param_spec_int ("rowstride",
1314+ P_("Rowstride"),
1315+ P_("The number of bytes between the start of a row and the start of the next row"),
1316+ 1,
1317+ G_MAXINT,
1318+ 1,
1319+ PIXBUF_PARAM_FLAGS));
1320+
1321+ g_object_class_install_property (object_class,
1322+ PROP_PIXELS,
1323+ g_param_spec_pointer ("pixels",
1324+ P_("Pixels"),
1325+ P_("A pointer to the pixel data of the pixbuf"),
1326+ PIXBUF_PARAM_FLAGS));
1327+}
1328+
1329+static void
1330+gdk_pixbuf_finalize (GObject *object)
1331+{
1332+ GdkPixbuf *pixbuf = GDK_PIXBUF (object);
1333+
1334+ if (pixbuf->destroy_fn)
1335+ (* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
1336+
1337+ G_OBJECT_CLASS (gdk_pixbuf_parent_class)->finalize (object);
1338+}
1339+
1340+
1341+/**
1342+ * gdk_pixbuf_ref: (skip)
1343+ * @pixbuf: A pixbuf.
1344+ *
1345+ * Adds a reference to a pixbuf.
1346+ *
1347+ * Return value: The same as the @pixbuf argument.
1348+ *
1349+ * Deprecated: 2.0: Use g_object_ref().
1350+ **/
1351+GdkPixbuf *
1352+gdk_pixbuf_ref (GdkPixbuf *pixbuf)
1353+{
1354+ return (GdkPixbuf *) g_object_ref (pixbuf);
1355+}
1356+
1357+/**
1358+ * gdk_pixbuf_unref: (skip)
1359+ * @pixbuf: A pixbuf.
1360+ *
1361+ * Removes a reference from a pixbuf.
1362+ *
1363+ * Deprecated: 2.0: Use g_object_unref().
1364+ **/
1365+void
1366+gdk_pixbuf_unref (GdkPixbuf *pixbuf)
1367+{
1368+ g_object_unref (pixbuf);
1369+}
1370+
1371+static void
1372+gdk_pixbuf_icon_iface_init (GIconIface *iface)
1373+{
1374+ iface->hash = (guint (*) (GIcon *)) g_direct_hash;
1375+ iface->equal = (gboolean (*) (GIcon *, GIcon *)) g_direct_equal;
1376+}
1377+
1378+/* Used as the destroy notification function for gdk_pixbuf_new() */
1379+static void
1380+free_buffer (guchar *pixels, gpointer data)
1381+{
1382+ g_free (pixels);
1383+}
1384+
1385+/**
1386+ * gdk_pixbuf_new:
1387+ * @colorspace: Color space for image
1388+ * @has_alpha: Whether the image should have transparency information
1389+ * @bits_per_sample: Number of bits per color sample
1390+ * @width: Width of image in pixels, must be > 0
1391+ * @height: Height of image in pixels, must be > 0
1392+ *
1393+ * Creates a new #GdkPixbuf structure and allocates a buffer for it. The
1394+ * buffer has an optimal rowstride. Note that the buffer is not cleared;
1395+ * you will have to fill it completely yourself.
1396+ *
1397+ * Return value: A newly-created #GdkPixbuf with a reference count of 1, or
1398+ * %NULL if not enough memory could be allocated for the image buffer.
1399+ **/
1400+GdkPixbuf *
1401+gdk_pixbuf_new (GdkColorspace colorspace,
1402+ gboolean has_alpha,
1403+ int bits_per_sample,
1404+ int width,
1405+ int height)
1406+{
1407+ guchar *buf;
1408+ int channels;
1409+ int rowstride;
1410+ gsize bytes;
1411+
1412+ g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
1413+ g_return_val_if_fail (bits_per_sample == 8, NULL);
1414+ g_return_val_if_fail (width > 0, NULL);
1415+ g_return_val_if_fail (height > 0, NULL);
1416+
1417+ channels = has_alpha ? 4 : 3;
1418+ rowstride = width * channels;
1419+ if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */
1420+ return NULL;
1421+
1422+ /* Always align rows to 32-bit boundaries */
1423+ rowstride = (rowstride + 3) & ~3;
1424+
1425+ bytes = height * rowstride;
1426+ if (bytes / rowstride != height) /* overflow */
1427+ return NULL;
1428+
1429+ buf = g_try_malloc (bytes);
1430+ if (!buf)
1431+ return NULL;
1432+
1433+ return gdk_pixbuf_new_from_data (buf, colorspace, has_alpha, bits_per_sample,
1434+ width, height, rowstride,
1435+ free_buffer, NULL);
1436+}
1437+
1438+/**
1439+ * gdk_pixbuf_copy:
1440+ * @pixbuf: A pixbuf.
1441+ *
1442+ * Creates a new #GdkPixbuf with a copy of the information in the specified
1443+ * @pixbuf.
1444+ *
1445+ * Return value: (transfer full): A newly-created pixbuf with a reference count of 1, or %NULL if
1446+ * not enough memory could be allocated.
1447+ **/
1448+GdkPixbuf *
1449+gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
1450+{
1451+ guchar *buf;
1452+ int size;
1453+
1454+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
1455+
1456+ /* Calculate a semi-exact size. Here we copy with full rowstrides;
1457+ * maybe we should copy each row individually with the minimum
1458+ * rowstride?
1459+ */
1460+
1461+ size = gdk_pixbuf_get_byte_length (pixbuf);
1462+
1463+ buf = g_try_malloc (size * sizeof (guchar));
1464+ if (!buf)
1465+ return NULL;
1466+
1467+ memcpy (buf, pixbuf->pixels, size);
1468+
1469+ return gdk_pixbuf_new_from_data (buf,
1470+ pixbuf->colorspace, pixbuf->has_alpha,
1471+ pixbuf->bits_per_sample,
1472+ pixbuf->width, pixbuf->height,
1473+ pixbuf->rowstride,
1474+ free_buffer,
1475+ NULL);
1476+}
1477+
1478+/**
1479+ * gdk_pixbuf_new_subpixbuf:
1480+ * @src_pixbuf: a #GdkPixbuf
1481+ * @src_x: X coord in @src_pixbuf
1482+ * @src_y: Y coord in @src_pixbuf
1483+ * @width: width of region in @src_pixbuf
1484+ * @height: height of region in @src_pixbuf
1485+ *
1486+ * Creates a new pixbuf which represents a sub-region of
1487+ * @src_pixbuf. The new pixbuf shares its pixels with the
1488+ * original pixbuf, so writing to one affects both.
1489+ * The new pixbuf holds a reference to @src_pixbuf, so
1490+ * @src_pixbuf will not be finalized until the new pixbuf
1491+ * is finalized.
1492+ *
1493+ * Return value: (transfer full): a new pixbuf
1494+ **/
1495+GdkPixbuf*
1496+gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
1497+ int src_x,
1498+ int src_y,
1499+ int width,
1500+ int height)
1501+{
1502+ guchar *pixels;
1503+ GdkPixbuf *sub;
1504+
1505+ g_return_val_if_fail (GDK_IS_PIXBUF (src_pixbuf), NULL);
1506+ g_return_val_if_fail (src_x >= 0 && src_x + width <= src_pixbuf->width, NULL);
1507+ g_return_val_if_fail (src_y >= 0 && src_y + height <= src_pixbuf->height, NULL);
1508+
1509+ pixels = (gdk_pixbuf_get_pixels (src_pixbuf)
1510+ + src_y * src_pixbuf->rowstride
1511+ + src_x * src_pixbuf->n_channels);
1512+
1513+ sub = gdk_pixbuf_new_from_data (pixels,
1514+ src_pixbuf->colorspace,
1515+ src_pixbuf->has_alpha,
1516+ src_pixbuf->bits_per_sample,
1517+ width, height,
1518+ src_pixbuf->rowstride,
1519+ NULL, NULL);
1520+
1521+ /* Keep a reference to src_pixbuf */
1522+ g_object_ref (src_pixbuf);
1523+
1524+ g_object_set_qdata_full (G_OBJECT (sub),
1525+ g_quark_from_static_string ("gdk-pixbuf-subpixbuf-src"),
1526+ src_pixbuf,
1527+ (GDestroyNotify) g_object_unref);
1528+
1529+ return sub;
1530+}
1531+
1532+
1533
1534+
1535+/* Accessors */
1536+
1537+/**
1538+ * gdk_pixbuf_get_colorspace:
1539+ * @pixbuf: A pixbuf.
1540+ *
1541+ * Queries the color space of a pixbuf.
1542+ *
1543+ * Return value: Color space.
1544+ **/
1545+GdkColorspace
1546+gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf)
1547+{
1548+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), GDK_COLORSPACE_RGB);
1549+
1550+ return pixbuf->colorspace;
1551+}
1552+
1553+/**
1554+ * gdk_pixbuf_get_n_channels:
1555+ * @pixbuf: A pixbuf.
1556+ *
1557+ * Queries the number of channels of a pixbuf.
1558+ *
1559+ * Return value: Number of channels.
1560+ **/
1561+int
1562+gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf)
1563+{
1564+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
1565+
1566+ return pixbuf->n_channels;
1567+}
1568+
1569+/**
1570+ * gdk_pixbuf_get_has_alpha:
1571+ * @pixbuf: A pixbuf.
1572+ *
1573+ * Queries whether a pixbuf has an alpha channel (opacity information).
1574+ *
1575+ * Return value: %TRUE if it has an alpha channel, %FALSE otherwise.
1576+ **/
1577+gboolean
1578+gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf)
1579+{
1580+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE);
1581+
1582+ return pixbuf->has_alpha ? TRUE : FALSE;
1583+}
1584+
1585+/**
1586+ * gdk_pixbuf_get_bits_per_sample:
1587+ * @pixbuf: A pixbuf.
1588+ *
1589+ * Queries the number of bits per color sample in a pixbuf.
1590+ *
1591+ * Return value: Number of bits per color sample.
1592+ **/
1593+int
1594+gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf)
1595+{
1596+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
1597+
1598+ return pixbuf->bits_per_sample;
1599+}
1600+
1601+/**
1602+ * gdk_pixbuf_get_pixels:
1603+ * @pixbuf: A pixbuf.
1604+ *
1605+ * Queries a pointer to the pixel data of a pixbuf.
1606+ *
1607+ * Return value: (array): A pointer to the pixbuf's pixel data.
1608+ * Please see <xref linkend="image-data"/> for information about how
1609+ * the pixel data is stored in memory.
1610+ **/
1611+guchar *
1612+gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf)
1613+{
1614+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
1615+
1616+ return pixbuf->pixels;
1617+}
1618+
1619+/**
1620+ * gdk_pixbuf_get_pixels_with_length:
1621+ * @pixbuf: A pixbuf.
1622+ * @length: (out): The length of the binary data.
1623+ *
1624+ * Queries a pointer to the pixel data of a pixbuf.
1625+ *
1626+ * Return value: (array length=length): A pointer to the pixbuf's
1627+ * pixel data. Please see <xref linkend="image-data"/>
1628+ * for information about how the pixel data is stored in
1629+ * memory.
1630+ *
1631+ * Rename to: gdk_pixbuf_get_pixels
1632+ *
1633+ * Since: 2.26
1634+ */
1635+guchar *
1636+gdk_pixbuf_get_pixels_with_length (const GdkPixbuf *pixbuf,
1637+ guint *length)
1638+{
1639+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
1640+
1641+ if (length)
1642+ *length = gdk_pixbuf_get_byte_length (pixbuf);
1643+
1644+ return pixbuf->pixels;
1645+}
1646+
1647+/**
1648+ * gdk_pixbuf_get_width:
1649+ * @pixbuf: A pixbuf.
1650+ *
1651+ * Queries the width of a pixbuf.
1652+ *
1653+ * Return value: Width in pixels.
1654+ **/
1655+int
1656+gdk_pixbuf_get_width (const GdkPixbuf *pixbuf)
1657+{
1658+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
1659+
1660+ return pixbuf->width;
1661+}
1662+
1663+/**
1664+ * gdk_pixbuf_get_height:
1665+ * @pixbuf: A pixbuf.
1666+ *
1667+ * Queries the height of a pixbuf.
1668+ *
1669+ * Return value: Height in pixels.
1670+ **/
1671+int
1672+gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
1673+{
1674+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
1675+
1676+ return pixbuf->height;
1677+}
1678+
1679+/**
1680+ * gdk_pixbuf_get_rowstride:
1681+ * @pixbuf: A pixbuf.
1682+ *
1683+ * Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row
1684+ * and the start of the next row.
1685+ *
1686+ * Return value: Distance between row starts.
1687+ **/
1688+int
1689+gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
1690+{
1691+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
1692+
1693+ return pixbuf->rowstride;
1694+}
1695+
1696+/**
1697+ * gdk_pixbuf_get_byte_length:
1698+ * @pixbuf: A pixbuf
1699+ *
1700+ * Returns the length of the pixel data, in bytes.
1701+ *
1702+ * Return value: The length of the pixel data.
1703+ *
1704+ * Since: 2.26
1705+ */
1706+gsize
1707+gdk_pixbuf_get_byte_length (const GdkPixbuf *pixbuf)
1708+{
1709+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
1710+
1711+ return ((pixbuf->height - 1) * pixbuf->rowstride +
1712+ pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
1713+}
1714+
1715+
1716
1717+
1718+/* General initialization hooks */
1719+const guint gdk_pixbuf_major_version = GDK_PIXBUF_MAJOR;
1720+const guint gdk_pixbuf_minor_version = GDK_PIXBUF_MINOR;
1721+const guint gdk_pixbuf_micro_version = GDK_PIXBUF_MICRO;
1722+
1723+const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION;
1724+
1725+/* Error quark */
1726+GQuark
1727+gdk_pixbuf_error_quark (void)
1728+{
1729+ return g_quark_from_static_string ("gdk-pixbuf-error-quark");
1730+}
1731+
1732+/**
1733+ * gdk_pixbuf_fill:
1734+ * @pixbuf: a #GdkPixbuf
1735+ * @pixel: RGBA pixel to clear to
1736+ * (0xffffffff is opaque white, 0x00000000 transparent black)
1737+ *
1738+ * Clears a pixbuf to the given RGBA value, converting the RGBA value into
1739+ * the pixbuf's pixel format. The alpha will be ignored if the pixbuf
1740+ * doesn't have an alpha channel.
1741+ *
1742+ **/
1743+void
1744+gdk_pixbuf_fill (GdkPixbuf *pixbuf,
1745+ guint32 pixel)
1746+{
1747+ guchar *pixels;
1748+ guint r, g, b, a;
1749+ guchar *p;
1750+ guint w, h;
1751+
1752+ g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
1753+
1754+ if (pixbuf->width == 0 || pixbuf->height == 0)
1755+ return;
1756+
1757+ pixels = pixbuf->pixels;
1758+
1759+ r = (pixel & 0xff000000) >> 24;
1760+ g = (pixel & 0x00ff0000) >> 16;
1761+ b = (pixel & 0x0000ff00) >> 8;
1762+ a = (pixel & 0x000000ff);
1763+
1764+ h = pixbuf->height;
1765+
1766+ while (h--) {
1767+ w = pixbuf->width;
1768+ p = pixels;
1769+
1770+ switch (pixbuf->n_channels) {
1771+ case 3:
1772+ while (w--) {
1773+ p[0] = r;
1774+ p[1] = g;
1775+ p[2] = b;
1776+ p += 3;
1777+ }
1778+ break;
1779+ case 4:
1780+ while (w--) {
1781+ p[0] = r;
1782+ p[1] = g;
1783+ p[2] = b;
1784+ p[3] = a;
1785+ p += 4;
1786+ }
1787+ break;
1788+ default:
1789+ break;
1790+ }
1791+
1792+ pixels += pixbuf->rowstride;
1793+ }
1794+}
1795+
1796+
1797
1798+
1799+/**
1800+ * gdk_pixbuf_get_option:
1801+ * @pixbuf: a #GdkPixbuf
1802+ * @key: a nul-terminated string.
1803+ *
1804+ * Looks up @key in the list of options that may have been attached to the
1805+ * @pixbuf when it was loaded, or that may have been attached by another
1806+ * function using gdk_pixbuf_set_option().
1807+ *
1808+ * For instance, the ANI loader provides "Title" and "Artist" options.
1809+ * The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
1810+ * options for cursor definitions. The PNG loader provides the tEXt ancillary
1811+ * chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
1812+ * return an "orientation" option string that corresponds to the embedded
1813+ * TIFF/Exif orientation tag (if present).
1814+ *
1815+ * Return value: the value associated with @key. This is a nul-terminated
1816+ * string that should not be freed or %NULL if @key was not found.
1817+ **/
1818+const gchar *
1819+gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
1820+ const gchar *key)
1821+{
1822+ gchar **options;
1823+ gint i;
1824+
1825+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
1826+ g_return_val_if_fail (key != NULL, NULL);
1827+
1828+ options = g_object_get_qdata (G_OBJECT (pixbuf),
1829+ g_quark_from_static_string ("gdk_pixbuf_options"));
1830+ if (options) {
1831+ for (i = 0; options[2*i]; i++) {
1832+ if (strcmp (options[2*i], key) == 0)
1833+ return options[2*i+1];
1834+ }
1835+ }
1836+
1837+ return NULL;
1838+}
1839+
1840+/**
1841+ * gdk_pixbuf_set_option:
1842+ * @pixbuf: a #GdkPixbuf
1843+ * @key: a nul-terminated string.
1844+ * @value: a nul-terminated string.
1845+ *
1846+ * Attaches a key/value pair as an option to a #GdkPixbuf. If @key already
1847+ * exists in the list of options attached to @pixbuf, the new value is
1848+ * ignored and %FALSE is returned.
1849+ *
1850+ * Return value: %TRUE on success.
1851+ *
1852+ * Since: 2.2
1853+ **/
1854+gboolean
1855+gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
1856+ const gchar *key,
1857+ const gchar *value)
1858+{
1859+ GQuark quark;
1860+ gchar **options;
1861+ gint n = 0;
1862+
1863+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE);
1864+ g_return_val_if_fail (key != NULL, FALSE);
1865+ g_return_val_if_fail (value != NULL, FALSE);
1866+
1867+ quark = g_quark_from_static_string ("gdk_pixbuf_options");
1868+
1869+ options = g_object_get_qdata (G_OBJECT (pixbuf), quark);
1870+
1871+ if (options) {
1872+ for (n = 0; options[2*n]; n++) {
1873+ if (strcmp (options[2*n], key) == 0)
1874+ return FALSE;
1875+ }
1876+
1877+ g_object_steal_qdata (G_OBJECT (pixbuf), quark);
1878+ options = g_renew (gchar *, options, 2*(n+1) + 1);
1879+ } else {
1880+ options = g_new (gchar *, 3);
1881+ }
1882+
1883+ options[2*n] = g_strdup (key);
1884+ options[2*n+1] = g_strdup (value);
1885+ options[2*n+2] = NULL;
1886+
1887+ g_object_set_qdata_full (G_OBJECT (pixbuf), quark,
1888+ options, (GDestroyNotify) g_strfreev);
1889+
1890+ return TRUE;
1891+}
1892+
1893+static void
1894+gdk_pixbuf_set_property (GObject *object,
1895+ guint prop_id,
1896+ const GValue *value,
1897+ GParamSpec *pspec)
1898+{
1899+ GdkPixbuf *pixbuf = GDK_PIXBUF (object);
1900+
1901+ switch (prop_id)
1902+ {
1903+ case PROP_COLORSPACE:
1904+ pixbuf->colorspace = g_value_get_enum (value);
1905+ break;
1906+ case PROP_N_CHANNELS:
1907+ pixbuf->n_channels = g_value_get_int (value);
1908+ break;
1909+ case PROP_HAS_ALPHA:
1910+ pixbuf->has_alpha = g_value_get_boolean (value);
1911+ break;
1912+ case PROP_BITS_PER_SAMPLE:
1913+ pixbuf->bits_per_sample = g_value_get_int (value);
1914+ break;
1915+ case PROP_WIDTH:
1916+ pixbuf->width = g_value_get_int (value);
1917+ break;
1918+ case PROP_HEIGHT:
1919+ pixbuf->height = g_value_get_int (value);
1920+ break;
1921+ case PROP_ROWSTRIDE:
1922+ pixbuf->rowstride = g_value_get_int (value);
1923+ break;
1924+ case PROP_PIXELS:
1925+ pixbuf->pixels = (guchar *) g_value_get_pointer (value);
1926+ break;
1927+ default:
1928+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1929+ break;
1930+ }
1931+}
1932+
1933+static void
1934+gdk_pixbuf_get_property (GObject *object,
1935+ guint prop_id,
1936+ GValue *value,
1937+ GParamSpec *pspec)
1938+{
1939+ GdkPixbuf *pixbuf = GDK_PIXBUF (object);
1940+
1941+ switch (prop_id)
1942+ {
1943+ case PROP_COLORSPACE:
1944+ g_value_set_enum (value, gdk_pixbuf_get_colorspace (pixbuf));
1945+ break;
1946+ case PROP_N_CHANNELS:
1947+ g_value_set_int (value, gdk_pixbuf_get_n_channels (pixbuf));
1948+ break;
1949+ case PROP_HAS_ALPHA:
1950+ g_value_set_boolean (value, gdk_pixbuf_get_has_alpha (pixbuf));
1951+ break;
1952+ case PROP_BITS_PER_SAMPLE:
1953+ g_value_set_int (value, gdk_pixbuf_get_bits_per_sample (pixbuf));
1954+ break;
1955+ case PROP_WIDTH:
1956+ g_value_set_int (value, gdk_pixbuf_get_width (pixbuf));
1957+ break;
1958+ case PROP_HEIGHT:
1959+ g_value_set_int (value, gdk_pixbuf_get_height (pixbuf));
1960+ break;
1961+ case PROP_ROWSTRIDE:
1962+ g_value_set_int (value, gdk_pixbuf_get_rowstride (pixbuf));
1963+ break;
1964+ case PROP_PIXELS:
1965+ g_value_set_pointer (value, gdk_pixbuf_get_pixels (pixbuf));
1966+ break;
1967+ default:
1968+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
1969+ break;
1970+ }
1971+}
1972
1973=== added directory '.pc/gicon-serialization-support.patch/tests'
1974=== added file '.pc/gicon-serialization-support.patch/tests/Makefile.am'
1975--- .pc/gicon-serialization-support.patch/tests/Makefile.am 1970-01-01 00:00:00 +0000
1976+++ .pc/gicon-serialization-support.patch/tests/Makefile.am 2013-05-17 06:11:25 +0000
1977@@ -0,0 +1,30 @@
1978+include $(top_srcdir)/Makefile.decl
1979+
1980+INCLUDES = \
1981+ -I$(top_srcdir) \
1982+ -I$(top_srcdir)/gdk-pixbuf \
1983+ $(GDK_PIXBUF_DEBUG_FLAGS) \
1984+ $(GDK_PIXBUF_DEP_CFLAGS)
1985+
1986+DEPS = \
1987+ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la
1988+
1989+LDADDS = \
1990+ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la \
1991+ $(GDK_PIXBUF_DEP_LIBS)
1992+
1993+noinst_PROGRAMS = \
1994+ pixbuf-read \
1995+ pixbuf-lowmem \
1996+ pixbuf-randomly-modified \
1997+ pixbuf-random \
1998+ pixbuf-threads
1999+
2000+pixbuf_read_LDADD = $(LDADDS)
2001+pixbuf_lowmem_LDADD = $(LDADDS)
2002+pixbuf_randomly_modified_LDADD = $(LDADDS)
2003+pixbuf_random_LDADD = $(LDADDS)
2004+pixbuf_threads_LDADD = $(LDADDS) $(GLIB_LIBS)
2005+
2006+
2007+-include $(top_srcdir)/git.mk
2008
2009=== added file '.pc/gicon-serialization-support.patch/tests/pixbuf-icon-serialize.c'
2010=== modified file 'configure.ac'
2011--- configure.ac 2013-05-13 19:52:09 +0000
2012+++ configure.ac 2013-05-17 06:11:25 +0000
2013@@ -26,7 +26,7 @@
2014
2015
2016 # required versions of other packages
2017-m4_define([glib_required_version], [2.34.0])
2018+m4_define([glib_required_version], [2.37.0])
2019
2020 AC_INIT([gdk-pixbuf], [gdk_pixbuf_version],
2021 [http://bugzilla.gnome.org/enter_bug.cgi?product=gdk-pixbuf],
2022
2023=== modified file 'debian/changelog'
2024--- debian/changelog 2013-05-13 19:52:09 +0000
2025+++ debian/changelog 2013-05-17 06:11:25 +0000
2026@@ -1,3 +1,10 @@
2027+gdk-pixbuf (2.28.1-1ubuntu2) UNRELEASED; urgency=low
2028+
2029+ * debian/patches/gicon-serialization-support.patch:
2030+ - Add upstream's GdkPixbuf serialization support.
2031+
2032+ -- William Hua <william.hua@canonical.com> Fri, 17 May 2013 00:11:11 -0400
2033+
2034 gdk-pixbuf (2.28.1-1ubuntu1) saucy; urgency=low
2035
2036 * Resynchronize on Debian, remaining changes:
2037
2038=== modified file 'debian/control'
2039--- debian/control 2013-05-13 19:52:09 +0000
2040+++ debian/control 2013-05-17 06:11:25 +0000
2041@@ -12,7 +12,7 @@
2042 debhelper (>= 9),
2043 autotools-dev,
2044 gnome-pkg-tools (>= 0.10),
2045- libglib2.0-dev (>= 2.34.0),
2046+ libglib2.0-dev (>= 2.37.0),
2047 libx11-dev,
2048 libpng-dev | libpng12-dev,
2049 libjpeg-dev,
2050@@ -81,7 +81,7 @@
2051 ${shlibs:Depends},
2052 libgdk-pixbuf2.0-0 (= ${binary:Version}),
2053 gir1.2-gdkpixbuf-2.0 (= ${binary:Version}),
2054- libglib2.0-dev (>= 2.34.0),
2055+ libglib2.0-dev (>= 2.37.0),
2056 libx11-dev,
2057 libpng12-dev
2058 Breaks: libgtk2.0-dev (<< 2.21.3),
2059
2060=== modified file 'debian/control.in'
2061--- debian/control.in 2013-05-13 19:52:09 +0000
2062+++ debian/control.in 2013-05-17 06:11:25 +0000
2063@@ -8,7 +8,7 @@
2064 debhelper (>= 9),
2065 autotools-dev,
2066 gnome-pkg-tools (>= 0.10),
2067- libglib2.0-dev (>= 2.34.0),
2068+ libglib2.0-dev (>= 2.37.0),
2069 libx11-dev,
2070 libpng-dev | libpng12-dev,
2071 libjpeg-dev,
2072@@ -77,7 +77,7 @@
2073 ${shlibs:Depends},
2074 libgdk-pixbuf2.0-0 (= ${binary:Version}),
2075 gir1.2-gdkpixbuf-2.0 (= ${binary:Version}),
2076- libglib2.0-dev (>= 2.34.0),
2077+ libglib2.0-dev (>= 2.37.0),
2078 libx11-dev,
2079 libpng12-dev
2080 Breaks: libgtk2.0-dev (<< 2.21.3),
2081
2082=== added file 'debian/patches/gicon-serialization-support.patch'
2083--- debian/patches/gicon-serialization-support.patch 1970-01-01 00:00:00 +0000
2084+++ debian/patches/gicon-serialization-support.patch 2013-05-17 06:11:25 +0000
2085@@ -0,0 +1,229 @@
2086+--- a/configure.ac
2087++++ b/configure.ac
2088+@@ -26,7 +26,7 @@
2089+
2090+
2091+ # required versions of other packages
2092+-m4_define([glib_required_version], [2.34.0])
2093++m4_define([glib_required_version], [2.37.0])
2094+
2095+ AC_INIT([gdk-pixbuf], [gdk_pixbuf_version],
2096+ [http://bugzilla.gnome.org/enter_bug.cgi?product=gdk-pixbuf],
2097+--- a/gdk-pixbuf/gdk-pixbuf.c
2098++++ b/gdk-pixbuf/gdk-pixbuf.c
2099+@@ -135,10 +135,11 @@
2100+ };
2101+
2102+ static void gdk_pixbuf_icon_iface_init (GIconIface *iface);
2103++static void gdk_pixbuf_loadable_icon_iface_init (GLoadableIconIface *iface);
2104+
2105+ G_DEFINE_TYPE_WITH_CODE (GdkPixbuf, gdk_pixbuf, G_TYPE_OBJECT,
2106+- G_IMPLEMENT_INTERFACE (G_TYPE_ICON,
2107+- gdk_pixbuf_icon_iface_init))
2108++ G_IMPLEMENT_INTERFACE (G_TYPE_ICON, gdk_pixbuf_icon_iface_init)
2109++ G_IMPLEMENT_INTERFACE (G_TYPE_LOADABLE_ICON, gdk_pixbuf_loadable_icon_iface_init))
2110+
2111+ static void
2112+ gdk_pixbuf_init (GdkPixbuf *pixbuf)
2113+@@ -292,11 +293,110 @@
2114+ g_object_unref (pixbuf);
2115+ }
2116+
2117++static GBytes *
2118++gdk_pixbuf_make_bytes (GdkPixbuf *pixbuf,
2119++ GError **error)
2120++{
2121++ gchar *buffer;
2122++ gsize size;
2123++
2124++ if (!gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &size, "png", error, NULL))
2125++ return NULL;
2126++
2127++ return g_bytes_new_take (buffer, size);
2128++}
2129++
2130++static GVariant *
2131++gdk_pixbuf_serialize (GIcon *icon)
2132++{
2133++ GError *error = NULL;
2134++ GVariant *result;
2135++ GBytes *bytes;
2136++
2137++ bytes = gdk_pixbuf_make_bytes (GDK_PIXBUF (icon), &error);
2138++ if (!bytes)
2139++ {
2140++ g_critical ("Unable to serialise GdkPixbuf to png (via g_icon_serialize()): %s", error->message);
2141++ g_error_free (error);
2142++ return NULL;
2143++ }
2144++ result = g_variant_new_from_bytes (G_VARIANT_TYPE_BYTESTRING, bytes, TRUE);
2145++ g_bytes_unref (bytes);
2146++
2147++ return g_variant_new ("(sv)", "bytes", result);
2148++}
2149++
2150++static GInputStream *
2151++gdk_pixbuf_load (GLoadableIcon *icon,
2152++ int size,
2153++ char **type,
2154++ GCancellable *cancellable,
2155++ GError **error)
2156++{
2157++ GInputStream *stream;
2158++ GBytes *bytes;
2159++
2160++ bytes = gdk_pixbuf_make_bytes (GDK_PIXBUF (icon), error);
2161++ if (!bytes)
2162++ return NULL;
2163++
2164++ stream = g_memory_input_stream_new_from_bytes (bytes);
2165++ g_bytes_unref (bytes);
2166++
2167++ if (type)
2168++ *type = g_strdup ("image/png");
2169++
2170++ return stream;
2171++}
2172++
2173++static void
2174++gdk_pixbuf_load_async (GLoadableIcon *icon,
2175++ int size,
2176++ GCancellable *cancellable,
2177++ GAsyncReadyCallback callback,
2178++ gpointer user_data)
2179++{
2180++ GTask *task;
2181++
2182++ task = g_task_new (icon, cancellable, callback, user_data);
2183++ g_task_return_pointer (task, icon, NULL);
2184++ g_object_unref (task);
2185++}
2186++
2187++static GInputStream *
2188++gdk_pixbuf_load_finish (GLoadableIcon *icon,
2189++ GAsyncResult *res,
2190++ char **type,
2191++ GError **error)
2192++{
2193++ g_return_val_if_fail (g_task_is_valid (res, icon), NULL);
2194++
2195++ if (!g_task_propagate_pointer (G_TASK (res), error))
2196++ return NULL;
2197++
2198++ return gdk_pixbuf_load (icon, 0, type, NULL, error);
2199++}
2200++
2201++static void
2202++gdk_pixbuf_loadable_icon_iface_init (GLoadableIconIface *iface)
2203++{
2204++ iface->load = gdk_pixbuf_load;
2205++
2206++ /* In theory encoding a png could be time-consuming but we're talking
2207++ * about icons here, so assume it's probably going to be OK and handle
2208++ * the async variant of the call in-thread instead of having the
2209++ * default implementation dispatch it to a worker.
2210++ */
2211++ iface->load_async = gdk_pixbuf_load_async;
2212++ iface->load_finish = gdk_pixbuf_load_finish;
2213++}
2214++
2215+ static void
2216+ gdk_pixbuf_icon_iface_init (GIconIface *iface)
2217+ {
2218+ iface->hash = (guint (*) (GIcon *)) g_direct_hash;
2219+ iface->equal = (gboolean (*) (GIcon *, GIcon *)) g_direct_equal;
2220++ iface->serialize = gdk_pixbuf_serialize;
2221+ }
2222+
2223+ /* Used as the destroy notification function for gdk_pixbuf_new() */
2224+--- a/tests/Makefile.am
2225++++ b/tests/Makefile.am
2226+@@ -6,6 +6,8 @@
2227+ $(GDK_PIXBUF_DEBUG_FLAGS) \
2228+ $(GDK_PIXBUF_DEP_CFLAGS)
2229+
2230++AM_CFLAGS = '-DABS_SRCDIR="$(abs_srcdir)"'
2231++
2232+ DEPS = \
2233+ $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la
2234+
2235+@@ -18,13 +20,15 @@
2236+ pixbuf-lowmem \
2237+ pixbuf-randomly-modified \
2238+ pixbuf-random \
2239+- pixbuf-threads
2240++ pixbuf-threads \
2241++ pixbuf-icon-serialize
2242+
2243+ pixbuf_read_LDADD = $(LDADDS)
2244+ pixbuf_lowmem_LDADD = $(LDADDS)
2245+ pixbuf_randomly_modified_LDADD = $(LDADDS)
2246+ pixbuf_random_LDADD = $(LDADDS)
2247+ pixbuf_threads_LDADD = $(LDADDS) $(GLIB_LIBS)
2248++pixbuf_icon_serialize_LDADD = $(LDADDS) $(GLIB_LIBS)
2249+
2250+
2251+ -include $(top_srcdir)/git.mk
2252+--- /dev/null
2253++++ b/tests/pixbuf-icon-serialize.c
2254+@@ -0,0 +1,60 @@
2255++#include "config.h"
2256++#include "gdk-pixbuf/gdk-pixbuf.h"
2257++#include <string.h>
2258++#include <glib.h>
2259++
2260++static void
2261++test_serialize (void)
2262++{
2263++ GError *error = NULL;
2264++ GdkPixbuf *pixbuf;
2265++ GdkPixbuf *pixbuf2;
2266++ GVariant *data;
2267++ GIcon *icon;
2268++ GInputStream *stream;
2269++
2270++ pixbuf = gdk_pixbuf_new_from_file (ABS_SRCDIR "/test-image.png", &error);
2271++ g_assert_no_error (error);
2272++ g_assert (pixbuf != NULL);
2273++
2274++ /* turn it into a GVariant */
2275++ data = g_icon_serialize (G_ICON (pixbuf));
2276++
2277++ /* back to a GIcon, but this will be a GBytesIcon, not GdkPixbuf */
2278++ icon = g_icon_deserialize (data);
2279++ g_assert (G_IS_BYTES_ICON (icon));
2280++
2281++ /* but since that is a GLoadableIcon, we can load it again */
2282++ stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), 0, NULL, NULL, &error);
2283++ g_assert_no_error (error);
2284++ pixbuf2 = gdk_pixbuf_new_from_stream (stream, NULL, &error);
2285++ g_assert_no_error (error);
2286++
2287++ /* make sure that the pixels are the same.
2288++ * our _serialize() uses png, so this should be perfect.
2289++ */
2290++ {
2291++ guchar *pixels_a, *pixels_b;
2292++ guint len_a, len_b;
2293++ pixels_a = gdk_pixbuf_get_pixels_with_length (pixbuf, &len_a);
2294++ pixels_b = gdk_pixbuf_get_pixels_with_length (pixbuf2, &len_b);
2295++ g_assert (len_a == len_b);
2296++ g_assert (memcmp (pixels_a, pixels_b, len_a) == 0);
2297++ }
2298++
2299++ g_object_unref (pixbuf2);
2300++ g_object_unref (pixbuf);
2301++ g_object_unref (stream);
2302++ g_variant_unref (data);
2303++
2304++}
2305++
2306++int
2307++main (int argc, char **argv)
2308++{
2309++ g_test_init (&argc, &argv, NULL);
2310++
2311++ g_test_add_func ("/pixbuf/icon/serialize", test_serialize);
2312++
2313++ return g_test_run ();
2314++}
2315
2316=== modified file 'debian/patches/series'
2317--- debian/patches/series 2013-05-07 19:03:11 +0000
2318+++ debian/patches/series 2013-05-17 06:11:25 +0000
2319@@ -0,0 +1,1 @@
2320+gicon-serialization-support.patch
2321
2322=== modified file 'gdk-pixbuf/gdk-pixbuf.c'
2323--- gdk-pixbuf/gdk-pixbuf.c 2012-09-18 17:06:38 +0000
2324+++ gdk-pixbuf/gdk-pixbuf.c 2013-05-17 06:11:25 +0000
2325@@ -135,10 +135,11 @@
2326 };
2327
2328 static void gdk_pixbuf_icon_iface_init (GIconIface *iface);
2329+static void gdk_pixbuf_loadable_icon_iface_init (GLoadableIconIface *iface);
2330
2331 G_DEFINE_TYPE_WITH_CODE (GdkPixbuf, gdk_pixbuf, G_TYPE_OBJECT,
2332- G_IMPLEMENT_INTERFACE (G_TYPE_ICON,
2333- gdk_pixbuf_icon_iface_init))
2334+ G_IMPLEMENT_INTERFACE (G_TYPE_ICON, gdk_pixbuf_icon_iface_init)
2335+ G_IMPLEMENT_INTERFACE (G_TYPE_LOADABLE_ICON, gdk_pixbuf_loadable_icon_iface_init))
2336
2337 static void
2338 gdk_pixbuf_init (GdkPixbuf *pixbuf)
2339@@ -292,11 +293,110 @@
2340 g_object_unref (pixbuf);
2341 }
2342
2343+static GBytes *
2344+gdk_pixbuf_make_bytes (GdkPixbuf *pixbuf,
2345+ GError **error)
2346+{
2347+ gchar *buffer;
2348+ gsize size;
2349+
2350+ if (!gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &size, "png", error, NULL))
2351+ return NULL;
2352+
2353+ return g_bytes_new_take (buffer, size);
2354+}
2355+
2356+static GVariant *
2357+gdk_pixbuf_serialize (GIcon *icon)
2358+{
2359+ GError *error = NULL;
2360+ GVariant *result;
2361+ GBytes *bytes;
2362+
2363+ bytes = gdk_pixbuf_make_bytes (GDK_PIXBUF (icon), &error);
2364+ if (!bytes)
2365+ {
2366+ g_critical ("Unable to serialise GdkPixbuf to png (via g_icon_serialize()): %s", error->message);
2367+ g_error_free (error);
2368+ return NULL;
2369+ }
2370+ result = g_variant_new_from_bytes (G_VARIANT_TYPE_BYTESTRING, bytes, TRUE);
2371+ g_bytes_unref (bytes);
2372+
2373+ return g_variant_new ("(sv)", "bytes", result);
2374+}
2375+
2376+static GInputStream *
2377+gdk_pixbuf_load (GLoadableIcon *icon,
2378+ int size,
2379+ char **type,
2380+ GCancellable *cancellable,
2381+ GError **error)
2382+{
2383+ GInputStream *stream;
2384+ GBytes *bytes;
2385+
2386+ bytes = gdk_pixbuf_make_bytes (GDK_PIXBUF (icon), error);
2387+ if (!bytes)
2388+ return NULL;
2389+
2390+ stream = g_memory_input_stream_new_from_bytes (bytes);
2391+ g_bytes_unref (bytes);
2392+
2393+ if (type)
2394+ *type = g_strdup ("image/png");
2395+
2396+ return stream;
2397+}
2398+
2399+static void
2400+gdk_pixbuf_load_async (GLoadableIcon *icon,
2401+ int size,
2402+ GCancellable *cancellable,
2403+ GAsyncReadyCallback callback,
2404+ gpointer user_data)
2405+{
2406+ GTask *task;
2407+
2408+ task = g_task_new (icon, cancellable, callback, user_data);
2409+ g_task_return_pointer (task, icon, NULL);
2410+ g_object_unref (task);
2411+}
2412+
2413+static GInputStream *
2414+gdk_pixbuf_load_finish (GLoadableIcon *icon,
2415+ GAsyncResult *res,
2416+ char **type,
2417+ GError **error)
2418+{
2419+ g_return_val_if_fail (g_task_is_valid (res, icon), NULL);
2420+
2421+ if (!g_task_propagate_pointer (G_TASK (res), error))
2422+ return NULL;
2423+
2424+ return gdk_pixbuf_load (icon, 0, type, NULL, error);
2425+}
2426+
2427+static void
2428+gdk_pixbuf_loadable_icon_iface_init (GLoadableIconIface *iface)
2429+{
2430+ iface->load = gdk_pixbuf_load;
2431+
2432+ /* In theory encoding a png could be time-consuming but we're talking
2433+ * about icons here, so assume it's probably going to be OK and handle
2434+ * the async variant of the call in-thread instead of having the
2435+ * default implementation dispatch it to a worker.
2436+ */
2437+ iface->load_async = gdk_pixbuf_load_async;
2438+ iface->load_finish = gdk_pixbuf_load_finish;
2439+}
2440+
2441 static void
2442 gdk_pixbuf_icon_iface_init (GIconIface *iface)
2443 {
2444 iface->hash = (guint (*) (GIcon *)) g_direct_hash;
2445 iface->equal = (gboolean (*) (GIcon *, GIcon *)) g_direct_equal;
2446+ iface->serialize = gdk_pixbuf_serialize;
2447 }
2448
2449 /* Used as the destroy notification function for gdk_pixbuf_new() */
2450
2451=== modified file 'tests/Makefile.am'
2452--- tests/Makefile.am 2010-07-23 11:26:25 +0000
2453+++ tests/Makefile.am 2013-05-17 06:11:25 +0000
2454@@ -6,6 +6,8 @@
2455 $(GDK_PIXBUF_DEBUG_FLAGS) \
2456 $(GDK_PIXBUF_DEP_CFLAGS)
2457
2458+AM_CFLAGS = '-DABS_SRCDIR="$(abs_srcdir)"'
2459+
2460 DEPS = \
2461 $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GDK_PIXBUF_API_VERSION).la
2462
2463@@ -18,13 +20,15 @@
2464 pixbuf-lowmem \
2465 pixbuf-randomly-modified \
2466 pixbuf-random \
2467- pixbuf-threads
2468+ pixbuf-threads \
2469+ pixbuf-icon-serialize
2470
2471 pixbuf_read_LDADD = $(LDADDS)
2472 pixbuf_lowmem_LDADD = $(LDADDS)
2473 pixbuf_randomly_modified_LDADD = $(LDADDS)
2474 pixbuf_random_LDADD = $(LDADDS)
2475 pixbuf_threads_LDADD = $(LDADDS) $(GLIB_LIBS)
2476+pixbuf_icon_serialize_LDADD = $(LDADDS) $(GLIB_LIBS)
2477
2478
2479 -include $(top_srcdir)/git.mk
2480
2481=== added file 'tests/pixbuf-icon-serialize.c'
2482--- tests/pixbuf-icon-serialize.c 1970-01-01 00:00:00 +0000
2483+++ tests/pixbuf-icon-serialize.c 2013-05-17 06:11:25 +0000
2484@@ -0,0 +1,60 @@
2485+#include "config.h"
2486+#include "gdk-pixbuf/gdk-pixbuf.h"
2487+#include <string.h>
2488+#include <glib.h>
2489+
2490+static void
2491+test_serialize (void)
2492+{
2493+ GError *error = NULL;
2494+ GdkPixbuf *pixbuf;
2495+ GdkPixbuf *pixbuf2;
2496+ GVariant *data;
2497+ GIcon *icon;
2498+ GInputStream *stream;
2499+
2500+ pixbuf = gdk_pixbuf_new_from_file (ABS_SRCDIR "/test-image.png", &error);
2501+ g_assert_no_error (error);
2502+ g_assert (pixbuf != NULL);
2503+
2504+ /* turn it into a GVariant */
2505+ data = g_icon_serialize (G_ICON (pixbuf));
2506+
2507+ /* back to a GIcon, but this will be a GBytesIcon, not GdkPixbuf */
2508+ icon = g_icon_deserialize (data);
2509+ g_assert (G_IS_BYTES_ICON (icon));
2510+
2511+ /* but since that is a GLoadableIcon, we can load it again */
2512+ stream = g_loadable_icon_load (G_LOADABLE_ICON (icon), 0, NULL, NULL, &error);
2513+ g_assert_no_error (error);
2514+ pixbuf2 = gdk_pixbuf_new_from_stream (stream, NULL, &error);
2515+ g_assert_no_error (error);
2516+
2517+ /* make sure that the pixels are the same.
2518+ * our _serialize() uses png, so this should be perfect.
2519+ */
2520+ {
2521+ guchar *pixels_a, *pixels_b;
2522+ guint len_a, len_b;
2523+ pixels_a = gdk_pixbuf_get_pixels_with_length (pixbuf, &len_a);
2524+ pixels_b = gdk_pixbuf_get_pixels_with_length (pixbuf2, &len_b);
2525+ g_assert (len_a == len_b);
2526+ g_assert (memcmp (pixels_a, pixels_b, len_a) == 0);
2527+ }
2528+
2529+ g_object_unref (pixbuf2);
2530+ g_object_unref (pixbuf);
2531+ g_object_unref (stream);
2532+ g_variant_unref (data);
2533+
2534+}
2535+
2536+int
2537+main (int argc, char **argv)
2538+{
2539+ g_test_init (&argc, &argv, NULL);
2540+
2541+ g_test_add_func ("/pixbuf/icon/serialize", test_serialize);
2542+
2543+ return g_test_run ();
2544+}

Subscribers

People subscribed via source and target branches

to all changes: