summaryrefslogtreecommitdiff
path: root/lib/pixman/demos
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2011-07-24 13:05:48 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2011-07-24 13:05:48 +0000
commit33848ac2d5208b6bdd297b636ee61f972982d17b (patch)
tree38a6092e925c775e108e18f3c52ebd20d092239e /lib/pixman/demos
parentd1c54fd892ab7ed02443d2af0b01936b425d7e2c (diff)
Update to pixman 0.22.2.
0.22.0 was tested by many. 0.22.2 only add a few bug fixes. Note that on amd64 a recent ld.so is needed to avoid random bus errors.
Diffstat (limited to 'lib/pixman/demos')
-rw-r--r--lib/pixman/demos/Makefile.am36
-rw-r--r--lib/pixman/demos/Makefile.in643
-rw-r--r--lib/pixman/demos/alpha-test.c117
-rw-r--r--lib/pixman/demos/clip-in.c50
-rw-r--r--lib/pixman/demos/clip-test.c97
-rw-r--r--lib/pixman/demos/composite-test.c191
-rw-r--r--lib/pixman/demos/convolution-test.c47
-rw-r--r--lib/pixman/demos/gradient-test.c89
-rw-r--r--lib/pixman/demos/gtk-utils.c115
-rw-r--r--lib/pixman/demos/gtk-utils.h13
-rw-r--r--lib/pixman/demos/radial-test.c198
-rw-r--r--lib/pixman/demos/screen-test.c44
-rw-r--r--lib/pixman/demos/trap-test.c49
-rw-r--r--lib/pixman/demos/tri-test.c48
14 files changed, 1737 insertions, 0 deletions
diff --git a/lib/pixman/demos/Makefile.am b/lib/pixman/demos/Makefile.am
new file mode 100644
index 000000000..f08303bc4
--- /dev/null
+++ b/lib/pixman/demos/Makefile.am
@@ -0,0 +1,36 @@
+if HAVE_GTK
+
+AM_CFLAGS = @OPENMP_CFLAGS@
+AM_LDFLAGS = @OPENMP_CFLAGS@
+
+LDADD = $(top_builddir)/pixman/libpixman-1.la -lm $(GTK_LIBS)
+INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(GTK_CFLAGS)
+
+GTK_UTILS = gtk-utils.c gtk-utils.h
+
+DEMOS = \
+ clip-test \
+ clip-in \
+ composite-test \
+ gradient-test \
+ radial-test \
+ alpha-test \
+ screen-test \
+ convolution-test \
+ trap-test \
+ tri-test
+
+gradient_test_SOURCES = gradient-test.c $(GTK_UTILS)
+alpha_test_SOURCES = alpha-test.c $(GTK_UTILS)
+composite_test_SOURCES = composite-test.c $(GTK_UTILS)
+clip_test_SOURCES = clip-test.c $(GTK_UTILS)
+clip_in_SOURCES = clip-in.c $(GTK_UTILS)
+trap_test_SOURCES = trap-test.c $(GTK_UTILS)
+screen_test_SOURCES = screen-test.c $(GTK_UTILS)
+convolution_test_SOURCES = convolution-test.c $(GTK_UTILS)
+radial_test_SOURCES = radial-test.c ../test/utils.c ../test/utils.h $(GTK_UTILS)
+tri_test_SOURCES = tri-test.c ../test/utils.c ../test/utils.h $(GTK_UTILS)
+
+noinst_PROGRAMS = $(DEMOS)
+
+endif
diff --git a/lib/pixman/demos/Makefile.in b/lib/pixman/demos/Makefile.in
new file mode 100644
index 000000000..d4f953bc6
--- /dev/null
+++ b/lib/pixman/demos/Makefile.in
@@ -0,0 +1,643 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = ${SHELL} $(install_sh) -c -m 644
+install_sh_PROGRAM = ${SHELL} $(install_sh) -c
+install_sh_SCRIPT = ${SHELL} $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@HAVE_GTK_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1)
+subdir = demos
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+@HAVE_GTK_TRUE@am__EXEEXT_1 = clip-test$(EXEEXT) clip-in$(EXEEXT) \
+@HAVE_GTK_TRUE@ composite-test$(EXEEXT) gradient-test$(EXEEXT) \
+@HAVE_GTK_TRUE@ radial-test$(EXEEXT) alpha-test$(EXEEXT) \
+@HAVE_GTK_TRUE@ screen-test$(EXEEXT) convolution-test$(EXEEXT) \
+@HAVE_GTK_TRUE@ trap-test$(EXEEXT) tri-test$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+am__alpha_test_SOURCES_DIST = alpha-test.c gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am__objects_1 = gtk-utils.$(OBJEXT)
+@HAVE_GTK_TRUE@am_alpha_test_OBJECTS = alpha-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ $(am__objects_1)
+alpha_test_OBJECTS = $(am_alpha_test_OBJECTS)
+alpha_test_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+@HAVE_GTK_TRUE@alpha_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__clip_in_SOURCES_DIST = clip-in.c gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am_clip_in_OBJECTS = clip-in.$(OBJEXT) $(am__objects_1)
+clip_in_OBJECTS = $(am_clip_in_OBJECTS)
+clip_in_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@clip_in_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__clip_test_SOURCES_DIST = clip-test.c gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am_clip_test_OBJECTS = clip-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ $(am__objects_1)
+clip_test_OBJECTS = $(am_clip_test_OBJECTS)
+clip_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@clip_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__composite_test_SOURCES_DIST = composite-test.c gtk-utils.c \
+ gtk-utils.h
+@HAVE_GTK_TRUE@am_composite_test_OBJECTS = composite-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ $(am__objects_1)
+composite_test_OBJECTS = $(am_composite_test_OBJECTS)
+composite_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@composite_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__convolution_test_SOURCES_DIST = convolution-test.c gtk-utils.c \
+ gtk-utils.h
+@HAVE_GTK_TRUE@am_convolution_test_OBJECTS = \
+@HAVE_GTK_TRUE@ convolution-test.$(OBJEXT) $(am__objects_1)
+convolution_test_OBJECTS = $(am_convolution_test_OBJECTS)
+convolution_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@convolution_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__gradient_test_SOURCES_DIST = gradient-test.c gtk-utils.c \
+ gtk-utils.h
+@HAVE_GTK_TRUE@am_gradient_test_OBJECTS = gradient-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ $(am__objects_1)
+gradient_test_OBJECTS = $(am_gradient_test_OBJECTS)
+gradient_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@gradient_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__radial_test_SOURCES_DIST = radial-test.c ../test/utils.c \
+ ../test/utils.h gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am_radial_test_OBJECTS = radial-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ utils.$(OBJEXT) $(am__objects_1)
+radial_test_OBJECTS = $(am_radial_test_OBJECTS)
+radial_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@radial_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__screen_test_SOURCES_DIST = screen-test.c gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am_screen_test_OBJECTS = screen-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ $(am__objects_1)
+screen_test_OBJECTS = $(am_screen_test_OBJECTS)
+screen_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@screen_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__trap_test_SOURCES_DIST = trap-test.c gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am_trap_test_OBJECTS = trap-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ $(am__objects_1)
+trap_test_OBJECTS = $(am_trap_test_OBJECTS)
+trap_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@trap_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+am__tri_test_SOURCES_DIST = tri-test.c ../test/utils.c ../test/utils.h \
+ gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@am_tri_test_OBJECTS = tri-test.$(OBJEXT) \
+@HAVE_GTK_TRUE@ utils.$(OBJEXT) $(am__objects_1)
+tri_test_OBJECTS = $(am_tri_test_OBJECTS)
+tri_test_LDADD = $(LDADD)
+@HAVE_GTK_TRUE@tri_test_DEPENDENCIES = \
+@HAVE_GTK_TRUE@ $(top_builddir)/pixman/libpixman-1.la \
+@HAVE_GTK_TRUE@ $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(alpha_test_SOURCES) $(clip_in_SOURCES) \
+ $(clip_test_SOURCES) $(composite_test_SOURCES) \
+ $(convolution_test_SOURCES) $(gradient_test_SOURCES) \
+ $(radial_test_SOURCES) $(screen_test_SOURCES) \
+ $(trap_test_SOURCES) $(tri_test_SOURCES)
+DIST_SOURCES = $(am__alpha_test_SOURCES_DIST) \
+ $(am__clip_in_SOURCES_DIST) $(am__clip_test_SOURCES_DIST) \
+ $(am__composite_test_SOURCES_DIST) \
+ $(am__convolution_test_SOURCES_DIST) \
+ $(am__gradient_test_SOURCES_DIST) \
+ $(am__radial_test_SOURCES_DIST) \
+ $(am__screen_test_SOURCES_DIST) $(am__trap_test_SOURCES_DIST) \
+ $(am__tri_test_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DEP_CFLAGS = @DEP_CFLAGS@
+DEP_LIBS = @DEP_LIBS@
+DSYMUTIL = @DSYMUTIL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+GREP = @GREP@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
+HAVE_PTHREAD_SETSPECIFIC = @HAVE_PTHREAD_SETSPECIFIC@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LT_VERSION_INFO = @LT_VERSION_INFO@
+MAKEINFO = @MAKEINFO@
+MMX_CFLAGS = @MMX_CFLAGS@
+MMX_LDFLAGS = @MMX_LDFLAGS@
+NMEDIT = @NMEDIT@
+OBJEXT = @OBJEXT@
+OPENMP_CFLAGS = @OPENMP_CFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PIXMAN_TIMERS = @PIXMAN_TIMERS@
+PIXMAN_VERSION_MAJOR = @PIXMAN_VERSION_MAJOR@
+PIXMAN_VERSION_MICRO = @PIXMAN_VERSION_MICRO@
+PIXMAN_VERSION_MINOR = @PIXMAN_VERSION_MINOR@
+PKG_CONFIG = @PKG_CONFIG@
+PTHREAD_LDFLAGS = @PTHREAD_LDFLAGS@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SSE2_CFLAGS = @SSE2_CFLAGS@
+SSE2_LDFLAGS = @SSE2_LDFLAGS@
+STRIP = @STRIP@
+STUBS_CFLAGS = @STUBS_CFLAGS@
+STUBS_LIBS = @STUBS_LIBS@
+TESTPROGS_EXTRA_LDFLAGS = @TESTPROGS_EXTRA_LDFLAGS@
+TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR = @TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR@
+TOOLCHAIN_SUPPORTS__THREAD = @TOOLCHAIN_SUPPORTS__THREAD@
+USE_ARM_NEON_FALSE = @USE_ARM_NEON_FALSE@
+USE_ARM_NEON_TRUE = @USE_ARM_NEON_TRUE@
+USE_ARM_SIMD_FALSE = @USE_ARM_SIMD_FALSE@
+USE_ARM_SIMD_TRUE = @USE_ARM_SIMD_TRUE@
+USE_GCC_INLINE_ASM_FALSE = @USE_GCC_INLINE_ASM_FALSE@
+USE_GCC_INLINE_ASM_TRUE = @USE_GCC_INLINE_ASM_TRUE@
+USE_MMX_FALSE = @USE_MMX_FALSE@
+USE_MMX_TRUE = @USE_MMX_TRUE@
+USE_SSE2_FALSE = @USE_SSE2_FALSE@
+USE_SSE2_TRUE = @USE_SSE2_TRUE@
+USE_VMX_FALSE = @USE_VMX_FALSE@
+USE_VMX_TRUE = @USE_VMX_TRUE@
+VERSION = @VERSION@
+VMX_CFLAGS = @VMX_CFLAGS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+@HAVE_GTK_TRUE@AM_CFLAGS = @OPENMP_CFLAGS@
+@HAVE_GTK_TRUE@AM_LDFLAGS = @OPENMP_CFLAGS@
+@HAVE_GTK_TRUE@LDADD = $(top_builddir)/pixman/libpixman-1.la -lm $(GTK_LIBS)
+@HAVE_GTK_TRUE@INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(GTK_CFLAGS)
+@HAVE_GTK_TRUE@GTK_UTILS = gtk-utils.c gtk-utils.h
+@HAVE_GTK_TRUE@DEMOS = \
+@HAVE_GTK_TRUE@ clip-test \
+@HAVE_GTK_TRUE@ clip-in \
+@HAVE_GTK_TRUE@ composite-test \
+@HAVE_GTK_TRUE@ gradient-test \
+@HAVE_GTK_TRUE@ radial-test \
+@HAVE_GTK_TRUE@ alpha-test \
+@HAVE_GTK_TRUE@ screen-test \
+@HAVE_GTK_TRUE@ convolution-test \
+@HAVE_GTK_TRUE@ trap-test \
+@HAVE_GTK_TRUE@ tri-test
+
+@HAVE_GTK_TRUE@gradient_test_SOURCES = gradient-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@alpha_test_SOURCES = alpha-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@composite_test_SOURCES = composite-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@clip_test_SOURCES = clip-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@clip_in_SOURCES = clip-in.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@trap_test_SOURCES = trap-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@screen_test_SOURCES = screen-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@convolution_test_SOURCES = convolution-test.c $(GTK_UTILS)
+@HAVE_GTK_TRUE@radial_test_SOURCES = radial-test.c ../test/utils.c ../test/utils.h $(GTK_UTILS)
+@HAVE_GTK_TRUE@tri_test_SOURCES = tri-test.c ../test/utils.c ../test/utils.h $(GTK_UTILS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign demos/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign demos/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+alpha-test$(EXEEXT): $(alpha_test_OBJECTS) $(alpha_test_DEPENDENCIES)
+ @rm -f alpha-test$(EXEEXT)
+ $(LINK) $(alpha_test_LDFLAGS) $(alpha_test_OBJECTS) $(alpha_test_LDADD) $(LIBS)
+clip-in$(EXEEXT): $(clip_in_OBJECTS) $(clip_in_DEPENDENCIES)
+ @rm -f clip-in$(EXEEXT)
+ $(LINK) $(clip_in_LDFLAGS) $(clip_in_OBJECTS) $(clip_in_LDADD) $(LIBS)
+clip-test$(EXEEXT): $(clip_test_OBJECTS) $(clip_test_DEPENDENCIES)
+ @rm -f clip-test$(EXEEXT)
+ $(LINK) $(clip_test_LDFLAGS) $(clip_test_OBJECTS) $(clip_test_LDADD) $(LIBS)
+composite-test$(EXEEXT): $(composite_test_OBJECTS) $(composite_test_DEPENDENCIES)
+ @rm -f composite-test$(EXEEXT)
+ $(LINK) $(composite_test_LDFLAGS) $(composite_test_OBJECTS) $(composite_test_LDADD) $(LIBS)
+convolution-test$(EXEEXT): $(convolution_test_OBJECTS) $(convolution_test_DEPENDENCIES)
+ @rm -f convolution-test$(EXEEXT)
+ $(LINK) $(convolution_test_LDFLAGS) $(convolution_test_OBJECTS) $(convolution_test_LDADD) $(LIBS)
+gradient-test$(EXEEXT): $(gradient_test_OBJECTS) $(gradient_test_DEPENDENCIES)
+ @rm -f gradient-test$(EXEEXT)
+ $(LINK) $(gradient_test_LDFLAGS) $(gradient_test_OBJECTS) $(gradient_test_LDADD) $(LIBS)
+radial-test$(EXEEXT): $(radial_test_OBJECTS) $(radial_test_DEPENDENCIES)
+ @rm -f radial-test$(EXEEXT)
+ $(LINK) $(radial_test_LDFLAGS) $(radial_test_OBJECTS) $(radial_test_LDADD) $(LIBS)
+screen-test$(EXEEXT): $(screen_test_OBJECTS) $(screen_test_DEPENDENCIES)
+ @rm -f screen-test$(EXEEXT)
+ $(LINK) $(screen_test_LDFLAGS) $(screen_test_OBJECTS) $(screen_test_LDADD) $(LIBS)
+trap-test$(EXEEXT): $(trap_test_OBJECTS) $(trap_test_DEPENDENCIES)
+ @rm -f trap-test$(EXEEXT)
+ $(LINK) $(trap_test_LDFLAGS) $(trap_test_OBJECTS) $(trap_test_LDADD) $(LIBS)
+tri-test$(EXEEXT): $(tri_test_OBJECTS) $(tri_test_DEPENDENCIES)
+ @rm -f tri-test$(EXEEXT)
+ $(LINK) $(tri_test_LDFLAGS) $(tri_test_OBJECTS) $(tri_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alpha-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-in.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clip-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/composite-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/convolution-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gradient-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gtk-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/radial-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/screen-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trap-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tri-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+utils.o: ../test/utils.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utils.o -MD -MP -MF "$(DEPDIR)/utils.Tpo" -c -o utils.o `test -f '../test/utils.c' || echo '$(srcdir)/'`../test/utils.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/utils.Tpo" "$(DEPDIR)/utils.Po"; else rm -f "$(DEPDIR)/utils.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../test/utils.c' object='utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o utils.o `test -f '../test/utils.c' || echo '$(srcdir)/'`../test/utils.c
+
+utils.obj: ../test/utils.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT utils.obj -MD -MP -MF "$(DEPDIR)/utils.Tpo" -c -o utils.obj `if test -f '../test/utils.c'; then $(CYGPATH_W) '../test/utils.c'; else $(CYGPATH_W) '$(srcdir)/../test/utils.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/utils.Tpo" "$(DEPDIR)/utils.Po"; else rm -f "$(DEPDIR)/utils.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../test/utils.c' object='utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o utils.obj `if test -f '../test/utils.c'; then $(CYGPATH_W) '../test/utils.c'; else $(CYGPATH_W) '$(srcdir)/../test/utils.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/lib/pixman/demos/alpha-test.c b/lib/pixman/demos/alpha-test.c
new file mode 100644
index 000000000..92c208142
--- /dev/null
+++ b/lib/pixman/demos/alpha-test.c
@@ -0,0 +1,117 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 400
+#define HEIGHT 200
+
+ uint32_t *alpha = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *src = malloc (WIDTH * HEIGHT * 4);
+ pixman_image_t *grad_img;
+ pixman_image_t *alpha_img;
+ pixman_image_t *dest_img;
+ pixman_image_t *src_img;
+ int i;
+ pixman_gradient_stop_t stops[2] =
+ {
+ { pixman_int_to_fixed (0), { 0x0000, 0x0000, 0x0000, 0x0000 } },
+ { pixman_int_to_fixed (1), { 0xffff, 0x0000, 0x1111, 0xffff } }
+ };
+ pixman_point_fixed_t p1 = { pixman_double_to_fixed (0), 0 };
+ pixman_point_fixed_t p2 = { pixman_double_to_fixed (WIDTH),
+ pixman_int_to_fixed (0) };
+#if 0
+ pixman_transform_t trans = {
+ { { pixman_double_to_fixed (2), pixman_double_to_fixed (0.5), pixman_double_to_fixed (-100), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (3), pixman_double_to_fixed (0), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) }
+ }
+ };
+#else
+ pixman_transform_t trans = {
+ { { pixman_fixed_1, 0, 0 },
+ { 0, pixman_fixed_1, 0 },
+ { 0, 0, pixman_fixed_1 } }
+ };
+#endif
+
+ pixman_point_fixed_t c_inner;
+ pixman_point_fixed_t c_outer;
+ pixman_fixed_t r_inner;
+ pixman_fixed_t r_outer;
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ alpha[i] = 0x4f00004f; /* pale blue */
+
+ alpha_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ alpha,
+ WIDTH * 4);
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ dest[i] = 0xffffff00; /* yellow */
+
+ dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ dest,
+ WIDTH * 4);
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ src[i] = 0xffff0000;
+
+ src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ src,
+ WIDTH * 4);
+
+ c_inner.x = pixman_double_to_fixed (50.0);
+ c_inner.y = pixman_double_to_fixed (50.0);
+ c_outer.x = pixman_double_to_fixed (50.0);
+ c_outer.y = pixman_double_to_fixed (50.0);
+ r_inner = 0;
+ r_outer = pixman_double_to_fixed (50.0);
+
+#if 0
+ grad_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
+ stops, 2);
+#endif
+#if 0
+ grad_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
+ stops, 2);
+ grad_img = pixman_image_create_linear_gradient (&c_inner, &c_outer,
+ r_inner, r_outer,
+ stops, 2);
+#endif
+
+ grad_img = pixman_image_create_linear_gradient (&p1, &p2,
+ stops, 2);
+
+ pixman_image_set_transform (grad_img, &trans);
+ pixman_image_set_repeat (grad_img, PIXMAN_REPEAT_PAD);
+
+ pixman_image_composite (PIXMAN_OP_OVER, grad_img, NULL, alpha_img,
+ 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
+
+ pixman_image_set_alpha_map (src_img, alpha_img, 10, 10);
+
+ pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
+ 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
+
+ printf ("0, 0: %x\n", dest[0]);
+ printf ("10, 10: %x\n", dest[10 * 10 + 10]);
+ printf ("w, h: %x\n", dest[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
+
+ show_image (dest_img);
+
+ pixman_image_unref (src_img);
+ pixman_image_unref (grad_img);
+ pixman_image_unref (alpha_img);
+ free (dest);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/clip-in.c b/lib/pixman/demos/clip-in.c
new file mode 100644
index 000000000..51579811f
--- /dev/null
+++ b/lib/pixman/demos/clip-in.c
@@ -0,0 +1,50 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+/* This test demonstrates that clipping is done totally different depending
+ * on whether the source is transformed or not.
+ */
+int
+main (int argc, char **argv)
+{
+#define WIDTH 200
+#define HEIGHT 200
+
+#define SMALL 25
+
+ uint32_t *sbits = malloc (SMALL * SMALL * 4);
+ uint32_t *bits = malloc (WIDTH * HEIGHT * 4);
+ pixman_transform_t trans = {
+ {
+ { pixman_double_to_fixed (1.0), pixman_double_to_fixed (0), pixman_double_to_fixed (-0.1), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (-0.1), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (1.0) }
+ } };
+
+ pixman_image_t *src_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, SMALL, SMALL, sbits, 4 * SMALL);
+ pixman_image_t *dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, 4 * WIDTH);
+
+ memset (bits, 0xff, WIDTH * HEIGHT * 4);
+ memset (sbits, 0x00, SMALL * SMALL * 4);
+
+ pixman_image_composite (PIXMAN_OP_IN,
+ src_img, NULL, dest_img,
+ 0, 0, 0, 0, SMALL, SMALL, 200, 200);
+
+ pixman_image_set_transform (src_img, &trans);
+
+ pixman_image_composite (PIXMAN_OP_IN,
+ src_img, NULL, dest_img,
+ 0, 0, 0, 0, SMALL * 2, SMALL * 2, 200, 200);
+
+ show_image (dest_img);
+
+ pixman_image_unref (src_img);
+ pixman_image_unref (dest_img);
+ free (bits);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/clip-test.c b/lib/pixman/demos/clip-test.c
new file mode 100644
index 000000000..aa0df4482
--- /dev/null
+++ b/lib/pixman/demos/clip-test.c
@@ -0,0 +1,97 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+#define WIDTH 200
+#define HEIGHT 200
+
+static pixman_image_t *
+create_solid_bits (uint32_t pixel)
+{
+ uint32_t *pixels = malloc (WIDTH * HEIGHT * 4);
+ int i;
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ pixels[i] = pixel;
+
+ return pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ pixels,
+ WIDTH * 4);
+}
+
+int
+main (int argc, char **argv)
+{
+ pixman_image_t *gradient_img;
+ pixman_image_t *src_img, *dst_img;
+ pixman_gradient_stop_t stops[2] =
+ {
+ { pixman_int_to_fixed (0), { 0xffff, 0x0000, 0x0000, 0xffff } },
+ { pixman_int_to_fixed (1), { 0xffff, 0xffff, 0x0000, 0xffff } }
+ };
+#if 0
+ pixman_point_fixed_t p1 = { 0, 0 };
+ pixman_point_fixed_t p2 = { pixman_int_to_fixed (WIDTH),
+ pixman_int_to_fixed (HEIGHT) };
+#endif
+ pixman_point_fixed_t c_inner;
+ pixman_point_fixed_t c_outer;
+ pixman_fixed_t r_inner;
+ pixman_fixed_t r_outer;
+ pixman_region32_t clip_region;
+ pixman_transform_t trans = {
+ { { pixman_double_to_fixed (1.3), pixman_double_to_fixed (0), pixman_double_to_fixed (-0.5), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (1), pixman_double_to_fixed (-0.5), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (0), pixman_double_to_fixed (1.0) }
+ }
+ };
+
+ src_img = create_solid_bits (0xff0000ff);
+
+ c_inner.x = pixman_double_to_fixed (100.0);
+ c_inner.y = pixman_double_to_fixed (100.0);
+ c_outer.x = pixman_double_to_fixed (100.0);
+ c_outer.y = pixman_double_to_fixed (100.0);
+ r_inner = 0;
+ r_outer = pixman_double_to_fixed (100.0);
+
+ gradient_img = pixman_image_create_radial_gradient (&c_inner, &c_outer,
+ r_inner, r_outer,
+ stops, 2);
+
+#if 0
+ gradient_img = pixman_image_create_linear_gradient (&p1, &p2,
+ stops, 2);
+
+#endif
+
+ pixman_image_composite (PIXMAN_OP_OVER, gradient_img, NULL, src_img,
+ 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+
+ pixman_region32_init_rect (&clip_region, 50, 0, 100, 200);
+ pixman_image_set_clip_region32 (src_img, &clip_region);
+ pixman_image_set_source_clipping (src_img, TRUE);
+ pixman_image_set_has_client_clip (src_img, TRUE);
+ pixman_image_set_transform (src_img, &trans);
+ pixman_image_set_repeat (src_img, PIXMAN_REPEAT_NORMAL);
+
+ dst_img = create_solid_bits (0xffff0000);
+ pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dst_img,
+ 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+
+
+#if 0
+ printf ("0, 0: %x\n", src[0]);
+ printf ("10, 10: %x\n", src[10 * 10 + 10]);
+ printf ("w, h: %x\n", src[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
+#endif
+
+ show_image (dst_img);
+
+ pixman_image_unref (gradient_img);
+ pixman_image_unref (src_img);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/composite-test.c b/lib/pixman/demos/composite-test.c
new file mode 100644
index 000000000..f5f352ff1
--- /dev/null
+++ b/lib/pixman/demos/composite-test.c
@@ -0,0 +1,191 @@
+#include <gtk/gtk.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+#define WIDTH 60
+#define HEIGHT 60
+
+typedef struct {
+ const char *name;
+ pixman_op_t op;
+} operator_t;
+
+static const operator_t operators[] = {
+ { "CLEAR", PIXMAN_OP_CLEAR },
+ { "SRC", PIXMAN_OP_SRC },
+ { "DST", PIXMAN_OP_DST },
+ { "OVER", PIXMAN_OP_OVER },
+ { "OVER_REVERSE", PIXMAN_OP_OVER_REVERSE },
+ { "IN", PIXMAN_OP_IN },
+ { "IN_REVERSE", PIXMAN_OP_IN_REVERSE },
+ { "OUT", PIXMAN_OP_OUT },
+ { "OUT_REVERSE", PIXMAN_OP_OUT_REVERSE },
+ { "ATOP", PIXMAN_OP_ATOP },
+ { "ATOP_REVERSE", PIXMAN_OP_ATOP_REVERSE },
+ { "XOR", PIXMAN_OP_XOR },
+ { "ADD", PIXMAN_OP_ADD },
+ { "SATURATE", PIXMAN_OP_SATURATE },
+
+ { "MULTIPLY", PIXMAN_OP_MULTIPLY },
+ { "SCREEN", PIXMAN_OP_SCREEN },
+ { "OVERLAY", PIXMAN_OP_OVERLAY },
+ { "DARKEN", PIXMAN_OP_DARKEN },
+ { "LIGHTEN", PIXMAN_OP_LIGHTEN },
+ { "COLOR_DODGE", PIXMAN_OP_COLOR_DODGE },
+ { "COLOR_BURN", PIXMAN_OP_COLOR_BURN },
+ { "HARD_LIGHT", PIXMAN_OP_HARD_LIGHT },
+ { "SOFT_LIGHT", PIXMAN_OP_SOFT_LIGHT },
+ { "DIFFERENCE", PIXMAN_OP_DIFFERENCE },
+ { "EXCLUSION", PIXMAN_OP_EXCLUSION },
+ { "HSL_HUE", PIXMAN_OP_HSL_HUE },
+ { "HSL_SATURATION", PIXMAN_OP_HSL_SATURATION },
+ { "HSL_COLOR", PIXMAN_OP_HSL_COLOR },
+ { "HSL_LUMINOSITY", PIXMAN_OP_HSL_LUMINOSITY },
+};
+
+static uint32_t
+reader (const void *src, int size)
+{
+ switch (size)
+ {
+ case 1:
+ return *(uint8_t *)src;
+ case 2:
+ return *(uint16_t *)src;
+ case 4:
+ return *(uint32_t *)src;
+ default:
+ g_assert_not_reached();
+ }
+}
+
+static void
+writer (void *src, uint32_t value, int size)
+{
+ switch (size)
+ {
+ case 1:
+ *(uint8_t *)src = value;
+ break;
+
+ case 2:
+ *(uint16_t *)src = value;
+ break;
+
+ case 4:
+ *(uint32_t *)src = value;
+ break;
+
+ default:
+ break;
+ }
+}
+
+int
+main (int argc, char **argv)
+{
+#define d2f pixman_double_to_fixed
+
+ GtkWidget *window, *swindow;
+ GtkWidget *table;
+ uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *src = malloc (WIDTH * HEIGHT * 4);
+ pixman_image_t *src_img;
+ pixman_image_t *dest_img;
+ pixman_point_fixed_t p1 = { -10 << 0, 0 };
+ pixman_point_fixed_t p2 = { WIDTH << 16, (HEIGHT - 10) << 16 };
+ uint16_t full = 0xcfff;
+ uint16_t low = 0x5000;
+ uint16_t alpha = 0xffff;
+ pixman_gradient_stop_t stops[6] =
+ {
+ { d2f (0.0), { full, low, low, alpha } },
+ { d2f (0.25), { full, full, low, alpha } },
+ { d2f (0.4), { low, full, low, alpha } },
+ { d2f (0.6), { low, full, full, alpha } },
+ { d2f (0.8), { low, low, full, alpha } },
+ { d2f (1.0), { full, low, full, alpha } },
+ };
+
+ int i;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+
+ gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
+
+ g_signal_connect (window, "delete-event",
+ G_CALLBACK (gtk_main_quit),
+ NULL);
+ table = gtk_table_new (G_N_ELEMENTS (operators) / 6, 6, TRUE);
+
+ src_img = pixman_image_create_linear_gradient (&p1, &p2, stops,
+ sizeof (stops) / sizeof (stops[0]));
+
+ pixman_image_set_repeat (src_img, PIXMAN_REPEAT_PAD);
+
+ dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ dest,
+ WIDTH * 4);
+ pixman_image_set_accessors (dest_img, reader, writer);
+
+ for (i = 0; i < G_N_ELEMENTS (operators); ++i)
+ {
+ GtkWidget *image;
+ GdkPixbuf *pixbuf;
+ GtkWidget *vbox;
+ GtkWidget *label;
+ int j, k;
+
+ vbox = gtk_vbox_new (FALSE, 0);
+
+ label = gtk_label_new (operators[i].name);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 6);
+ gtk_widget_show (label);
+
+ for (j = 0; j < HEIGHT; ++j)
+ {
+ for (k = 0; k < WIDTH; ++k)
+ dest[j * WIDTH + k] = 0x7f6f6f00;
+ }
+ pixman_image_composite (operators[i].op, src_img, NULL, dest_img,
+ 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+ pixbuf = pixbuf_from_argb32 (pixman_image_get_data (dest_img), TRUE,
+ WIDTH, HEIGHT, WIDTH * 4);
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_box_pack_start (GTK_BOX (vbox), image, FALSE, FALSE, 0);
+ gtk_widget_show (image);
+
+ gtk_table_attach_defaults (GTK_TABLE (table), vbox,
+ i % 6, (i % 6) + 1, i / 6, (i / 6) + 1);
+ gtk_widget_show (vbox);
+
+ g_object_unref (pixbuf);
+ }
+
+ pixman_image_unref (src_img);
+ free (src);
+ pixman_image_unref (dest_img);
+ free (dest);
+
+ swindow = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swindow), table);
+ gtk_widget_show (table);
+
+ gtk_container_add (GTK_CONTAINER (window), swindow);
+ gtk_widget_show (swindow);
+
+ gtk_widget_show (window);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/lib/pixman/demos/convolution-test.c b/lib/pixman/demos/convolution-test.c
new file mode 100644
index 000000000..da284af7b
--- /dev/null
+++ b/lib/pixman/demos/convolution-test.c
@@ -0,0 +1,47 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 200
+#define HEIGHT 200
+
+#define d2f pixman_double_to_fixed
+
+ uint32_t *src = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *mask = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
+ pixman_fixed_t convolution[] =
+ {
+ d2f (3), d2f (3),
+ d2f (0.5), d2f (0.5), d2f (0.5),
+ d2f (0.5), d2f (0.5), d2f (0.5),
+ d2f (0.5), d2f (0.5), d2f (0.5),
+ };
+ pixman_image_t *simg, *mimg, *dimg;
+
+ int i;
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ {
+ src[i] = 0x7f007f00;
+ mask[i] = (i % 256) * 0x01000000;
+ dest[i] = 0;
+ }
+
+ simg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src, WIDTH * 4);
+ mimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, mask, WIDTH * 4);
+ dimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, dest, WIDTH * 4);
+
+ pixman_image_set_filter (mimg, PIXMAN_FILTER_CONVOLUTION,
+ convolution, 11);
+
+ pixman_image_composite (PIXMAN_OP_OVER, simg, mimg, dimg, 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+
+ show_image (dimg);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/gradient-test.c b/lib/pixman/demos/gradient-test.c
new file mode 100644
index 000000000..fc84844b0
--- /dev/null
+++ b/lib/pixman/demos/gradient-test.c
@@ -0,0 +1,89 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 400
+#define HEIGHT 200
+
+ uint32_t *dest = malloc (WIDTH * HEIGHT * 4);
+ pixman_image_t *src_img;
+ pixman_image_t *dest_img;
+ int i;
+ pixman_gradient_stop_t stops[2] =
+ {
+ { pixman_int_to_fixed (0), { 0xffff, 0xeeee, 0xeeee, 0xeeee } },
+ { pixman_int_to_fixed (1), { 0xffff, 0x1111, 0x1111, 0x1111 } }
+ };
+ pixman_point_fixed_t p1 = { pixman_double_to_fixed (0), 0 };
+ pixman_point_fixed_t p2 = { pixman_double_to_fixed (WIDTH / 8.),
+ pixman_int_to_fixed (0) };
+#if 0
+ pixman_transform_t trans = {
+ { { pixman_double_to_fixed (2), pixman_double_to_fixed (0.5), pixman_double_to_fixed (-100), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (3), pixman_double_to_fixed (0), },
+ { pixman_double_to_fixed (0), pixman_double_to_fixed (0.000), pixman_double_to_fixed (1.0) }
+ }
+ };
+#else
+ pixman_transform_t trans = {
+ { { pixman_fixed_1, 0, 0 },
+ { 0, pixman_fixed_1, 0 },
+ { 0, 0, pixman_fixed_1 } }
+ };
+#endif
+
+ pixman_point_fixed_t c_inner;
+ pixman_point_fixed_t c_outer;
+ pixman_fixed_t r_inner;
+ pixman_fixed_t r_outer;
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ dest[i] = 0x4f00004f; /* pale blue */
+
+ dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ dest,
+ WIDTH * 4);
+
+ c_inner.x = pixman_double_to_fixed (50.0);
+ c_inner.y = pixman_double_to_fixed (50.0);
+ c_outer.x = pixman_double_to_fixed (50.0);
+ c_outer.y = pixman_double_to_fixed (50.0);
+ r_inner = 0;
+ r_outer = pixman_double_to_fixed (50.0);
+
+ src_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
+ stops, 2);
+#if 0
+ src_img = pixman_image_create_conical_gradient (&c_inner, r_inner,
+ stops, 2);
+ src_img = pixman_image_create_linear_gradient (&c_inner, &c_outer,
+ r_inner, r_outer,
+ stops, 2);
+#endif
+
+ src_img = pixman_image_create_linear_gradient (&p1, &p2,
+ stops, 2);
+
+ pixman_image_set_transform (src_img, &trans);
+ pixman_image_set_repeat (src_img, PIXMAN_REPEAT_PAD);
+
+ pixman_image_composite (PIXMAN_OP_OVER, src_img, NULL, dest_img,
+ 0, 0, 0, 0, 0, 0, 10 * WIDTH, HEIGHT);
+
+ printf ("0, 0: %x\n", dest[0]);
+ printf ("10, 10: %x\n", dest[10 * 10 + 10]);
+ printf ("w, h: %x\n", dest[(HEIGHT - 1) * 100 + (WIDTH - 1)]);
+
+ show_image (dest_img);
+
+ pixman_image_unref (src_img);
+ pixman_image_unref (dest_img);
+ free (dest);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/gtk-utils.c b/lib/pixman/demos/gtk-utils.c
new file mode 100644
index 000000000..0e7cb5cb7
--- /dev/null
+++ b/lib/pixman/demos/gtk-utils.c
@@ -0,0 +1,115 @@
+#include <gtk/gtk.h>
+#include <config.h>
+#include "pixman-private.h" /* For image->bits.format
+ * FIXME: there should probably be public API for this
+ */
+#include "gtk-utils.h"
+
+GdkPixbuf *
+pixbuf_from_argb32 (uint32_t *bits,
+ gboolean has_alpha,
+ int width,
+ int height,
+ int stride)
+{
+ GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE,
+ 8, width, height);
+ int p_stride = gdk_pixbuf_get_rowstride (pixbuf);
+ guint32 *p_bits = (guint32 *)gdk_pixbuf_get_pixels (pixbuf);
+ int w, h;
+
+ for (h = 0; h < height; ++h)
+ {
+ for (w = 0; w < width; ++w)
+ {
+ uint32_t argb = bits[h * (stride / 4) + w];
+ guint r, g, b, a;
+ char *pb = (char *)p_bits;
+
+ pb += h * p_stride + w * 4;
+
+ r = (argb & 0x00ff0000) >> 16;
+ g = (argb & 0x0000ff00) >> 8;
+ b = (argb & 0x000000ff) >> 0;
+ a = has_alpha? (argb & 0xff000000) >> 24 : 0xff;
+
+ if (a)
+ {
+ r = (r * 255) / a;
+ g = (g * 255) / a;
+ b = (b * 255) / a;
+ }
+
+ if (r > 255) r = 255;
+ if (g > 255) g = 255;
+ if (b > 255) b = 255;
+
+ pb[0] = r;
+ pb[1] = g;
+ pb[2] = b;
+ pb[3] = a;
+ }
+ }
+
+ return pixbuf;
+}
+
+
+static gboolean
+on_expose (GtkWidget *widget, GdkEventExpose *expose, gpointer data)
+{
+ GdkPixbuf *pixbuf = data;
+
+ gdk_draw_pixbuf (widget->window, NULL,
+ pixbuf, 0, 0, 0, 0,
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf),
+ GDK_RGB_DITHER_NONE,
+ 0, 0);
+
+ return TRUE;
+}
+
+void
+show_image (pixman_image_t *image)
+{
+ GtkWidget *window;
+ GdkPixbuf *pixbuf;
+ int width, height, stride;
+ int argc;
+ char **argv;
+ char *arg0 = g_strdup ("pixman-test-program");
+ gboolean has_alpha;
+ pixman_format_code_t format;
+
+ argc = 1;
+ argv = (char **)&arg0;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ width = pixman_image_get_width (image);
+ height = pixman_image_get_height (image);
+ stride = pixman_image_get_stride (image);
+
+ gtk_window_set_default_size (GTK_WINDOW (window), width, height);
+
+ format = image->bits.format;
+
+ if (format == PIXMAN_a8r8g8b8)
+ has_alpha = TRUE;
+ else if (format == PIXMAN_x8r8g8b8)
+ has_alpha = FALSE;
+ else
+ g_error ("Can't deal with this format: %x\n", format);
+
+ pixbuf = pixbuf_from_argb32 (pixman_image_get_data (image), has_alpha,
+ width, height, stride);
+
+ g_signal_connect (window, "expose_event", G_CALLBACK (on_expose), pixbuf);
+ g_signal_connect (window, "delete_event", G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_widget_show (window);
+
+ gtk_main ();
+}
diff --git a/lib/pixman/demos/gtk-utils.h b/lib/pixman/demos/gtk-utils.h
new file mode 100644
index 000000000..2cb13bcf0
--- /dev/null
+++ b/lib/pixman/demos/gtk-utils.h
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <gtk/gtk.h>
+#include "pixman.h"
+
+void show_image (pixman_image_t *image);
+
+GdkPixbuf *pixbuf_from_argb32 (uint32_t *bits,
+ gboolean has_alpha,
+ int width,
+ int height,
+ int stride);
diff --git a/lib/pixman/demos/radial-test.c b/lib/pixman/demos/radial-test.c
new file mode 100644
index 000000000..35e90d786
--- /dev/null
+++ b/lib/pixman/demos/radial-test.c
@@ -0,0 +1,198 @@
+#include "../test/utils.h"
+#include "gtk-utils.h"
+
+#define NUM_GRADIENTS 7
+#define NUM_STOPS 3
+#define NUM_REPEAT 4
+#define SIZE 128
+#define WIDTH (SIZE * NUM_GRADIENTS)
+#define HEIGHT (SIZE * NUM_REPEAT)
+
+/*
+ * We want to test all the possible relative positions of the start
+ * and end circle:
+ *
+ * - The start circle can be smaller/equal/bigger than the end
+ * circle. A radial gradient can be classified in one of these
+ * three cases depending on the sign of dr.
+ *
+ * - The smaller circle can be completely inside/internally
+ * tangent/outside (at least in part) of the bigger circle. This
+ * classification is the same as the one which can be computed by
+ * examining the sign of a = (dx^2 + dy^2 - dr^2).
+ *
+ * - If the two circles have the same size, neither can be inside or
+ * internally tangent
+ *
+ * This test draws radial gradients whose circles always have the same
+ * centers (0, 0) and (1, 0), but with different radiuses. From left
+ * to right:
+ *
+ * - Small start circle completely inside the end circle
+ * 0.25 -> 1.75; dr = 1.5 > 0; a = 1 - 1.50^2 < 0
+ *
+ * - Small start circle internally tangent to the end circle
+ * 0.50 -> 1.50; dr = 1.0 > 0; a = 1 - 1.00^2 = 0
+ *
+ * - Small start circle outside of the end circle
+ * 0.50 -> 1.00; dr = 0.5 > 0; a = 1 - 0.50^2 > 0
+ *
+ * - Start circle with the same size as the end circle
+ * 1.00 -> 1.00; dr = 0.0 = 0; a = 1 - 0.00^2 > 0
+ *
+ * - Small end circle outside of the start circle
+ * 1.00 -> 0.50; dr = -0.5 > 0; a = 1 - 0.50^2 > 0
+ *
+ * - Small end circle internally tangent to the start circle
+ * 1.50 -> 0.50; dr = -1.0 > 0; a = 1 - 1.00^2 = 0
+ *
+ * - Small end circle completely inside the start circle
+ * 1.75 -> 0.25; dr = -1.5 > 0; a = 1 - 1.50^2 < 0
+ *
+ */
+
+const static double radiuses[NUM_GRADIENTS] = {
+ 0.25,
+ 0.50,
+ 0.50,
+ 1.00,
+ 1.00,
+ 1.50,
+ 1.75
+};
+
+#define double_to_color(x) \
+ (((uint32_t) ((x)*65536)) - (((uint32_t) ((x)*65536)) >> 16))
+
+#define PIXMAN_STOP(offset,r,g,b,a) \
+ { pixman_double_to_fixed (offset), \
+ { \
+ double_to_color (r), \
+ double_to_color (g), \
+ double_to_color (b), \
+ double_to_color (a) \
+ } \
+ }
+
+static const pixman_gradient_stop_t stops[NUM_STOPS] = {
+ PIXMAN_STOP (0.0, 1, 0, 0, 0.75),
+ PIXMAN_STOP (0.70710678, 0, 1, 0, 0),
+ PIXMAN_STOP (1.0, 0, 0, 1, 1)
+};
+
+static pixman_image_t *
+create_radial (int index)
+{
+ pixman_point_fixed_t p0, p1;
+ pixman_fixed_t r0, r1;
+ double x0, x1, radius0, radius1, left, right, center;
+
+ x0 = 0;
+ x1 = 1;
+ radius0 = radiuses[index];
+ radius1 = radiuses[NUM_GRADIENTS - index - 1];
+
+ /* center the gradient */
+ left = MIN (x0 - radius0, x1 - radius1);
+ right = MAX (x0 + radius0, x1 + radius1);
+ center = (left + right) * 0.5;
+ x0 -= center;
+ x1 -= center;
+
+ /* scale to make it fit within a 1x1 rect centered in (0,0) */
+ x0 *= 0.25;
+ x1 *= 0.25;
+ radius0 *= 0.25;
+ radius1 *= 0.25;
+
+ p0.x = pixman_double_to_fixed (x0);
+ p0.y = pixman_double_to_fixed (0);
+
+ p1.x = pixman_double_to_fixed (x1);
+ p1.y = pixman_double_to_fixed (0);
+
+ r0 = pixman_double_to_fixed (radius0);
+ r1 = pixman_double_to_fixed (radius1);
+
+ return pixman_image_create_radial_gradient (&p0, &p1,
+ r0, r1,
+ stops, NUM_STOPS);
+}
+
+static const pixman_repeat_t repeat[NUM_REPEAT] = {
+ PIXMAN_REPEAT_NONE,
+ PIXMAN_REPEAT_NORMAL,
+ PIXMAN_REPEAT_REFLECT,
+ PIXMAN_REPEAT_PAD
+};
+
+int
+main (int argc, char **argv)
+{
+ pixman_transform_t transform;
+ pixman_image_t *src_img, *dest_img;
+ int i, j;
+
+ enable_fp_exceptions ();
+
+ dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8,
+ WIDTH, HEIGHT,
+ NULL, 0);
+
+ pixman_transform_init_identity (&transform);
+
+ /*
+ * The create_radial() function returns gradients centered in the
+ * origin and whose interesting part fits a 1x1 square. We want to
+ * paint these gradients on a SIZExSIZE square and to make things
+ * easier we want the origin in the top-left corner of the square
+ * we want to see.
+ */
+ pixman_transform_translate (NULL, &transform,
+ pixman_double_to_fixed (0.5),
+ pixman_double_to_fixed (0.5));
+
+ pixman_transform_scale (NULL, &transform,
+ pixman_double_to_fixed (SIZE),
+ pixman_double_to_fixed (SIZE));
+
+ /*
+ * Gradients are evaluated at the center of each pixel, so we need
+ * to translate by half a pixel to trigger some interesting
+ * cornercases. In particular, the original implementation of PDF
+ * radial gradients tried to divide by 0 when using this transform
+ * on the "tangent circles" cases.
+ */
+ pixman_transform_translate (NULL, &transform,
+ pixman_double_to_fixed (0.5),
+ pixman_double_to_fixed (0.5));
+
+ for (i = 0; i < NUM_GRADIENTS; i++)
+ {
+ src_img = create_radial (i);
+ pixman_image_set_transform (src_img, &transform);
+
+ for (j = 0; j < NUM_REPEAT; j++)
+ {
+ pixman_image_set_repeat (src_img, repeat[j]);
+
+ pixman_image_composite32 (PIXMAN_OP_OVER,
+ src_img,
+ NULL,
+ dest_img,
+ 0, 0,
+ 0, 0,
+ i * SIZE, j * SIZE,
+ SIZE, SIZE);
+
+ }
+
+ pixman_image_unref (src_img);
+ }
+
+ show_image (dest_img);
+
+ pixman_image_unref (dest_img);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/screen-test.c b/lib/pixman/demos/screen-test.c
new file mode 100644
index 000000000..e69dba3de
--- /dev/null
+++ b/lib/pixman/demos/screen-test.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 40
+#define HEIGHT 40
+
+ uint32_t *src1 = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *src2 = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *src3 = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *dest = malloc (3 * WIDTH * 2 * HEIGHT * 4);
+ pixman_image_t *simg1, *simg2, *simg3, *dimg;
+
+ int i;
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ {
+ src1[i] = 0x7ff00000;
+ src2[i] = 0x7f00ff00;
+ src3[i] = 0x7f0000ff;
+ }
+
+ for (i = 0; i < 3 * WIDTH * 2 * HEIGHT; ++i)
+ {
+ dest[i] = 0x0;
+ }
+
+ simg1 = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src1, WIDTH * 4);
+ simg2 = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src2, WIDTH * 4);
+ simg3 = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, src3, WIDTH * 4);
+ dimg = pixman_image_create_bits (PIXMAN_a8r8g8b8, 3 * WIDTH, 2 * HEIGHT, dest, 3 * WIDTH * 4);
+
+ pixman_image_composite (PIXMAN_OP_SCREEN, simg1, NULL, dimg, 0, 0, 0, 0, WIDTH, HEIGHT / 4, WIDTH, HEIGHT);
+ pixman_image_composite (PIXMAN_OP_SCREEN, simg2, NULL, dimg, 0, 0, 0, 0, (WIDTH/2), HEIGHT / 4 + HEIGHT / 2, WIDTH, HEIGHT);
+ pixman_image_composite (PIXMAN_OP_SCREEN, simg3, NULL, dimg, 0, 0, 0, 0, (4 * WIDTH) / 3, HEIGHT, WIDTH, HEIGHT);
+
+ show_image (dimg);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/trap-test.c b/lib/pixman/demos/trap-test.c
new file mode 100644
index 000000000..19295e7a5
--- /dev/null
+++ b/lib/pixman/demos/trap-test.c
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "pixman.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 200
+#define HEIGHT 200
+
+ pixman_image_t *src_img;
+ pixman_image_t *mask_img;
+ pixman_image_t *dest_img;
+ pixman_trap_t trap;
+ pixman_color_t white = { 0x0000, 0xffff, 0x0000, 0xffff };
+ uint32_t *bits = malloc (WIDTH * HEIGHT * 4);
+ uint32_t *mbits = malloc (WIDTH * HEIGHT);
+
+ memset (mbits, 0, WIDTH * HEIGHT);
+ memset (bits, 0xff, WIDTH * HEIGHT * 4);
+
+ trap.top.l = pixman_int_to_fixed (50) + 0x8000;
+ trap.top.r = pixman_int_to_fixed (150) + 0x8000;
+ trap.top.y = pixman_int_to_fixed (30);
+
+ trap.bot.l = pixman_int_to_fixed (50) + 0x8000;
+ trap.bot.r = pixman_int_to_fixed (150) + 0x8000;
+ trap.bot.y = pixman_int_to_fixed (150);
+
+ mask_img = pixman_image_create_bits (PIXMAN_a8, WIDTH, HEIGHT, mbits, WIDTH);
+ src_img = pixman_image_create_solid_fill (&white);
+ dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, WIDTH * 4);
+
+ pixman_add_traps (mask_img, 0, 0, 1, &trap);
+
+ pixman_image_composite (PIXMAN_OP_OVER,
+ src_img, mask_img, dest_img,
+ 0, 0, 0, 0, 0, 0, WIDTH, HEIGHT);
+
+ show_image (dest_img);
+
+ pixman_image_unref (src_img);
+ pixman_image_unref (dest_img);
+ free (bits);
+
+ return 0;
+}
diff --git a/lib/pixman/demos/tri-test.c b/lib/pixman/demos/tri-test.c
new file mode 100644
index 000000000..a71869a6a
--- /dev/null
+++ b/lib/pixman/demos/tri-test.c
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "../test/utils.h"
+#include "gtk-utils.h"
+
+int
+main (int argc, char **argv)
+{
+#define WIDTH 200
+#define HEIGHT 200
+
+#define POINT(x,y) \
+ { pixman_double_to_fixed ((x)), pixman_double_to_fixed ((y)) }
+
+ pixman_image_t *src_img, *dest_img;
+ pixman_triangle_t tris[4] =
+ {
+ { POINT (100, 100), POINT (10, 50), POINT (110, 10) },
+ { POINT (100, 100), POINT (150, 10), POINT (200, 50) },
+ { POINT (100, 100), POINT (10, 170), POINT (90, 175) },
+ { POINT (100, 100), POINT (170, 150), POINT (120, 190) },
+ };
+ pixman_color_t color = { 0x4444, 0x4444, 0xffff, 0xffff };
+ uint32_t *bits = malloc (WIDTH * HEIGHT * 4);
+ int i;
+
+ for (i = 0; i < WIDTH * HEIGHT; ++i)
+ bits[i] = (i / HEIGHT) * 0x01010000;
+
+ src_img = pixman_image_create_solid_fill (&color);
+ dest_img = pixman_image_create_bits (PIXMAN_a8r8g8b8, WIDTH, HEIGHT, bits, WIDTH * 4);
+
+ pixman_composite_triangles (PIXMAN_OP_ATOP_REVERSE,
+ src_img,
+ dest_img,
+ PIXMAN_a8,
+ 200, 200,
+ -5, 5,
+ ARRAY_LENGTH (tris), tris);
+ show_image (dest_img);
+
+ pixman_image_unref (src_img);
+ pixman_image_unref (dest_img);
+ free (bits);
+
+ return 0;
+}