--- libcairo-1.4.10.orig/debian/libcairo2-doc.install +++ libcairo-1.4.10/debian/libcairo2-doc.install @@ -0,0 +1 @@ +debian/dist-main/usr/share/gtk-doc/html/cairo /usr/share/gtk-doc/html --- libcairo-1.4.10.orig/debian/libcairo-directfb2.install +++ libcairo-1.4.10/debian/libcairo-directfb2.install @@ -0,0 +1 @@ +debian/dist-directfb/usr/lib/libcairo-directfb/lib/libcairo.so.* /usr/lib/libcairo-directfb/lib --- libcairo-1.4.10.orig/debian/libcairo2.install +++ libcairo-1.4.10/debian/libcairo2.install @@ -0,0 +1 @@ +debian/dist-main/usr/lib/libcairo.so.* /usr/lib --- libcairo-1.4.10.orig/debian/libcairo-directfb2-dev.install +++ libcairo-1.4.10/debian/libcairo-directfb2-dev.install @@ -0,0 +1,4 @@ +debian/dist-directfb/usr/lib/libcairo-directfb/include/cairo/*.h /usr/lib/libcairo-directfb/include/cairo +debian/dist-directfb/usr/lib/libcairo-directfb/lib/libcairo.so /usr/lib/libcairo-directfb/lib +debian/dist-directfb/usr/lib/libcairo-directfb/lib/libcairo*.a /usr/lib/libcairo-directfb/lib +debian/dist-directfb/usr/lib/pkgconfig/cairo-directfb.pc /usr/lib/pkgconfig --- libcairo-1.4.10.orig/debian/libcairo2-dev.install +++ libcairo-1.4.10/debian/libcairo2-dev.install @@ -0,0 +1,5 @@ +debian/dist-main/usr/include/cairo/*.h /usr/include/cairo +debian/dist-main/usr/lib/libcairo.so /usr/lib +debian/dist-main/usr/lib/libcairo*.a /usr/lib +debian/dist-main/usr/lib/libcairo*.la /usr/lib +debian/dist-main/usr/lib/pkgconfig/cairo*.pc /usr/lib/pkgconfig --- libcairo-1.4.10.orig/debian/rules +++ libcairo-1.4.10/debian/rules @@ -0,0 +1,201 @@ +#!/usr/bin/make -f + +# Configure for cairo packages + +# Supported backends (as of Cairo 1.4.10): +# (internal) Image +# xlib Xlib +# pdf PDF +# ps PostScript +# svg SVG +# +# Experimental and unsupported backends: +# directfb DirectFB (requires Build-Depend on libdirectfb-dev (>=0.9.25) ) +# glitz OpenGL (glitz) +# xcb XCB (requires Build-Depend on at least libxcb1-dev) +# +# Other platform backends are auto disabled: quartz/OSX, win32/Win32 +# +# Features: +# --enable-png PNG (default enabled) +# +MAIN_CONFIGURE_FLAGS = \ +--enable-xlib --enable-pdf --enable-ps --enable-svg \ +--disable-glitz --disable-xcb --disable-directfb \ +--enable-png + +# udeb package flags +# directfb DirectFB (requires Build-Depend on libdirectfb-dev (>= 0.9.25) ) +DIRECTFB_CONFIGURE_FLAGS = \ +--enable-directfb \ +--disable-xlib --enable-pdf --enable-ps --disable-svg \ +--disable-glitz --disable-xcb \ +--enable-png \ +--program-suffix=-directfb + +DIRECTFB_PREFIX=/usr/lib/libcairo-directfb + +SRC_DIR=$(CURDIR) +MAIN_BUILD_DIR=$(CURDIR)/debian/build-main +DIRECTFB_BUILD_DIR=$(CURDIR)/debian/build-directfb + +MAIN_DIST_DIR=$(CURDIR)/debian/dist-main +DIRECTFB_DIST_DIR=$(CURDIR)/debian/dist-directfb + +export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +CFLAGS = -g +CFLAGS_UDEB = -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 + CFLAGS_UDEB += -O0 +else + CFLAGS += -O2 + CFLAGS_UDEB += -Os +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +# For autoconf 2.13 only +CONFFLAGS= +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + CONFFLAGS += $(DEB_HOST_GNU_TYPE) +else + CONFFLAGS += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_HOST_GNU_TYPE) +endif + +package := tmp +prefix := /usr +share := $(prefix)/share + +version := $(shell dpkg-parsechangelog | \ + sed -ne 's/^Version: *\([0-9]\+:\)*//p') + +include /usr/share/dpatch/dpatch.make + +configure: configure-main + +configure-common-stamp: patch-stamp + dh_testdir + +# handle timestamp skew; advice from autotools-dev README.Debian + touch configure.in && \ + touch aclocal.m4 && \ + touch configure + + touch $@ + +# Calling GNU configure properly; advice from autotools-dev README.Debian +configure-main: configure-common-stamp configure-main-stamp +configure-main-stamp: configure-common-stamp + dh_testdir + mkdir -p $(MAIN_BUILD_DIR); \ + cd $(MAIN_BUILD_DIR); \ + $(SRC_DIR)/configure \ + CFLAGS="$(CFLAGS)" \ + $(CONFFLAGS) \ + --prefix=$(prefix) \ + --mandir=$(share)/man \ + --infodir=$(share)/info \ + $(MAIN_CONFIGURE_FLAGS) + touch $@ + +configure-udeb: configure-common-stamp configure-udeb-stamp +configure-udeb-stamp: configure-common-stamp + dh_testdir + mkdir -p $(DIRECTFB_BUILD_DIR); \ + cd $(DIRECTFB_BUILD_DIR); \ + $(SRC_DIR)/configure \ + CFLAGS="$(CFLAGS_UDEB)" \ + $(CONFFLAGS) \ + --prefix=$(DIRECTFB_PREFIX) \ + --mandir=$(share)/man \ + --infodir=$(share)/info \ + $(DIRECTFB_CONFIGURE_FLAGS) + touch $@ + + +build: build-main build-udeb + +build-main: build-main-stamp +build-main-stamp: configure-main-stamp + dh_testdir + cd $(MAIN_BUILD_DIR) && $(MAKE) + touch build-stamp + +build-udeb: build-udeb-stamp +build-udeb-stamp: configure-udeb-stamp + dh_testdir + cd $(DIRECTFB_BUILD_DIR) && $(MAKE) + touch build-stamp + +clean: unpatch + dh_testdir + dh_testroot + rm -f *-stamp libtool + rm -rf debian/libcairo2 debian/libcairo2-dev debian/libcairo2-doc libcairo-directfb2-udeb debian/libcairo-directfb2-udeb-dev debian/libcairo-directfb2 + rm -rf $(MAIN_BUILD_DIR) $(DIRECTFB_BUILD_DIR) $(MAIN_DIST_DIR) $(DIRECTFB_DIST_DIR) + rm -f debian/cairo-directfb.pc + + -rm -f config.h config.cache config.status config.log + +# Copy in fresh copies of config.{sub,guess} +# (these are from autotools-dev, so must Build-Depend on it) + -test -r /usr/share/misc/config.sub && \ + cp -f /usr/share/misc/config.sub config.sub + -test -r /usr/share/misc/config.guess && \ + cp -f /usr/share/misc/config.guess config.guess + + dh_clean + + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cd $(MAIN_BUILD_DIR) && $(MAKE) install DESTDIR=$(MAIN_DIST_DIR) + + cd $(DIRECTFB_BUILD_DIR) && $(MAKE) install DESTDIR=$(DIRECTFB_DIST_DIR) + + mkdir -p $(DIRECTFB_DIST_DIR)/usr/lib/pkgconfig + sed -e 's/Name: cairo/Name: cairo-directfb/' -e 's/^\(Libs: .*\)$$/\1 -Wl,-rpath,$${libdir}/' $(DIRECTFB_DIST_DIR)/$(DIRECTFB_PREFIX)/lib/pkgconfig/cairo.pc > $(DIRECTFB_DIST_DIR)/usr/lib/pkgconfig/cairo-directfb.pc + + sed -i 's:/usr/lib/lib\([^ ]*\).la:-l\1:g' $(MAIN_DIST_DIR)/usr/lib/*.la + sed -i 's:/usr/lib/lib\([^ ]*\).la:-l\1:g' $(DIRECTFB_DIST_DIR)/usr/lib/libcairo-directfb/lib/*.la + +# Build architecture-independent files here. +binary-indep: build install +# We have nothing to do by default. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + + dh_install + dh_installdocs -A TODO README NEWS AUTHORS + dh_installchangelogs ChangeLog + dh_installman + dh_installexamples + dh_link + dh_strip -a + dh_compress + dh_fixperms + dh_makeshlibs -plibcairo2 -V 'libcairo2 (>=1.4.0)' + dh_makeshlibs -plibcairo-directfb2 -V 'libcairo-directfb2 (>=1.4.0)' --add-udeb 'libcairo-directfb2-udeb' + dh_installdeb + dh_shlibdeps + dh_perl + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch + +.PHONY: build clean binary-indep binary-arch binary install configure \ + patch unpatch clean1 --- libcairo-1.4.10.orig/debian/control +++ libcairo-1.4.10/debian/control @@ -0,0 +1,100 @@ +Source: libcairo +Section: libs +Priority: optional +Maintainer: Ubuntu Core Developers +XSBC-Original-Maintainer: Dave Beckett +Build-Depends: debhelper (>= 5.0.22), autotools-dev, pkg-config (>= 0.19), libfontconfig1-dev (>= 2.4.2-1.2ubuntu2), libfreetype6-dev (>= 2.3.5-1ubuntu4), libxrender-dev (>=0.6.0), libx11-dev, libpng12-dev, libdirectfb-dev (>=0.9.25), libsm-dev, xutils-dev, libxt-dev, dpatch +Standards-Version: 3.7.2 + +Package: libcairo2-dev +Provides: libcairo-dev +Conflicts: libcairo-dev, libcairo0.5.1-dev, libcairo0.6.0-dev, libcairo0.9.0-dev +Replaces: libcairo0.5.1-dev, libcairo0.6.0-dev, libcairo0.9.0-dev +Suggests: libcairo2-doc +Section: libdevel +Architecture: any +Depends: libcairo2 (= ${Source-Version}), libfontconfig1-dev, libfreetype6-dev (>=2.3.0), libxrender-dev (>=0.6.0), libpng12-dev, libsm-dev +Description: Development files for the Cairo 2D graphics library + Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. + . + This package contains the development libraries, header files needed by + programs that want to compile with Cairo. + +Package: libcairo2 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Provides: libcairo +Conflicts: libcairo1 +Replaces: libcairo0.5.1, libcairo0.6.0, libcairo0.9.0, libcairo1 +Description: The Cairo 2D vector graphics library + Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. Paths consist + of line segments and cubic splines and can be rendered at any width + with various join and cap styles. All colors may be specified with + optional translucence (opacity/alpha) and combined using the + extended Porter/Duff compositing algebra as found in the X Render + Extension. + . + Cairo exports a stateful rendering API similar in spirit to the path + construction, text, and painting operators of PostScript, (with the + significant addition of translucence in the imaging model). When + complete, the API is intended to support the complete imaging model of + PDF 1.4. + . + This package contains the shared libraries. + +Package: libcairo2-doc +Section: libs +Architecture: all +Depends: lynx | www-browser +Conflicts: libcairo0.5.1-doc, libcairo0.6.0-doc, libcairo0.9.0-doc +Replaces: libcairo0.5.1-doc, libcairo0.6.0-doc, libcairo0.9.0-doc +Description: Documentation for the Cairo Multi-platform 2D graphics library + Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. + . + This package contains the HTML documentation for the Cairo library + in /usr/share/doc/libcairo2-doc/ . + +Package: libcairo-directfb2-udeb +XC-Package-Type: udeb +Section: debian-installer +Architecture: any +Depends: ${shlibs:Depends} +Description: The Cairo 2D vector graphics library DirectFB build + Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. + . + This is version of cairo with only the DirectFB backend, intended + primarily for use in the graphical debian installer. + +Package: libcairo-directfb2 +Section: libs +Architecture: any +Depends: ${shlibs:Depends} +Provides: libcairo-directfb +Conflicts: libcairo2-directfb +Replaces: libcairo2-directfb +Description: The Cairo 2D vector graphics library DirectFB build + Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. + . + This is version of cairo with only the DirectFB backend enabled. + Use libcairo2 for the full backend choice. + +Package: libcairo-directfb2-dev +Section: libdevel +Architecture: any +Conflicts: libcairo2-directfb-dev +Replaces: libcairo2-directfb-dev +Depends: libcairo-directfb2 (= ${Source-Version}), libfontconfig1-dev, libfreetype6-dev (>=2.3.0), libpng12-dev, libdirectfb-dev (>=0.9.25) +Description: Development files for Cairo graphics library DirectFB build + Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. + . + This package contains the development libraries, header files needed by + programs that want to compile with Cairo compiled only against the + DirectFB backend. Intended primarly for use in the graphical debian + installer, other builds should be against libcairo2-dev --- libcairo-1.4.10.orig/debian/changelog +++ libcairo-1.4.10/debian/changelog @@ -0,0 +1,567 @@ +libcairo (1.4.10-1ubuntu4.2) gutsy-security; urgency=low + + * Fix debian/patches/91_malloc-overflow-fixes.dpatch to avoid + divide-by-zero; patch from upstream fixes (LP: #173861): + http://gitweb.freedesktop.org/?p=cairo;a=commitdiff_plain;h=6020f67f1a49cfe3844c4938d4af24c63c8424cc;hp=c79fc9af334fd6f2d1078071d64178125561b187 + + -- Kees Cook Mon, 10 Dec 2007 09:08:57 -0800 + +libcairo (1.4.10-1ubuntu4.1) gutsy-security; urgency=low + + * SECURITY UPDATE: arbitrary code execution via integer overflows in + PNG handling. + * Add debian/patches/91_malloc-overflow-fixes.dpatch: backported upstream + fixes. + * References + http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=5c7d2d14d78e4dfb1ef6d2c40f0910f177e07360 + http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=e49bcde27f88e21d5b8037a0089a226096f6514b + CVE-2007-5503 + + -- Kees Cook Thu, 29 Nov 2007 12:57:18 -0800 + +libcairo (1.4.10-1ubuntu4) gutsy; urgency=low + + * debian/patches/90_from_git_fix_not_available_glyph_handling.dpatch: + - patch from git, fix rendering issue when some glyphs are not available + (LP: #116236) + + -- Sebastien Bacher Fri, 28 Sep 2007 13:49:31 +0200 + +libcairo (1.4.10-1ubuntu3) gutsy; urgency=low + + * debian/patches/02-cairo-1.4.8-lcd-filter-2.dpatch: + - Restore patch that uses the new FreeType LCD colour filtering features, + with additional modification that the specific LCD Filter can be + changed. + + -- Scott James Remnant Thu, 20 Sep 2007 20:11:09 +0100 + +libcairo (1.4.10-1ubuntu2) gutsy; urgency=low + + * debian/patches/02-cairo-1.4.8-lcd-filter-1.patch: + - remove - interacts poorly with the bytecode interpreter in + freetype, which we already have enabled + + -- Matthew Garrett Thu, 20 Sep 2007 05:09:23 +0100 + +libcairo (1.4.10-1ubuntu1) gutsy; urgency=low + + [ Matti Lindell ] + * debian/patches/02-cairo-1.4.8-lcd-filter-1.patch: + - ClearType-like LCD filtering (David Turner's patches) + + [ Scott James Remnant ] + * Bump build-dependency on libfreetype6-dev to ensure we build with the + equally patched version. + + -- Scott James Remnant Tue, 18 Sep 2007 17:38:32 +0100 + +libcairo (1.4.10-1) unstable; urgency=low + + * New upstream release + - fixes XError crash seen in openoffice.org (Closes: #430550) + * Removed patch 001-148-directfb.dpatch merged upstream + + -- Dave Beckett Wed, 27 Jun 2007 18:20:10 -0700 + +libcairo (1.4.8-1) unstable; urgency=low + + * New upstream release + - fixes gnome bug http://bugzilla.gnome.org/show_bug.cgi?id=431990 + that caused gnome-about to crash (Closes: #425058) + * Added patch 001-148-directfb.dpatch to make directfb build with 1.4.8 + * Fix directfb udeb shlibs (Closes: #429672) + - remove udeb line from libcairo2 package shlibs + - libcairo-directfb2 package shlibs provide libcairo-directfb2(-udeb) + * Acknowledge NMU - thanks Don + + -- Dave Beckett Thu, 21 Jun 2007 01:03:51 -0700 + +libcairo (1.4.6-1.1) unstable; urgency=low + + * NMU + * Apply patch from Adrian Johnson to fix segfault with PS_surface + (closes: #422388) + + -- Don Armstrong Mon, 28 May 2007 11:11:45 -0700 + +libcairo (1.4.6-1) unstable; urgency=low + + * New upstream release + * Add debian/compat, remove DH_COMPAT from debian/rules + + -- Dave Beckett Tue, 1 May 2007 23:38:00 -0800 + +libcairo (1.4.4-1) unstable; urgency=low + + * New upstream release + * Remove different versioned shlibs dependency for one udeb + to get rid of duplicate dependencies (Closes: #418616) + * Switch shlibs API version to 1.4.0 since API calls were added + * PDF fonts fixed upstream (Closes: #406191) + + -- Dave Beckett Fri, 13 Apr 2007 21:46:46 -0700 + +libcairo (1.4.2-1) experimental; urgency=low + + * New upstream release (Closes: #416024) + * debian/rules: Pass on CFLAGS (Closes: #399868) + + -- Dave Beckett Tue, 27 Mar 2007 06:55:45 -0700 + +libcairo (1.2.6-1) experimental; urgency=low + + * New upstream release + * Removed patch 01-cairo_xlib_surface_add_glyph.patch now in upstream + * Require pkg-config 0.19 + + -- Dave Beckett Fri, 17 Nov 2006 20:42:08 -0800 + +libcairo (1.2.4-4) unstable; urgency=medium + + * Acknowledge NMU. + * Urgency medium since RC bugs are acknowledged. + * Patch 01-cairo_xlib_surface_add_glyph.patch added in + experimental confirmed fixes powerpc X byte copy crash + for bug #388116 which was closed by email after an NMU. + * Enable PDF and PS for the cairo+directfb build in unstable (Closes: #383297) + * Bump libcairo-directfb2's shlibs to >= 1.2.4-4 for the addition of + PDF and PS related symbols to the cairo+directfb lib. (Closes: #387289) + * Remove libcairo.la references to other .la files to aid future + removal of all .la files. + + -- Dave Beckett Thu, 19 Oct 2006 22:41:56 -0700 + +libcairo (1.2.4-3.2) experimental; urgency=low + + * NMU + * Re-upload to get the changes from -2 in experimental, that is + building cairo+directfb with PS and PDF support (needed by + Gtk+2.10+directfb). + * Bump libcairo-directfb shlibs to >= 1.2.4-3.2 so that packages depending + on the new +directfb things get the right dep. + + -- Marc 'HE' Brockschmidt Wed, 18 Oct 2006 11:09:16 +0200 + +libcairo (1.2.4-3.1) unstable; urgency=low + + * NMU + * Upload with 01-cairo_xlib_surface_add_glyph.patch but without + the directfb changes from -2. The patch fixes the segfault caused + by a broken loop condition (c >= 0 works like, eh, always after + doing "unsigned int c"...). (Closes: #388116) + + -- Marc 'HE' Brockschmidt Sun, 15 Oct 2006 16:25:06 +0200 + +libcairo (1.2.4-3) experimental; urgency=low + + * Added patch 01-cairo_xlib_surface_add_glyph.patch from upstream git + attempting to fix 388116 + + -- Dave Beckett Sun, 8 Oct 2006 11:08:23 -0700 + +libcairo (1.2.4-2) experimental; urgency=low + + * Enable PDF and PS for the cairo+directfb build in order to + allow GTK 2.10+directfb to build (Closes: #383297) + + -- Dave Beckett Sun, 3 Sep 2006 13:24:31 -0700 + +libcairo (1.2.4-1) unstable; urgency=low + + * New upstream release. + * Remove double call to dh_installdocs (Closes: #382594) + * Submit to override for libcairo2-doc, changing to section libs. + + -- Dave Beckett Fri, 18 Aug 2006 18:11:00 -0700 + +libcairo (1.2.2-1) unstable; urgency=medium + + * New upstream release. + * This version again handles BGR X server visuals such as used by + Exceed and VNC (Closes: #376858) + * Removed patches taken from upstream git: + - cairo-bug-7494.patch + - cairo-bug-7514.patch + * Build-Depend on xutils-dev and libxt-dev since the test for the + presence of X in the latest configure (as generated by autoconf 2.60) + uses xmkmf and checks for libxt-dev even though neither are used by + Cairo. + + -- Dave Beckett Tue, 8 Aug 2006 23:59:01 -0700 + +libcairo (1.2.0-5) unstable; urgency=medium + + * Rebuild against directfb 0.9.25 which has changed library and udeb + package names from 0.9.24 that all earlier cairos were built against, + and which are now removed. This should prevent Cairo from becoming + uninstallable due to this change. Urgency medium due to this. + + -- Dave Beckett Wed, 2 Aug 2006 22:04:17 -0700 + +libcairo (1.2.0-4) unstable; urgency=medium + + * Added patch cairo-bug-7494.patch (Closes: #378005) + * Added patch cairo-bug-7514.patch (Closes: #380064) + + -- Dave Beckett Tue, 1 Aug 2006 22:29:04 -0700 + +libcairo (1.2.0-3) unstable; urgency=low + + * Add libsm-dev to Build-Depends and libcairo2-dev depends to pull in + libSM and libICE (Closes: #377259) + * Remove unused libxrender-dev Depends from libcairo-directfb2-dev + + -- Dave Beckett Sun, 9 Jul 2006 16:36:10 -0700 + +libcairo (1.2.0-2) unstable; urgency=low + + * Remove libcairo2-dev depending on libdirectfb-dev (Closes: 376691) + + -- Dave Beckett Tue, 4 Jul 2006 10:45:33 -0700 + +libcairo (1.2.0-1) unstable; urgency=low + + * New upstream release. + + -- Dave Beckett Sat, 1 Jul 2006 19:43:51 -0700 + +libcairo (1.1.10-3) experimental; urgency=low + + * First upload of 1.1.x series to debian experimental + * Remove patch 02-no-ft-glyphslot-embolden.patch (was for bug #325526) + and depend on a new enough libfreetype6 (2.1.10) which is already in + testing. + * Removed Build-Depend on libxml2 for creating SVG as that has been + rewritten. + * Added libcairo2 Conflicts and Replaces libcairo1 (Closes: #366755) + + -- Dave Beckett Wed, 28 Jun 2006 19:04:10 -0700 + +libcairo (1.1.10-2) experimental; urgency=low + + * Add -Wl,-rpath,${libdir} to libcairo-directfb pkgconfig to make the + linker use the libcairo in the libdir + * Removed Provides: libcairo2 from libcairo-directfb2-udeb + + -- Dave Beckett Sun, 25 Jun 2006 10:20:40 -0700 + +libcairo (1.1.10-1) experimental; urgency=low + + * New upstream release + * Renamed directfb packages to be libcairo-directfb2* + * Use dh_makeshlibs with --add-udeb to make udeb: lines appear in shlibs + * Depend on debhelper 5.0.22 to get a working dh_makeshlibs with --add-udeb + + -- Dave Beckett Sat, 24 Jun 2006 10:03:02 -0700 + +libcairo (1.1.8-1) experimental; urgency=low + + * New upstream release + * Added libcairo2-directfb deb. + + -- Dave Beckett Wed, 14 Jun 2006 11:47:00 -0700 + +libcairo (1.1.6-1) experimental; urgency=low + + * New upstream release + * Enable PNG, PDF and SVG backends (add Build-Depend: on libxml2) + * Added Cairo DirectFB udeb packages libcairo2-directfb-udeb and + libcairo2-directfb-dev (add Build-Depend: on libdirectfb-dev) + * libcairo2-dev and libcairo2-directfb-dev can both be installed together + * Stop using CDBS since it cannot handle the double configure and build + setup. + * Use dpatch for patching and Build-Depend: on it. + + -- Dave Beckett Mon, 12 Jun 2006 12:57:38 -0700 + +libcairo (1.0.4-2) unstable; urgency=low + + * Rebuild against X11R7 to fix .la breakage xorg caused (Closes: #362237) + + -- Dave Beckett Tue, 25 Apr 2006 22:00:36 -0700 + +libcairo (1.0.4-1) unstable; urgency=low + + * New upstream release + * Removed patches merged upstream: + - 01-INT_pixman.patch + * Debhelper 5 + + -- Dave Beckett Wed, 5 Apr 2006 17:44:12 -0700 + +libcairo (1.0.2-4) unstable; urgency=low + + * Rebuild against current build dependencies since something in the + build depends changed to make it stop working. This may be the most + useless changelog entry ever. (Closes: #347675) + + -- Dave Beckett Thu, 12 Jan 2006 19:52:08 -0800 + +libcairo (1.0.2-3) unstable; urgency=low + + * Bump libcairo2 shlibs to 1.0.2-2 given all the freetype version changes. + + -- Dave Beckett Wed, 30 Nov 2005 09:21:02 -0800 + +libcairo (1.0.2-2) unstable; urgency=low + + * Fix libcairo2-doc section to doc (Closes: #337515) + * Re-add patch 02-no-ft-glyphslot-embolden.patch to use only + freetype 2.1.7 symbols even though sid has freetype 2.1.10. + The latter has ABI changes beyond it's declared shlibs of 2.1.5 + and is undergoing a large transition. + Require freetype 2.1.7+ again. (Closes: #338817) + * Added patch 01-INT_pixman.patch from CVS to remove spurious INT_ items + that broke build with recent binutils (Closes: #340073) + * Require pkg-config >= 0.18 since cairo.pc uses Require.private: + + -- Dave Beckett Fri, 25 Nov 2005 04:01:51 +0000 + +libcairo (1.0.2-1) unstable; urgency=low + + * New upstream release + * Removed patch 01-endianess-cairo-xlib-surface.patch previously taken + from upstream CVS. + * Removed patch 02-no-ft-glyphslot-embolden.patch to re-allow configure + to use FT_GlyphSlot_Embolden provided in freetype 2.1.10 which is now + in sid. + * Require freetype 2.1.10+ + + -- Dave Beckett Tue, 25 Oct 2005 18:45:57 +0100 + +libcairo (1.0.0-3) unstable; urgency=low + + * Added patch 02-no-ft-glyphslot-embolden.patch to disable use of + FT_GlyphSlot_Embolden in freetype, which was added after the + freetype version 2.1.7 currently in testing (closes: #325526) + * Require freetype 2.1.7+ + + -- Dave Beckett Tue, 13 Sep 2005 19:33:38 +0100 + +libcairo (1.0.0-2) unstable; urgency=low + + * Added patch 01-endianess-cairo-xlib-surface.patch from CVS to fix + endianess problem when running over remote X (Closes: #326920) + * Register cairo docs with doc-base (Closes: #325541) + + -- Dave Beckett Tue, 6 Sep 2005 18:15:57 +0100 + +libcairo (1.0.0-1) unstable; urgency=low + + * New upstream release + * Removed glitz backend as currently experimental and unsupported + * debian/watch: update to use stable release area + * Removed patch cairo-0.9.2-cache-eviction-fix.patch merged upstream. + + -- Dave Beckett Wed, 24 Aug 2005 18:14:23 +0100 + +libcairo (0.9.2-2) unstable; urgency=low + + * Add patch cairo-0.9.2-cache-eviction-fix.patch from Kristian Høgsberg + to make the freetype font cache evict correctly. + + -- Dave Beckett Mon, 15 Aug 2005 19:48:43 +0100 + +libcairo (0.9.2-1) unstable; urgency=low + + * New upstream release + * First stable API release - remove patching sonames + * libcairo2, libcairo2-dev and libcairo2-doc replace all previous versions + * No longer Depends: on libpixman, now an internal library + + -- Dave Beckett Sat, 13 Aug 2005 14:16:46 +0100 + +libcairo (0.9.0-1) unstable; urgency=low + + * New upstream release + * libcairo0.9.0 replaces libcairo0.6.0 + * Functions were added so create new sonames and libraries + + -- Dave Beckett Tue, 9 Aug 2005 08:21:50 +0100 + +libcairo (0.6.0-1) unstable; urgency=low + + * New upstream release + * libcairo0.6.0 replaces libcairo0.5.1 + * Functions were added so create new sonames and libraries + * Require glitz 0.4.4 API and libpixman 0.1.5 + + -- Dave Beckett Fri, 29 Jul 2005 23:31:05 +0100 + +libcairo (0.5.1-2) unstable; urgency=low + + * Upload to unstable + * libcairo0.5.1 replaces older libcairo1 + * libcairo0.5.1-dev already conflicted with libcairo1-dev so enable + shipping libcairo.so and delete patch 05-cairo.pc.in.patch as the + cairo.pc.in is ok again + + -- Dave Beckett Sun, 10 Jul 2005 22:07:22 +0100 + +libcairo (0.5.1-1) experimental; urgency=low + + * New upstream release + * Revert to source package name libcairo + * Reflect ABI version into both library soname as libcairo-1debian0.5.1 + and package name libcairo0.5.1 (Closes: #314776) + * libcairo0.5.1 no longer conflicts with libcairo1 + * Added a libcairo0.5.1-doc package with the HTML documentation + + -- Dave Beckett Wed, 22 Jun 2005 21:06:01 +0100 + +cairo (0.5.0-2) unstable; urgency=low + + * Fix the shlibs dependencies for libcairo0.5 + + -- Dave Beckett Thu, 9 Jun 2005 21:56:08 +0100 + +cairo (0.5.0-1) unstable; urgency=low + + * New upstream release (Closes: 311042) + * Change source package s/lib// and add API version to binary packages + * Enable glitz backend (Closes: 307573) + + -- Dave Beckett Thu, 9 Jun 2005 20:51:11 +0100 + +libcairo (0.4.0-1) unstable; urgency=low + + * New upstream release + * API changes for fonts so shlib version is now 0.4.0 + * Require libpixman 0.1.4 + + -- Dave Beckett Wed, 9 Mar 2005 19:39:44 +0000 + +libcairo (0.3.0-1) unstable; urgency=low + + * New upstream release. Closes: 284205 + * Bumped shlibs version since new functions were added. + * Headers have moved to below /usr/include/cairo + * Require libpixman 0.1.3 + + -- Dave Beckett Sun, 6 Feb 2005 12:40:04 +0000 + +libcairo (0.2.0-1) unstable; urgency=low + + * New upstream release + * Bumped shlibs version since new functions were added. + * Require libpixman 0.1.2 + * Still keep glitz disabled + + -- Dave Beckett Mon, 8 Nov 2004 22:19:29 +0000 + +libcairo (0.1.23-2) unstable; urgency=low + + * Replace Build-Depend on xlibs-dev with libx11-dev + * Changed to LGPL license (in CVS 2004-08-02) + * Disable use of glitz explicitly + + -- Dave Beckett Mon, 23 Aug 2004 22:25:16 +0100 + +libcairo (0.1.23-1) unstable; urgency=low + + * New upstream release. Closes: 248705 + * Add PNG backend, require libpng12-dev + * Requires libpixman >= 0.1.1 + + -- Dave Beckett Sat, 29 May 2004 21:10:58 +0100 + +libcairo (0.1.18-1) unstable; urgency=low + + * New upstream release + * Remove xlib-surface-debian.patch, not needed for XFree86 4.3.0+ + + -- Dave Beckett Thu, 19 Feb 2004 23:08:25 +0000 + +libcairo (0.1.17-4) unstable; urgency=low + + * Initial version to debian archive. Closes: #205346 + + -- Dave Beckett Sun, 15 Feb 2004 21:45:47 +0000 + +libcairo (0.1.17-3) unstable; urgency=low + + * Setting me as the maintainer temporarily + + -- Eduard Bloch Sat, 14 Feb 2004 16:49:18 +0100 + +libcairo (0.1.17-2) unstable; urgency=low + + * Add patch/xlib-surface-debian.patch to restore this to working for X. + + -- Dave Beckett Sat, 24 Jan 2004 18:02:38 +0000 + +libcairo (0.1.17-1) unstable; urgency=low + + * New upstream release + * Replace libpixman/libic dependencies with libpixman + + -- Dave Beckett Tue, 16 Dec 2003 17:49:55 +0000 + +libcairo (0.1.16-1) unstable; urgency=low + + * New upstream release + * Added libxrender-dev (>=0.6.0) requirement to match configure.in + + -- Dave Beckett Mon, 8 Dec 2003 20:39:59 +0000 + +libcairo (0.1.13-1) unstable; urgency=low + + * New upstream release + * Remove patch for src/config.h - merged upstream. + * Return libfreetype6 minimum version to 2.1.0. + + -- Dave Beckett Fri, 21 Nov 2003 20:05:38 +0000 + +libcairo (0.1.12-3) unstable; urgency=low + + * Pull patch from CVS to allow building with newer freetype using the + new include via defines mechanism now enforced in freetype 2.1.6 + + -- Dave Beckett Tue, 18 Nov 2003 20:15:08 +0000 + +libcairo (0.1.12-2) unstable; urgency=low + + * Remove dependency on libxft-dev, replaced with libfreetype6-dev and + libfontconfig1-dev + + -- Dave Beckett Sat, 8 Nov 2003 18:44:19 +0000 + +libcairo (0.1.12-1) unstable; urgency=low + + * New upstream release + + -- Dave Beckett Fri, 7 Nov 2003 20:43:33 +0000 + +libcairo (0.1.11-1) unstable; urgency=low + + * New upstream release + + -- Dave Beckett Tue, 4 Nov 2003 15:10:14 +0000 + +libcairo (0.1.10-1) unstable; urgency=low + + * New upstream release + + -- Dave Beckett Tue, 4 Nov 2003 00:23:16 +0000 + +libcairo (0.1.9-2) unstable; urgency=low + + * Generate packages correctly named after the library major soname: + libcairo1, libcairo1-dev + + -- Dave Beckett Thu, 30 Oct 2003 23:16:43 +0000 + +libcairo (0.1.9-1) unstable; urgency=low + + * New upstream release. + * Removed dependency on automake, autoconf, libtool + + -- Dave Beckett Thu, 30 Oct 2003 21:37:25 +0000 + +libcairo (0.1.8-1) unstable; urgency=low + + * Initial package + + -- Dave Beckett Wed, 29 Oct 2003 23:20:26 +0000 + --- libcairo-1.4.10.orig/debian/copyright +++ libcairo-1.4.10/debian/copyright @@ -0,0 +1,533 @@ +This is the Debian package of the Cairo multi-platform 2D graphics library + +Packaged by Dave Beckett + +It was downloaded from http://cairographics.org/snapshots/ + +---------------------------------------------------------------------- + Copyright 1999 Tom Tromey + Copyright 2002, 2003 University of Southern California, Information + Sciences Institute (ISI) + Copyright 2000, 2002, 2004, 2005 Keith Packard + Copyright 2004 Calum Robinson + Copyright 2004 Richard D. Worth + Copyright 2004, 2005 Red Hat, Inc. + + Copyright 2004 David Reveman + Permission to use, copy, modify, distribute, and sell this software + and its documentation for any purpose is hereby granted without + fee, provided that the above copyright notice appear in all copies + and that both that copyright notice and this permission notice + appear in supporting documentation, and that the name of David + Reveman not be used in advertising or publicity pertaining to + distribution of the software without specific, written prior + permission. David Reveman makes no representations about the + suitability of this software for any purpose. It is provided "as + is" without express or implied warranty. + + DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS, IN NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, + INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER + RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR + IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + Author: David Reveman + +---------------------------------------------------------------------- + +Cairo is free software. + +Every source file in the implementation of cairo is available to be +redistributed and/or modified under the terms of either the GNU Lesser +General Public License (LPGL) version 2.1 or the Mozilla Public +License (MPL) version 1.1. Some files are available under more +liberal terms, but we believe that in all cases, each file may be used +under either the LGPL or the MPL. + +See the following files in this directory for the precise terms and +conditions of either license: + + COPYING-LGPL-2.1 + COPYING-MPL-1.1 + +Please see each file in the implementation for Copyright and licensing +information. + +---------------------------------------------------------------------- +On Debian systems, the complete text of the GNU General Lesser Public +License 2.1 can be found in /usr/share/common-licenses/LGPL-2.1 + +The Mozilla Public License 1.1 (COPYING-MPL-1.1 above) follows: + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + --- libcairo-1.4.10.orig/debian/libcairo2-doc.doc-base +++ libcairo-1.4.10/debian/libcairo2-doc.doc-base @@ -0,0 +1,11 @@ +Document: libcairo2-doc +Title: Cairo Reference Manual +Author: Cairo Project +Abstract: Cairo is a multi-platform library providing anti-aliased + vector-based rendering for multiple target backends. + This document covers programming using the Cairo library. +Section: graphics + +Format: HTML +Index: /usr/share/gtk-doc/html/cairo/index.html +Files: /usr/share/gtk-doc/html/cairo/*.html --- libcairo-1.4.10.orig/debian/libcairo-directfb2-udeb.install +++ libcairo-1.4.10/debian/libcairo-directfb2-udeb.install @@ -0,0 +1 @@ +debian/dist-directfb/usr/lib/libcairo-directfb/lib/libcairo.so.* /usr/lib --- libcairo-1.4.10.orig/debian/compat +++ libcairo-1.4.10/debian/compat @@ -0,0 +1 @@ +5 --- libcairo-1.4.10.orig/debian/watch +++ libcairo-1.4.10/debian/watch @@ -0,0 +1,2 @@ +version=2 +http://cairographics.org/releases/ cairo-([\d+\.]+|\d+)\.tar\.gz debian uupdate --- libcairo-1.4.10.orig/debian/patches/00list +++ libcairo-1.4.10/debian/patches/00list @@ -0,0 +1,3 @@ +02-cairo-1.4.8-lcd-filter-2.dpatch +90_from_git_fix_not_available_glyph_handling.dpatch +91_malloc-overflow-fixes.dpatch --- libcairo-1.4.10.orig/debian/patches/91_malloc-overflow-fixes.dpatch +++ libcairo-1.4.10/debian/patches/91_malloc-overflow-fixes.dpatch @@ -0,0 +1,1216 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 91_malloc-overflow-fixes.dpatch by Kees Cook +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: CVE-2007-5503 +## DP: http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=5c7d2d14d78e4dfb1ef6d2c40f0910f177e07360 +## DP: http://gitweb.freedesktop.org/?p=cairo;a=commitdiff;h=e49bcde27f88e21d5b8037a0089a226096f6514b + +@DPATCH@ +diff -urNad libcairo-1.4.10~/CODING_STYLE libcairo-1.4.10/CODING_STYLE +--- libcairo-1.4.10~/CODING_STYLE 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/CODING_STYLE 2007-12-10 09:04:53.000000000 -0800 +@@ -243,3 +243,28 @@ + this. If it's not available due to additional nesting above which + require some cleanup after the current block, then consider splitting + the current block into a new function before using goto. ++ ++Memory allocation ++----------------- ++ ++Because much of cairo's data consists of dynamically allocated arrays, ++it's very easy to introduce integer overflow issues whenever malloc() ++is called. Use the _cairo_malloc2(), _cairo_malloc3(), and ++_cairo_malloc2_add1 macros to avoid these cases; these macros check ++for overflow and will return NULL in that case. ++ ++ malloc (n * size) => _cairo_malloc_ab (n, size) ++ e.g. malloc (num_elts * sizeof(some_type)) => ++ _cairo_malloc2 (num_elts, sizeof(some_type)) ++ ++ malloc (a * b * size) => _cairo_malloc_abc (a, b, size) ++ e.g. malloc (width * height * 4) => ++ _cairo_malloc3 (width, height, 4) ++ ++ malloc (n * size + k) => _cairo_malloc_ab_plus_c (n, size, k) ++ e.g. malloc (num * sizeof(entry) + sizeof(header)) => ++ _cairo_malloc2k (num, sizeof(entry), sizeof(header)) ++ ++In general, be wary of performing any arithmetic operations in an ++argument to malloc. You should explicitly check for integer overflow ++yourself in any more complex situations. +\ No newline at end of file +diff -urNad libcairo-1.4.10~/pixman/src/fbcompose.c libcairo-1.4.10/pixman/src/fbcompose.c +--- libcairo-1.4.10~/pixman/src/fbcompose.c 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/pixman/src/fbcompose.c 2007-12-10 09:04:53.000000000 -0800 +@@ -3883,7 +3883,7 @@ + } + + if (width > SCANLINE_BUFFER_LENGTH) +- alpha_buffer = (CARD32 *) malloc(width*sizeof(CARD32)); ++ alpha_buffer = (CARD32 *) _pixman_malloc_ab (width, sizeof(CARD32)); + + fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits); + fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x, +@@ -4286,7 +4286,7 @@ + compose_data.mask = pMask; + compose_data.dest = pDst; + if (width > SCANLINE_BUFFER_LENGTH) +- scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); ++ scanline_buffer = (CARD32 *) _pixman_malloc_abc (width, 3, sizeof(CARD32)); + + n = pixman_region_num_rects (®ion); + pbox = pixman_region_rects (®ion); +diff -urNad libcairo-1.4.10~/pixman/src/icimage.c libcairo-1.4.10/pixman/src/icimage.c +--- libcairo-1.4.10~/pixman/src/icimage.c 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/pixman/src/icimage.c 2007-12-10 09:04:53.000000000 -0800 +@@ -215,8 +215,8 @@ + if (!image) + return NULL; + +- linear = malloc (sizeof (pixman_linear_gradient_image_t) + +- sizeof (pixman_gradient_stop_t) * n_stops); ++ linear = _pixman_malloc_ab_plus_c (n_stops, sizeof (pixman_gradient_stop_t), ++ sizeof (pixman_linear_gradient_image_t)); + if (!linear) + { + free (image); +@@ -259,8 +259,8 @@ + if (!image) + return NULL; + +- radial = malloc (sizeof (pixman_radial_gradient_image_t) + +- sizeof (pixman_gradient_stop_t) * n_stops); ++ radial = _pixman_malloc_ab_plus_c (n_stops, sizeof (pixman_gradient_stop_t), ++ sizeof (pixman_radial_gradient_image_t)); + if (!radial) + { + free (image); +diff -urNad libcairo-1.4.10~/pixman/src/pixman.h libcairo-1.4.10/pixman/src/pixman.h +--- libcairo-1.4.10~/pixman/src/pixman.h 2007-06-27 11:00:55.000000000 -0700 ++++ libcairo-1.4.10/pixman/src/pixman.h 2007-12-10 09:04:53.000000000 -0800 +@@ -89,6 +89,13 @@ + typedef unsigned __int32 uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; ++ ++# ifndef UINT16_MAX ++# define UINT16_MAX (65535) ++# endif ++# ifndef UINT32_MAX ++# define UINT32_MAX (0xffffffffU) ++# endif + #else + #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.) + #endif +diff -urNad libcairo-1.4.10~/pixman/src/pixmanint.h libcairo-1.4.10/pixman/src/pixmanint.h +--- libcairo-1.4.10~/pixman/src/pixmanint.h 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/pixman/src/pixmanint.h 2007-12-10 09:04:53.000000000 -0800 +@@ -1073,4 +1073,21 @@ + (*((a)+2) = (CARD8) ((v) >> 16)))) + #endif + ++ ++/* Allocation helpers */ ++ ++#define _pixman_malloc_ab(n, size) \ ++ ((unsigned) (n) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ malloc((unsigned) (n) * (unsigned) (size))) ++ ++#define _pixman_malloc_abc(a, b, size) \ ++ ((unsigned) (a) >= INT32_MAX / (unsigned) (b) ? NULL : \ ++ (unsigned) ((a)*(b)) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ malloc((unsigned) (a) * (unsigned) (b) * (unsigned) size)) ++ ++#define _pixman_malloc_ab_plus_c(n, size, k) \ ++ ((unsigned) (n) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ (unsigned) (k) >= INT32_MAX - (unsigned) (n) * (unsigned) (size) ? NULL : \ ++ malloc((unsigned) (n) * (unsigned) (size) + (unsigned) (k))) ++ + #endif /* _PIXMANINT_H_ */ +diff -urNad libcairo-1.4.10~/pixman/src/pixregion.c libcairo-1.4.10/pixman/src/pixregion.c +--- libcairo-1.4.10~/pixman/src/pixregion.c 2007-06-27 11:00:55.000000000 -0700 ++++ libcairo-1.4.10/pixman/src/pixregion.c 2007-12-10 09:04:53.000000000 -0800 +@@ -148,7 +148,31 @@ + ((r1)->y1 <= (r2)->y1) && \ + ((r1)->y2 >= (r2)->y2) ) + +-#define allocData(n) malloc(PIXREGION_SZOF(n)) ++static size_t ++PIXREGION_SZOF(size_t n) ++{ ++ size_t size = n * sizeof(pixman_box16_t); ++ if (n > UINT32_MAX / sizeof(pixman_box16_t)) ++ return 0; ++ ++ if (sizeof(pixman_region16_data_t) > UINT32_MAX - size) ++ return 0; ++ ++ return size + sizeof(pixman_region16_data_t); ++} ++ ++static void ++allocData(size_t n, void **data) ++{ ++ size_t sz = PIXREGION_SZOF(n); ++ if (!sz) { ++ *data = NULL; ++ return; ++ } ++ ++ *data = malloc(sz); ++} ++ + #define freeData(reg) if ((reg)->data && (reg)->data->size) free((reg)->data) + + #define RECTALLOC_BAIL(pReg,n,bail) \ +@@ -185,7 +209,10 @@ + if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ + { \ + pixman_region16_data_t * NewData; \ +- NewData = (pixman_region16_data_t *)realloc((reg)->data, PIXREGION_SZOF(numRects)); \ ++ size_t data_size = PIXREGION_SZOF(numRects); \ ++ if (!data_size) \ ++ goto bail; \ ++ NewData = (pixman_region16_data_t *)realloc((reg)->data, data_size); \ + if (NewData) \ + { \ + NewData->size = (numRects); \ +@@ -372,11 +399,12 @@ + pixman_rect_alloc(pixman_region16_t * region, int n) + { + pixman_region16_data_t *data; ++ size_t data_size; + + if (!region->data) + { + n++; +- region->data = allocData(n); ++ allocData(n, (void **) ®ion->data); + if (!region->data) + return pixman_break (region); + region->data->numRects = 1; +@@ -384,7 +412,7 @@ + } + else if (!region->data->size) + { +- region->data = allocData(n); ++ allocData(n, (void **) ®ion->data); + if (!region->data) + return pixman_break (region); + region->data->numRects = 0; +@@ -398,7 +426,10 @@ + n = 250; + } + n += region->data->numRects; +- data = (pixman_region16_data_t *)realloc(region->data, PIXREGION_SZOF(n)); ++ data_size = PIXREGION_SZOF(n); ++ if (!data_size) ++ return pixman_break (region); ++ data = (pixman_region16_data_t *)realloc(region->data, data_size); + if (!data) + return pixman_break (region); + region->data = data; +@@ -424,7 +455,7 @@ + if (!dst->data || (dst->data->size < src->data->numRects)) + { + freeData(dst); +- dst->data = allocData(src->data->numRects); ++ allocData(src->data->numRects, (void **) &dst->data); + if (!dst->data) + return pixman_break (dst); + dst->data->size = src->data->numRects; +@@ -835,8 +866,10 @@ + AppendRegions(newReg, r2BandEnd, r2End); + } + +- if (oldData) ++ if (oldData) { + free(oldData); ++ oldData = NULL; ++ } + + if (!(numRects = newReg->data->numRects)) + { +@@ -1493,7 +1526,7 @@ + + /* Set up the first region to be the first rectangle in badreg */ + /* Note that step 2 code will never overflow the ri[0].reg rects array */ +- ri = (RegionInfo *) malloc(4 * sizeof(RegionInfo)); ++ ri = (RegionInfo *) _pixman_malloc_ab(4, sizeof(RegionInfo)); + if (!ri) + return pixman_break (badreg); + sizeRI = 4; +@@ -1555,9 +1588,13 @@ + /* Uh-oh. No regions were appropriate. Create a new one. */ + if (sizeRI == numRI) + { ++ size_t data_size; + /* Oops, allocate space for new region information */ + sizeRI <<= 1; +- rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo)); ++ data_size = sizeRI * sizeof(RegionInfo); ++ if (data_size / sizeRI != sizeof(RegionInfo)) ++ goto bail; ++ rit = (RegionInfo *) realloc(ri, data_size); + if (!rit) + goto bail; + ri = rit; +@@ -1659,7 +1696,7 @@ + } + return region; + } +- pData = allocData(nrects); ++ allocData(nrects, &pData); + if (!pData) + { + pixman_break (region); +@@ -2167,7 +2204,7 @@ + if (!dst->data || (dst->data->size < src->data->numRects)) + { + freeData(dst); +- dst->data = allocData(src->data->numRects); ++ allocData(src->data->numRects, &dst->data); + if (!dst->data) + return pixman_break (dst); + } +diff -urNad libcairo-1.4.10~/pixman/src/pixregionint.h libcairo-1.4.10/pixman/src/pixregionint.h +--- libcairo-1.4.10~/pixman/src/pixregionint.h 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/pixman/src/pixregionint.h 2007-12-10 09:04:53.000000000 -0800 +@@ -70,6 +70,5 @@ + #define PIXREGION_BOX(reg,i) (&PIXREGION_BOXPTR(reg)[i]) + #define PIXREGION_TOP(reg) PIXREGION_BOX(reg, (reg)->data->numRects) + #define PIXREGION_END(reg) PIXREGION_BOX(reg, (reg)->data->numRects - 1) +-#define PIXREGION_SZOF(n) (sizeof(pixman_region16_data_t) + ((n) * sizeof(pixman_box16_t))) + + #endif /* _PIXREGIONINT_H_ */ +diff -urNad libcairo-1.4.10~/src/cairo-array.c libcairo-1.4.10/src/cairo-array.c +--- libcairo-1.4.10~/src/cairo-array.c 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-array.c 2007-12-10 09:04:53.000000000 -0800 +@@ -138,8 +138,8 @@ + } + + array->size = new_size; +- new_elements = realloc (*array->elements, +- array->size * array->element_size); ++ new_elements = _cairo_realloc_ab (*array->elements, ++ array->size, array->element_size); + + if (new_elements == NULL) { + array->size = old_size; +diff -urNad libcairo-1.4.10~/src/cairo-atsui-font.c libcairo-1.4.10/src/cairo-atsui-font.c +--- libcairo-1.4.10~/src/cairo-atsui-font.c 2007-06-27 11:00:55.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-atsui-font.c 2007-12-10 09:04:53.000000000 -0800 +@@ -809,7 +809,7 @@ + + *num_glyphs = glyphCount - 1; + *glyphs = +- (cairo_glyph_t *) malloc(*num_glyphs * (sizeof (cairo_glyph_t))); ++ (cairo_glyph_t *) _cairo_malloc_ab(*num_glyphs, sizeof (cairo_glyph_t)); + if (*glyphs == NULL) { + return CAIRO_STATUS_NO_MEMORY; + } +diff -urNad libcairo-1.4.10~/src/cairo-bentley-ottmann.c libcairo-1.4.10/src/cairo-bentley-ottmann.c +--- libcairo-1.4.10~/src/cairo-bentley-ottmann.c 2007-06-07 10:45:39.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-bentley-ottmann.c 2007-12-10 09:04:53.000000000 -0800 +@@ -754,7 +754,7 @@ + * or stop events, so this allocation is safe. XXX: make the + * event type a union so it doesn't always contain the skip + * elt? */ +- events = malloc (num_events * (sizeof (cairo_bo_event_t) + sizeof(cairo_bo_event_t*))); ++ events = _cairo_malloc_ab (num_events, sizeof (cairo_bo_event_t) + sizeof(cairo_bo_event_t*)); + if (events == NULL) + return CAIRO_STATUS_NO_MEMORY; + +@@ -1436,7 +1436,7 @@ + if (polygon->num_edges < ARRAY_LENGTH (stack_edges)) { + edges = stack_edges; + } else { +- edges = malloc (polygon->num_edges * sizeof (cairo_bo_edge_t)); ++ edges = _cairo_malloc_ab (polygon->num_edges, sizeof (cairo_bo_edge_t)); + if (edges == NULL) + return CAIRO_STATUS_NO_MEMORY; + } +@@ -1757,7 +1757,7 @@ + while (intersections) { + int num_edges = _cairo_array_num_elements (&intersected_edges); + passes++; +- edges = malloc (num_edges * sizeof (cairo_bo_edge_t)); ++ edges = _cairo_malloc_ab (num_edges, sizeof (cairo_bo_edge_t)); + assert (edges != NULL); + memcpy (edges, _cairo_array_index (&intersected_edges, 0), num_edges * sizeof (cairo_bo_edge_t)); + _cairo_array_fini (&intersected_edges); +diff -urNad libcairo-1.4.10~/src/cairo-beos-surface.cpp libcairo-1.4.10/src/cairo-beos-surface.cpp +--- libcairo-1.4.10~/src/cairo-beos-surface.cpp 2007-04-27 10:02:33.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-beos-surface.cpp 2007-12-10 09:04:53.000000000 -0800 +@@ -259,7 +259,7 @@ + int height, + int stride) + { +- unsigned char* retdata = reinterpret_cast(malloc(stride * height)); ++ unsigned char* retdata = reinterpret_cast(_cairo_malloc_ab(height, stride)); + if (!retdata) + return NULL; + +@@ -322,7 +322,7 @@ + bitmap->BytesPerRow()); + } else { + premultiplied = reinterpret_cast( +- malloc(bitmap->BytesPerRow() * height)); ++ _cairo_malloc_ab(bitmap->BytesPerRow(), height)); + if (premultiplied) + memcpy(premultiplied, bits, bitmap->BytesPerRow() * height); + } +diff -urNad libcairo-1.4.10~/src/cairo-clip.c libcairo-1.4.10/src/cairo-clip.c +--- libcairo-1.4.10~/src/cairo-clip.c 2007-05-16 06:52:56.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-clip.c 2007-12-10 09:04:53.000000000 -0800 +@@ -634,9 +634,13 @@ + return (cairo_rectangle_list_t*) &_cairo_rectangles_not_representable; + + n_boxes = clip->has_region ? pixman_region_num_rects (&clip->region) : 1; +- rectangles = malloc (sizeof (cairo_rectangle_t)*n_boxes); +- if (rectangles == NULL) +- return (cairo_rectangle_list_t*) &_cairo_rectangles_nil; ++ if (n_boxes > 0) { ++ rectangles = _cairo_malloc_ab (n_boxes, sizeof (cairo_rectangle_t)); ++ if (rectangles == NULL) ++ return (cairo_rectangle_list_t*) &_cairo_rectangles_nil; ++ } else { ++ rectangles = NULL; ++ } + + if (clip->has_region) { + pixman_box16_t *boxes; +diff -urNad libcairo-1.4.10~/src/cairo-directfb-surface.c libcairo-1.4.10/src/cairo-directfb-surface.c +--- libcairo-1.4.10~/src/cairo-directfb-surface.c 2007-06-27 11:00:55.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-directfb-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1113,7 +1113,7 @@ + if( surface->clips ) + free (surface->clips); + +- surface->clips = malloc (n_boxes * sizeof(DFBRegion)); ++ surface->clips = _cairo_malloc_ab (n_boxes, sizeof(DFBRegion)); + if (!surface->clips) { + surface->n_clips = 0; + return CAIRO_STATUS_NO_MEMORY; +diff -urNad libcairo-1.4.10~/src/cairo-ft-font.c libcairo-1.4.10/src/cairo-ft-font.c +--- libcairo-1.4.10~/src/cairo-ft-font.c 2007-12-10 09:04:52.000000000 -0800 ++++ libcairo-1.4.10/src/cairo-ft-font.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1023,7 +1023,7 @@ + data = bitmap->buffer; + assert (stride == bitmap->pitch); + } else { +- data = malloc (stride * height); ++ data = _cairo_malloc_ab (height, stride); + if (!data) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY; +@@ -1070,7 +1070,7 @@ + if (own_buffer) { + data = bitmap->buffer; + } else { +- data = malloc (stride * height); ++ data = _cairo_malloc_ab (height, stride); + if (!data) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY; +diff -urNad libcairo-1.4.10~/src/cairo-glitz-surface.c libcairo-1.4.10/src/cairo-glitz-surface.c +--- libcairo-1.4.10~/src/cairo-glitz-surface.c 2007-05-09 06:37:39.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-glitz-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -197,7 +197,7 @@ + pf.bytes_per_line = (((width * format.bpp) / 8) + 3) & -4; + pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN; + +- pixels = malloc (height * pf.bytes_per_line); ++ pixels = _cairo_malloc_ab (height, pf.bytes_per_line); + if (!pixels) + return CAIRO_STATUS_NO_MEMORY; + +@@ -627,8 +627,22 @@ + + n_params = gradient->n_stops * 3 + n_base_params; + +- data = malloc (sizeof (glitz_fixed16_16_t) * n_params + +- sizeof (unsigned int) * gradient->n_stops); ++ /* check for int overflow */ ++ { ++ int size1, size2; ++ if (n_params >= INT32_MAX / sizeof (glitz_fixed16_16_t) || ++ gradient->n_stops >= INT32_MAX / sizeof (unsigned int)) ++ return CAIRO_STATUS_NO_MEMORY; ++ ++ size1 = n_params * sizeof (glitz_fixed16_16_t); ++ size2 = gradient->n_stops * sizeof (unsigned int); ++ ++ if (size1 >= INT32_MAX - size2) ++ return CAIRO_STATUS_NO_MEMORY; ++ ++ data = malloc (size1 + size2); ++ } ++ + if (!data) + return CAIRO_STATUS_NO_MEMORY; + +@@ -1992,9 +2006,19 @@ + if (num_glyphs > N_STACK_BUF) + { + char *data; ++ int size1, size2; + +- data = malloc (num_glyphs * sizeof (void *) + +- num_glyphs * sizeof (glitz_float_t) * 16); ++ if (num_glyphs >= INT32_MAX / sizeof(void*) || ++ num_glyphs >= INT32_MAX / sizeof(glitz_float_t) || ++ (num_glyphs * sizeof(glitz_float_t)) >= INT32_MAX / 16) ++ goto FAIL1; ++ ++ size1 = num_glyphs * sizeof(void *); ++ size2 = num_glyphs * sizeof(glitz_float_t) * 16; ++ if (size1 >= INT32_MAX - size2) ++ goto FAIL1; ++ ++ data = malloc (size1 + size2); + if (!data) + goto FAIL1; + +diff -urNad libcairo-1.4.10~/src/cairo-gstate.c libcairo-1.4.10/src/cairo-gstate.c +--- libcairo-1.4.10~/src/cairo-gstate.c 2007-06-07 10:44:01.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-gstate.c 2007-12-10 09:04:53.000000000 -0800 +@@ -530,7 +530,7 @@ + return CAIRO_STATUS_SUCCESS; + } + +- gstate->stroke_style.dash = malloc (gstate->stroke_style.num_dashes * sizeof (double)); ++ gstate->stroke_style.dash = _cairo_malloc_ab (gstate->stroke_style.num_dashes, sizeof (double)); + if (gstate->stroke_style.dash == NULL) { + gstate->stroke_style.num_dashes = 0; + return CAIRO_STATUS_NO_MEMORY; +@@ -1570,7 +1570,7 @@ + if (num_glyphs <= STACK_GLYPHS_LEN) { + transformed_glyphs = stack_transformed_glyphs; + } else { +- transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t)); ++ transformed_glyphs = _cairo_malloc_ab (num_glyphs, sizeof(cairo_glyph_t)); + if (transformed_glyphs == NULL) + return CAIRO_STATUS_NO_MEMORY; + } +@@ -1615,7 +1615,7 @@ + if (num_glyphs < STACK_GLYPHS_LEN) + transformed_glyphs = stack_transformed_glyphs; + else +- transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t)); ++ transformed_glyphs = _cairo_malloc_ab (num_glyphs, sizeof(cairo_glyph_t)); + if (transformed_glyphs == NULL) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-hull.c libcairo-1.4.10/src/cairo-hull.c +--- libcairo-1.4.10~/src/cairo-hull.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-hull.c 2007-12-10 09:04:53.000000000 -0800 +@@ -62,7 +62,7 @@ + *extremum = vertices[0].point; + vertices[0].point = tmp; + +- hull = malloc (num_vertices * sizeof (cairo_hull_t)); ++ hull = _cairo_malloc_ab (num_vertices, sizeof (cairo_hull_t)); + if (hull == NULL) + return NULL; + +diff -urNad libcairo-1.4.10~/src/cairo-lzw.c libcairo-1.4.10/src/cairo-lzw.c +--- libcairo-1.4.10~/src/cairo-lzw.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-lzw.c 2007-12-10 09:04:53.000000000 -0800 +@@ -93,7 +93,11 @@ + if (buf->status) + return buf->status; + +- new_data = realloc (buf->data, new_size); ++ new_data = NULL; ++ /* check for integer overflow */ ++ if (new_size / 2 == buf->data_size) ++ new_data = realloc (buf->data, new_size); ++ + if (new_data == NULL) { + free (buf->data); + buf->data_size = 0; +diff -urNad libcairo-1.4.10~/src/cairo-malloc-private.h libcairo-1.4.10/src/cairo-malloc-private.h +--- libcairo-1.4.10~/src/cairo-malloc-private.h 1969-12-31 16:00:00.000000000 -0800 ++++ libcairo-1.4.10/src/cairo-malloc-private.h 2007-12-10 09:08:43.000000000 -0800 +@@ -0,0 +1,141 @@ ++/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */ ++/* Cairo - a vector graphics library with display and print output ++ * ++ * Copyright © 2007 Mozilla Corporation ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it either under the terms of the GNU Lesser General Public ++ * License version 2.1 as published by the Free Software Foundation ++ * (the "LGPL") or, at your option, under the terms of the Mozilla ++ * Public License Version 1.1 (the "MPL"). If you do not alter this ++ * notice, a recipient may use your version of this file under either ++ * the MPL or the LGPL. ++ * ++ * You should have received a copy of the LGPL along with this library ++ * in the file COPYING-LGPL-2.1; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ * You should have received a copy of the MPL along with this library ++ * in the file COPYING-MPL-1.1 ++ * ++ * The contents of this file are subject to the Mozilla Public License ++ * Version 1.1 (the "License"); you may not use this file except in ++ * compliance with the License. You may obtain a copy of the License at ++ * http://www.mozilla.org/MPL/ ++ * ++ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY ++ * OF ANY KIND, either express or implied. See the LGPL or the MPL for ++ * the specific language governing rights and limitations. ++ * ++ * The Original Code is the cairo graphics library. ++ * ++ * The Initial Developer of the Original Code is Mozilla Corporation ++ * ++ * Contributor(s): ++ * Vladimir Vukicevic ++ */ ++ ++#ifndef CAIRO_MALLOC_PRIVATE_H ++#define CAIRO_MALLOC_PRIVATE_H ++ ++#include "cairo-wideint-private.h" ++ ++/** ++ * _cairo_malloc: ++ * @size: size in bytes ++ * ++ * Allocate @size memory using malloc(). ++ * The memory should be freed using free(). ++ * malloc is skipped, if 0 bytes are requested, and %NULL will be returned. ++ * ++ * Return value: A pointer to the newly allocated memory, or %NULL in ++ * case of malloc() failure or size is 0. ++ */ ++ ++#define _cairo_malloc(size) \ ++ ((size) ? malloc((unsigned) (size)) : NULL) ++ ++/** ++ * _cairo_malloc_ab: ++ * @a: number of elements to allocate ++ * @size: size of each element ++ * ++ * Allocates @a*@size memory using _cairo_malloc(), taking care to not ++ * overflow when doing the multiplication. Behaves much like ++ * calloc(), except that the returned memory is not set to zero. ++ * The memory should be freed using free(). ++ * ++ * @size should be a constant so that the compiler can optimize ++ * out a constant division. ++ * ++ * Return value: A pointer to the newly allocated memory, or %NULL in ++ * case of malloc() failure or overflow. ++ */ ++ ++#define _cairo_malloc_ab(a, size) \ ++ ((size) && (unsigned) (a) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ _cairo_malloc((unsigned) (a) * (unsigned) (size))) ++ ++/** ++ * _cairo_realloc_ab: ++ * @ptr: original pointer to block of memory to be resized ++ * @a: number of elements to allocate ++ * @size: size of each element ++ * ++ * Reallocates @ptr a block of @n*@size memory using realloc(), taking ++ * care to not overflow when doing the multiplication. The memory ++ * should be freed using free(). ++ * ++ * @size should be a constant so that the compiler can optimize ++ * out a constant division. ++ * ++ * Return value: A pointer to the newly allocated memory, or %NULL in ++ * case of realloc() failure or overflow (whereupon the original block ++ * of memory * is left untouched). ++ */ ++ ++#define _cairo_realloc_ab(ptr, a, size) \ ++ ((size) && (unsigned) (a) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ realloc(ptr, (unsigned) (a) * (unsigned) (size))) ++ ++/** ++ * _cairo_malloc_abc: ++ * @a: first factor of number of elements to allocate ++ * @b: second factor of number of elements to allocate ++ * @size: size of each element ++ * ++ * Allocates @a*@b*@size memory using _cairo_malloc(), taking care to not ++ * overflow when doing the multiplication. Behaves like ++ * _cairo_malloc_ab(). The memory should be freed using free(). ++ * ++ * @size should be a constant so that the compiler can optimize ++ * out a constant division. ++ * ++ * Return value: A pointer to the newly allocated memory, or %NULL in ++ * case of malloc() failure or overflow. ++ */ ++ ++#define _cairo_malloc_abc(a, b, size) \ ++ ((b) && (unsigned) (a) >= INT32_MAX / (unsigned) (b) ? NULL : \ ++ (size) && (unsigned) ((a)*(b)) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ _cairo_malloc((unsigned) (a) * (unsigned) (b) * (unsigned) (size))) ++ ++/** ++ * _cairo_malloc_ab_plus_c: ++ * @a: number of elements to allocate ++ * @size: size of each element ++ * @k: additional size to allocate ++ * ++ * Allocates @a*@ksize+@k memory using _cairo_malloc(), taking care to not ++ * overflow when doing the arithmetic. Behaves like ++ * _cairo_malloc_ab(). The memory should be freed using free(). ++ * ++ * Return value: A pointer to the newly allocated memory, or %NULL in ++ * case of malloc() failure or overflow. ++ */ ++ ++#define _cairo_malloc_ab_plus_c(n, size, k) \ ++ ((size) && (unsigned) (n) >= INT32_MAX / (unsigned) (size) ? NULL : \ ++ (unsigned) (k) >= INT32_MAX - (unsigned) (n) * (unsigned) (size) ? NULL : \ ++ _cairo_malloc((unsigned) (n) * (unsigned) (size) + (unsigned) (k))) ++ ++#endif /* CAIRO_MALLOC_PRIVATE_H */ +diff -urNad libcairo-1.4.10~/src/cairo-meta-surface.c libcairo-1.4.10/src/cairo-meta-surface.c +--- libcairo-1.4.10~/src/cairo-meta-surface.c 2007-05-16 06:52:56.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-meta-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -439,7 +439,7 @@ + if (status) + goto CLEANUP_COMMAND; + +- command->glyphs = malloc (sizeof (cairo_glyph_t) * num_glyphs); ++ command->glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t)); + if (command->glyphs == NULL) { + status = CAIRO_STATUS_NO_MEMORY; + goto CLEANUP_SOURCE; +@@ -735,7 +735,7 @@ + int i, num_glyphs = command->show_glyphs.num_glyphs; + + if (has_device_transform) { +- dev_glyphs = malloc (sizeof (cairo_glyph_t) * num_glyphs); ++ dev_glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t)); + if (dev_glyphs == NULL) { + status = CAIRO_STATUS_NO_MEMORY; + break; +diff -urNad libcairo-1.4.10~/src/cairo-os2-surface.c libcairo-1.4.10/src/cairo-os2-surface.c +--- libcairo-1.4.10~/src/cairo-os2-surface.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-os2-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -296,8 +296,9 @@ + ULONG ulPixels; + + /* allocate temporary pixel buffer */ +- pchPixBuf = (unsigned char *) malloc (3 * surface->bitmap_info.cx * +- surface->bitmap_info.cy); ++ pchPixBuf = (unsigned char *) _cairo_malloc_abc (surface->bitmap_info.cy, ++ surface->bitmap_info.cx, ++ 3); + pchPixSource = surface->pixels; /* start at beginning of pixel buffer */ + pBufStart = pchPixBuf; /* remember beginning of the new pixel buffer */ + +@@ -713,7 +714,7 @@ + local_os2_surface->bitmap_info.cBitCount = 32; + + /* Allocate memory for pixels */ +- local_os2_surface->pixels = (unsigned char *) malloc (width * height * 4); ++ local_os2_surface->pixels = (unsigned char *) _cairo_malloc_abc (height, width, 4); + if (!(local_os2_surface->pixels)) { + /* Not enough memory for the pixels! */ + DosCloseEventSem (local_os2_surface->hev_pixel_array_came_back); +@@ -783,7 +784,7 @@ + } + + /* Allocate memory for new stuffs */ +- pchNewPixels = (unsigned char *) malloc (new_width * new_height * 4); ++ pchNewPixels = (unsigned char *) _cairo_malloc_abc (new_height, new_width, 4); + if (!pchNewPixels) { + /* Not enough memory for the pixels! + * Everything remains the same! +diff -urNad libcairo-1.4.10~/src/cairo-path-stroke.c libcairo-1.4.10/src/cairo-path-stroke.c +--- libcairo-1.4.10~/src/cairo-path-stroke.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-path-stroke.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1076,7 +1076,8 @@ + /* Common case is one rectangle of exactly 4 segments. */ + if (new_size == 0) + new_size = 4; +- new_segments = realloc (stroker->segments, new_size * sizeof (cairo_line_t)); ++ new_segments = _cairo_realloc_ab (stroker->segments, ++ new_size, sizeof (cairo_line_t)); + if (new_segments == NULL) + return CAIRO_STATUS_NO_MEMORY; + stroker->segments_size = new_size; +diff -urNad libcairo-1.4.10~/src/cairo-path.c libcairo-1.4.10/src/cairo-path.c +--- libcairo-1.4.10~/src/cairo-path.c 2007-05-18 13:15:40.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-path.c 2007-12-10 09:04:53.000000000 -0800 +@@ -381,7 +381,7 @@ + return (cairo_path_t*) &_cairo_path_nil; + } + +- path->data = malloc (path->num_data * sizeof (cairo_path_data_t)); ++ path->data = _cairo_malloc_ab (path->num_data, sizeof (cairo_path_data_t)); + if (path->data == NULL) { + free (path); + return (cairo_path_t*) &_cairo_path_nil; +diff -urNad libcairo-1.4.10~/src/cairo-pattern.c libcairo-1.4.10/src/cairo-pattern.c +--- libcairo-1.4.10~/src/cairo-pattern.c 2007-06-07 10:44:01.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-pattern.c 2007-12-10 09:04:53.000000000 -0800 +@@ -133,8 +133,8 @@ + pattern->stops = pattern->stops_embedded; + else if (other->stops) + { +- pattern->stops = malloc (other->stops_size * +- sizeof (pixman_gradient_stop_t)); ++ pattern->stops = _cairo_malloc_ab (other->stops_size, ++ sizeof (pixman_gradient_stop_t)); + if (pattern->stops == NULL) { + pattern->stops_size = 0; + pattern->n_stops = 0; +@@ -757,11 +757,13 @@ + assert (pattern->n_stops <= pattern->stops_size); + + if (pattern->stops == pattern->stops_embedded) { +- new_stops = malloc (new_size * sizeof (pixman_gradient_stop_t)); ++ new_stops = _cairo_malloc_ab (new_size, sizeof (pixman_gradient_stop_t)); + if (new_stops) + memcpy (new_stops, pattern->stops, old_size * sizeof (pixman_gradient_stop_t)); + } else { +- new_stops = realloc (pattern->stops, new_size * sizeof (pixman_gradient_stop_t)); ++ new_stops = _cairo_realloc_ab (pattern->stops, ++ new_size, ++ sizeof (pixman_gradient_stop_t)); + } + + if (new_stops == NULL) { +diff -urNad libcairo-1.4.10~/src/cairo-pdf-surface.c libcairo-1.4.10/src/cairo-pdf-surface.c +--- libcairo-1.4.10~/src/cairo-pdf-surface.c 2007-05-18 13:15:40.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-pdf-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1262,7 +1262,7 @@ + color_function->id = 0; + alpha_function->id = 0; + +- allstops = malloc ((pattern->n_stops + 2) * sizeof (cairo_pdf_color_stop_t)); ++ allstops = _cairo_malloc_ab ((pattern->n_stops + 2), sizeof (cairo_pdf_color_stop_t)); + if (allstops == NULL) + return CAIRO_STATUS_NO_MEMORY; + +@@ -2726,13 +2726,13 @@ + cairo_box_t font_bbox = {{0,0},{0,0}}; + cairo_box_t bbox = {{0,0},{0,0}}; + +- glyphs = malloc (font_subset->num_glyphs * sizeof (cairo_pdf_resource_t)); ++ glyphs = _cairo_malloc_ab (font_subset->num_glyphs, sizeof (cairo_pdf_resource_t)); + if (glyphs == NULL) { + _cairo_surface_set_error (&surface->base, CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY; + } + +- widths = malloc (font_subset->num_glyphs * sizeof (double)); ++ widths = _cairo_malloc_ab (font_subset->num_glyphs, sizeof (double)); + if (widths == NULL) { + free (glyphs); + _cairo_surface_set_error (&surface->base, CAIRO_STATUS_NO_MEMORY); +diff -urNad libcairo-1.4.10~/src/cairo-pen.c libcairo-1.4.10/src/cairo-pen.c +--- libcairo-1.4.10~/src/cairo-pen.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-pen.c 2007-12-10 09:04:53.000000000 -0800 +@@ -78,7 +78,7 @@ + radius, + ctm); + +- pen->vertices = malloc (pen->num_vertices * sizeof (cairo_pen_vertex_t)); ++ pen->vertices = _cairo_malloc_ab (pen->num_vertices, sizeof (cairo_pen_vertex_t)); + if (pen->vertices == NULL) { + return CAIRO_STATUS_NO_MEMORY; + } +@@ -119,7 +119,7 @@ + *pen = *other; + + if (pen->num_vertices) { +- pen->vertices = malloc (pen->num_vertices * sizeof (cairo_pen_vertex_t)); ++ pen->vertices = _cairo_malloc_ab (pen->num_vertices, sizeof (cairo_pen_vertex_t)); + if (pen->vertices == NULL) { + return CAIRO_STATUS_NO_MEMORY; + } +@@ -138,7 +138,8 @@ + int i; + + num_vertices = pen->num_vertices + num_points; +- vertices = realloc (pen->vertices, num_vertices * sizeof (cairo_pen_vertex_t)); ++ vertices = _cairo_realloc_ab (pen->vertices, ++ num_vertices, sizeof (cairo_pen_vertex_t)); + if (vertices == NULL) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-png.c libcairo-1.4.10/src/cairo-png.c +--- libcairo-1.4.10~/src/cairo-png.c 2007-06-07 10:45:39.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-png.c 2007-12-10 09:04:53.000000000 -0800 +@@ -128,7 +128,7 @@ + else if (status != CAIRO_STATUS_SUCCESS) + return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; + +- rows = malloc (image->height * sizeof(png_byte*)); ++ rows = _cairo_malloc_ab (image->height, sizeof(png_byte*)); + if (rows == NULL) { + status = CAIRO_STATUS_NO_MEMORY; + goto BAIL1; +@@ -429,11 +429,11 @@ + png_read_update_info (png, info); + + pixel_size = 4; +- data = malloc (png_width * png_height * pixel_size); ++ data = _cairo_malloc_abc (png_height, png_width, pixel_size); + if (data == NULL) + goto BAIL; + +- row_pointers = malloc (png_height * sizeof(char *)); ++ row_pointers = _cairo_malloc_ab (png_height, sizeof(char *)); + if (row_pointers == NULL) + goto BAIL; + +diff -urNad libcairo-1.4.10~/src/cairo-polygon.c libcairo-1.4.10/src/cairo-polygon.c +--- libcairo-1.4.10~/src/cairo-polygon.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-polygon.c 2007-12-10 09:04:53.000000000 -0800 +@@ -93,11 +93,12 @@ + assert (polygon->num_edges <= polygon->edges_size); + + if (polygon->edges == polygon->edges_embedded) { +- new_edges = malloc (new_size * sizeof (cairo_edge_t)); ++ new_edges = _cairo_malloc_ab (new_size, sizeof (cairo_edge_t)); + if (new_edges) + memcpy (new_edges, polygon->edges, old_size * sizeof (cairo_edge_t)); + } else { +- new_edges = realloc (polygon->edges, new_size * sizeof (cairo_edge_t)); ++ new_edges = _cairo_realloc_ab (polygon->edges, ++ new_size, sizeof (cairo_edge_t)); + } + + if (new_edges == NULL) { +diff -urNad libcairo-1.4.10~/src/cairo-ps-surface.c libcairo-1.4.10/src/cairo-ps-surface.c +--- libcairo-1.4.10~/src/cairo-ps-surface.c 2007-06-07 10:44:01.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-ps-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -2037,7 +2037,7 @@ + * can modify some of the values. + */ + if (num_dashes % 2) { +- dash = malloc (2 * num_dashes * sizeof (double)); ++ dash = _cairo_malloc_abc (num_dashes, 2, sizeof (double)); + if (dash == NULL) + return CAIRO_STATUS_NO_MEMORY; + +@@ -2215,7 +2215,7 @@ + num_glyphs_unsigned = num_glyphs; + + _cairo_ps_surface_emit_pattern (surface, source); +- glyph_ids = malloc (num_glyphs_unsigned*sizeof (cairo_ps_glyph_id_t)); ++ glyph_ids = _cairo_malloc_ab (num_glyphs_unsigned, sizeof (cairo_ps_glyph_id_t)); + if (glyph_ids == NULL) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-quartz-surface.c libcairo-1.4.10/src/cairo-quartz-surface.c +--- libcairo-1.4.10~/src/cairo-quartz-surface.c 2007-06-27 11:00:55.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-quartz-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1255,7 +1255,7 @@ + float *fdash = sdash; + unsigned int k; + if (style->num_dashes > STATIC_DASH) +- fdash = malloc (sizeof(float)*style->num_dashes); ++ fdash = _cairo_malloc_ab (style->num_dashes, sizeof (float)); + + for (k = 0; k < style->num_dashes; k++) + fdash[k] = (float) style->dash[k]; +@@ -1394,8 +1394,8 @@ + CGContextSetFontSize (surface->cgContext, 1.0); + + if (num_glyphs > STATIC_BUF_SIZE) { +- cg_glyphs = (CGGlyph*) malloc(sizeof(CGGlyph) * num_glyphs); +- cg_advances = (CGSize*) malloc(sizeof(CGSize) * num_glyphs); ++ cg_glyphs = (CGGlyph*) _cairo_malloc_ab (num_glyphs, sizeof(CGGlyph)); ++ cg_advances = (CGSize*) _cairo_malloc_ab (num_glyphs, sizeof(CGSize)); + } + + xprev = glyphs[0].x; +@@ -1711,7 +1711,7 @@ + return (cairo_surface_t*) &_cairo_surface_nil; + } + +- imageData = malloc (height * stride); ++ imageData = _cairo_malloc_ab (height, stride); + if (!imageData) { + CGColorSpaceRelease (cgColorspace); + _cairo_error (CAIRO_STATUS_NO_MEMORY); +diff -urNad libcairo-1.4.10~/src/cairo-scaled-font-subsets.c libcairo-1.4.10/src/cairo-scaled-font-subsets.c +--- libcairo-1.4.10~/src/cairo-scaled-font-subsets.c 2007-06-07 10:44:01.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-scaled-font-subsets.c 2007-12-10 09:04:53.000000000 -0800 +@@ -390,7 +390,7 @@ + subset.num_glyphs = collection->num_glyphs; + /* No need to check for out of memory here. If to_unicode is NULL, the PDF + * surface does not emit an ToUnicode stream */ +- subset.to_unicode = malloc (collection->num_glyphs*sizeof(unsigned long)); ++ subset.to_unicode = _cairo_malloc_ab (collection->num_glyphs, sizeof (unsigned long)); + if (subset.to_unicode) { + for (j = 0; j < collection->num_glyphs; j++) { + /* default unicode character required when mapping fails */ +@@ -622,7 +622,7 @@ + if (! collection.glyphs_size) + return CAIRO_STATUS_SUCCESS; + +- collection.glyphs = malloc (collection.glyphs_size * sizeof(unsigned long)); ++ collection.glyphs = _cairo_malloc_ab (collection.glyphs_size, sizeof(unsigned long)); + if (collection.glyphs == NULL) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-scaled-font.c libcairo-1.4.10/src/cairo-scaled-font.c +--- libcairo-1.4.10~/src/cairo-scaled-font.c 2007-06-15 12:06:05.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-scaled-font.c 2007-12-10 09:04:53.000000000 -0800 +@@ -927,7 +927,7 @@ + if (status) + goto DONE; + +- *glyphs = (cairo_glyph_t *) malloc ((*num_glyphs) * (sizeof (cairo_glyph_t))); ++ *glyphs = (cairo_glyph_t *) _cairo_malloc_ab ((*num_glyphs), sizeof (cairo_glyph_t)); + + if (*glyphs == NULL) { + status = CAIRO_STATUS_NO_MEMORY; +diff -urNad libcairo-1.4.10~/src/cairo-spline.c libcairo-1.4.10/src/cairo-spline.c +--- libcairo-1.4.10~/src/cairo-spline.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-spline.c 2007-12-10 09:04:53.000000000 -0800 +@@ -109,11 +109,12 @@ + assert (spline->num_points <= spline->points_size); + + if (spline->points == spline->points_embedded) { +- new_points = malloc (new_size * sizeof (cairo_point_t)); ++ new_points = _cairo_malloc_ab (new_size, sizeof (cairo_point_t)); + if (new_points) + memcpy (new_points, spline->points, old_size * sizeof (cairo_point_t)); + } else { +- new_points = realloc (spline->points, new_size * sizeof (cairo_point_t)); ++ new_points = _cairo_realloc_ab (spline->points, ++ new_size, sizeof (cairo_point_t)); + } + + if (new_points == NULL) { +diff -urNad libcairo-1.4.10~/src/cairo-stroke-style.c libcairo-1.4.10/src/cairo-stroke-style.c +--- libcairo-1.4.10~/src/cairo-stroke-style.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-stroke-style.c 2007-12-10 09:04:53.000000000 -0800 +@@ -62,7 +62,7 @@ + if (other->dash == NULL) { + style->dash = NULL; + } else { +- style->dash = malloc (style->num_dashes * sizeof (double)); ++ style->dash = _cairo_malloc_ab (style->num_dashes, sizeof (double)); + if (style->dash == NULL) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-surface-fallback.c libcairo-1.4.10/src/cairo-surface-fallback.c +--- libcairo-1.4.10~/src/cairo-surface-fallback.c 2007-05-16 06:52:56.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-surface-fallback.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1166,7 +1166,7 @@ + /* If the fetched image isn't at 0,0, we need to offset the rectangles */ + + if (state.image_rect.x != 0 || state.image_rect.y != 0) { +- offset_rects = malloc (sizeof (cairo_rectangle_int16_t) * num_rects); ++ offset_rects = _cairo_malloc_ab (num_rects, sizeof (cairo_rectangle_int16_t)); + if (offset_rects == NULL) { + status = CAIRO_STATUS_NO_MEMORY; + goto DONE; +@@ -1222,7 +1222,7 @@ + /* If the destination image isn't at 0,0, we need to offset the trapezoids */ + + if (state.image_rect.x != 0 || state.image_rect.y != 0) { +- offset_traps = malloc (sizeof (cairo_trapezoid_t) * num_traps); ++ offset_traps = _cairo_malloc_ab (num_traps, sizeof (cairo_trapezoid_t)); + if (!offset_traps) { + status = CAIRO_STATUS_NO_MEMORY; + goto DONE; +diff -urNad libcairo-1.4.10~/src/cairo-surface.c libcairo-1.4.10/src/cairo-surface.c +--- libcairo-1.4.10~/src/cairo-surface.c 2007-05-18 13:15:40.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1245,7 +1245,7 @@ + + rects = stack_rects; + if (num_rects > ARRAY_LENGTH (stack_rects)) { +- rects = malloc (sizeof (cairo_rectangle_int16_t) * num_rects); ++ rects = _cairo_malloc_ab (num_rects, sizeof (cairo_rectangle_int16_t)); + if (!rects) + return CAIRO_STATUS_NO_MEMORY; + } +diff -urNad libcairo-1.4.10~/src/cairo-svg-surface.c libcairo-1.4.10/src/cairo-svg-surface.c +--- libcairo-1.4.10~/src/cairo-svg-surface.c 2007-05-09 06:37:39.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-svg-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1220,7 +1220,7 @@ + + if (emulate_reflect || reverse_stops) { + n_stops = emulate_reflect ? pattern->n_stops * 2 - 2: pattern->n_stops; +- stops = malloc (sizeof (pixman_gradient_stop_t) * n_stops); ++ stops = _cairo_malloc_ab (n_stops, sizeof (pixman_gradient_stop_t)); + + for (i = 0; i < pattern->n_stops; i++) { + if (reverse_stops) { +diff -urNad libcairo-1.4.10~/src/cairo-traps.c libcairo-1.4.10/src/cairo-traps.c +--- libcairo-1.4.10~/src/cairo-traps.c 2007-06-27 11:00:55.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-traps.c 2007-12-10 09:04:53.000000000 -0800 +@@ -260,11 +260,12 @@ + return traps->status; + + if (traps->traps == traps->traps_embedded) { +- new_traps = malloc (new_size * sizeof (cairo_trapezoid_t)); ++ new_traps = _cairo_malloc_ab (new_size, sizeof (cairo_trapezoid_t)); + if (new_traps) + memcpy (new_traps, traps->traps, sizeof (traps->traps_embedded)); + } else { +- new_traps = realloc (traps->traps, new_size * sizeof (cairo_trapezoid_t)); ++ new_traps = _cairo_realloc_ab (traps->traps, ++ new_size, sizeof (cairo_trapezoid_t)); + } + + if (new_traps == NULL) { +diff -urNad libcairo-1.4.10~/src/cairo-unicode.c libcairo-1.4.10/src/cairo-unicode.c +--- libcairo-1.4.10~/src/cairo-unicode.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-unicode.c 2007-12-10 09:04:53.000000000 -0800 +@@ -240,7 +240,7 @@ + in = UTF8_NEXT_CHAR (in); + } + +- str32 = malloc (sizeof (uint32_t) * (n_chars + 1)); ++ str32 = _cairo_malloc_ab (n_chars + 1, sizeof (uint32_t)); + if (!str32) + return CAIRO_STATUS_NO_MEMORY; + +@@ -307,7 +307,7 @@ + in = UTF8_NEXT_CHAR (in); + } + +- str16 = malloc (sizeof (uint16_t) * (n16 + 1)); ++ str16 = _cairo_malloc_ab (n16 + 1, sizeof (uint16_t)); + if (!str16) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-win32-font.c libcairo-1.4.10/src/cairo-win32-font.c +--- libcairo-1.4.10~/src/cairo-win32-font.c 2007-04-27 10:02:34.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-win32-font.c 2007-12-10 09:04:53.000000000 -0800 +@@ -613,8 +613,8 @@ + dx = NULL; + } + +- glyph_indices = malloc (sizeof (WCHAR) * buffer_size); +- dx = malloc (sizeof (int) * buffer_size); ++ glyph_indices = _cairo_malloc_ab (buffer_size, sizeof (WCHAR)); ++ dx = _cairo_malloc_ab (buffer_size, sizeof (int)); + if (!glyph_indices || !dx) { + status = CAIRO_STATUS_NO_MEMORY; + goto FAIL2; +@@ -645,7 +645,7 @@ + } + + *num_glyphs = gcp_results.nGlyphs; +- *glyphs = malloc (sizeof (cairo_glyph_t) * gcp_results.nGlyphs); ++ *glyphs = _cairo_malloc_ab (gcp_results.nGlyphs, sizeof (cairo_glyph_t)); + if (!*glyphs) { + status = CAIRO_STATUS_NO_MEMORY; + goto FAIL2; +diff -urNad libcairo-1.4.10~/src/cairo-win32-surface.c libcairo-1.4.10/src/cairo-win32-surface.c +--- libcairo-1.4.10~/src/cairo-win32-surface.c 2007-05-09 06:37:39.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-win32-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -186,7 +186,7 @@ + } + + if (num_palette > 2) { +- bitmap_info = malloc (sizeof (BITMAPINFOHEADER) + num_palette * sizeof (RGBQUAD)); ++ bitmap_info = _cairo_malloc_ab_plus_c (num_palette, sizeof(RGBQUAD), sizeof(BITMAPINFOHEADER)); + if (!bitmap_info) + return CAIRO_STATUS_NO_MEMORY; + } else { +@@ -1546,8 +1546,8 @@ + SetBkMode(dst->dc, TRANSPARENT); + + if (num_glyphs > STACK_GLYPH_SIZE) { +- glyph_buf = (WORD *)malloc(num_glyphs * sizeof(WORD)); +- dxy_buf = (int *)malloc(num_glyphs * 2 * sizeof(int)); ++ glyph_buf = (WORD *) _cairo_malloc_ab (num_glyphs, sizeof(WORD)); ++ dxy_buf = (int *) _cairo_malloc_abc (num_glyphs, sizeof(int), 2); + } + + /* It is vital that dx values for dxy_buf are calculated from the delta of +diff -urNad libcairo-1.4.10~/src/cairo-xcb-surface.c libcairo-1.4.10/src/cairo-xcb-surface.c +--- libcairo-1.4.10~/src/cairo-xcb-surface.c 2007-05-09 06:37:39.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-xcb-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -403,7 +403,7 @@ + bpp = _bits_per_pixel(surface->dpy, imagerep->depth); + bytes_per_line = _bytes_per_line(surface->dpy, surface->width, bpp); + +- data = malloc (bytes_per_line * surface->height); ++ data = _cairo_malloc_ab (surface->height, bytes_per_line); + if (data == NULL) { + free (imagerep); + return CAIRO_STATUS_NO_MEMORY; +@@ -1328,7 +1328,7 @@ + mask_picture = _create_a8_picture (dst, &transparent, width, height, FALSE); + solid_picture = _create_a8_picture (dst, &solid, width, height, TRUE); + +- offset_traps = malloc (sizeof (xcb_render_trapezoid_t) * num_traps); ++ offset_traps = _cairo_malloc_ab (num_traps, sizeof (xcb_render_trapezoid_t)); + if (!offset_traps) + return XCB_NONE; + +@@ -1515,7 +1515,7 @@ + + n_boxes = pixman_region_num_rects (region); + if (n_boxes > 0) { +- rects = malloc (sizeof(xcb_rectangle_t) * n_boxes); ++ rects = _cairo_malloc_ab (n_boxes, sizeof(xcb_rectangle_t)); + if (rects == NULL) + return CAIRO_STATUS_NO_MEMORY; + } else { +@@ -2360,7 +2360,7 @@ + /* We make a copy of the glyphs so that we can elide any size-zero + * glyphs to workaround an X server bug, (present in at least Xorg + * 7.1 without EXA). */ +- output_glyphs = malloc (num_glyphs * sizeof (cairo_glyph_t)); ++ output_glyphs = _cairo_malloc_ab (num_glyphs, sizeof (cairo_glyph_t)); + if (output_glyphs == NULL) + return CAIRO_STATUS_NO_MEMORY; + +diff -urNad libcairo-1.4.10~/src/cairo-xlib-surface.c libcairo-1.4.10/src/cairo-xlib-surface.c +--- libcairo-1.4.10~/src/cairo-xlib-surface.c 2007-06-27 11:05:33.000000000 -0700 ++++ libcairo-1.4.10/src/cairo-xlib-surface.c 2007-12-10 09:04:53.000000000 -0800 +@@ -1579,7 +1579,7 @@ + mask_picture = _create_a8_picture (dst, &transparent, width, height, FALSE); + solid_picture = _create_a8_picture (dst, &solid, width, height, TRUE); + +- offset_traps = malloc (sizeof (XTrapezoid) * num_traps); ++ offset_traps = _cairo_malloc_ab (num_traps, sizeof (XTrapezoid)); + if (!offset_traps) + return None; + +@@ -1760,7 +1760,7 @@ + + n_boxes = pixman_region_num_rects (region); + if (n_boxes > ARRAY_LENGTH (surface->embedded_clip_rects)) { +- rects = malloc (sizeof(XRectangle) * n_boxes); ++ rects = _cairo_malloc_ab (n_boxes, sizeof(XRectangle)); + if (rects == NULL) + return CAIRO_STATUS_NO_MEMORY; + }else { +@@ -2815,7 +2815,7 @@ + if (num_elts <= STACK_ELTS_LEN) { + elts = stack_elts; + } else { +- elts = malloc (num_elts * sizeof (XGlyphElt8)); ++ elts = _cairo_malloc_ab (num_elts, sizeof (XGlyphElt8)); + if (elts == NULL) + return CAIRO_STATUS_NO_MEMORY; + } +diff -urNad libcairo-1.4.10~/src/cairoint.h libcairo-1.4.10/src/cairoint.h +--- libcairo-1.4.10~/src/cairoint.h 2007-12-10 09:04:52.000000000 -0800 ++++ libcairo-1.4.10/src/cairoint.h 2007-12-10 09:04:53.000000000 -0800 +@@ -181,6 +181,7 @@ + + #include "cairo-mutex-private.h" + #include "cairo-wideint-private.h" ++#include "cairo-malloc-private.h" + + typedef int32_t cairo_fixed_16_16_t; + typedef cairo_int64_t cairo_fixed_32_32_t; --- libcairo-1.4.10.orig/debian/patches/02-cairo-1.4.8-lcd-filter-2.dpatch +++ libcairo-1.4.10/debian/patches/02-cairo-1.4.8-lcd-filter-2.dpatch @@ -0,0 +1,933 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 02-cairo-1.4.8-lcd-filter-2.dpatch by Scott James Remnant +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad libcairo-1.4.10~/src/cairo-font-options.c libcairo-1.4.10/src/cairo-font-options.c +--- libcairo-1.4.10~/src/cairo-font-options.c 2007-09-20 21:59:04.000000000 +0100 ++++ libcairo-1.4.10/src/cairo-font-options.c 2007-09-20 21:59:19.000000000 +0100 +@@ -39,6 +39,7 @@ + static const cairo_font_options_t _cairo_font_options_nil = { + CAIRO_ANTIALIAS_DEFAULT, + CAIRO_SUBPIXEL_ORDER_DEFAULT, ++ CAIRO_LCD_FILTER_DEFAULT, + CAIRO_HINT_STYLE_DEFAULT, + CAIRO_HINT_METRICS_DEFAULT + }; +@@ -57,6 +58,7 @@ + + options->antialias = CAIRO_ANTIALIAS_DEFAULT; + options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; ++ options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT; + options->hint_style = CAIRO_HINT_STYLE_DEFAULT; + options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT; + } +@@ -67,6 +69,7 @@ + { + options->antialias = other->antialias; + options->subpixel_order = other->subpixel_order; ++ options->lcd_filter = other->lcd_filter; + options->hint_style = other->hint_style; + options->hint_metrics = other->hint_metrics; + } +@@ -184,6 +187,8 @@ + options->antialias = other->antialias; + if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) + options->subpixel_order = other->subpixel_order; ++ if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) ++ options->lcd_filter = other->lcd_filter; + if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT) + options->hint_style = other->hint_style; + if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT) +@@ -206,6 +211,7 @@ + { + return (options->antialias == other->antialias && + options->subpixel_order == other->subpixel_order && ++ options->lcd_filter == other->lcd_filter && + options->hint_style == other->hint_style && + options->hint_metrics == other->hint_metrics); + } +@@ -228,7 +234,8 @@ + { + return ((options->antialias) | + (options->subpixel_order << 4) | +- (options->hint_style << 8) | ++ (options->lcd_filter << 8) | ++ (options->hint_style << 12) | + (options->hint_metrics << 16)); + } + slim_hidden_def (cairo_font_options_hash); +@@ -304,6 +311,26 @@ + } + + /** ++ * _cairo_font_options_set_lcd_filter: ++ * @options: a #cairo_font_options_t ++ * @lcd_filter: the new lcd filterorder ++ * ++ * Sets the lcd filter for the font options object. The lcd filter ++ * specifies how pixels are filtered when rendered with an antialiasing ++ * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for ++ * #cairo_lcd_filter_t for full details. ++ **/ ++void ++_cairo_font_options_set_lcd_filter (cairo_font_options_t *options, ++ cairo_lcd_filter_t lcd_filter) ++{ ++ if (options == (cairo_font_options_t *)&_cairo_font_options_nil) ++ return; ++ ++ options->lcd_filter = lcd_filter; ++} ++ ++/** + * cairo_font_options_set_hint_style: + * @options: a #cairo_font_options_t + * @hint_style: the new hint style +diff -urNad libcairo-1.4.10~/src/cairo-ft-font.c libcairo-1.4.10/src/cairo-ft-font.c +--- libcairo-1.4.10~/src/cairo-ft-font.c 2007-09-20 21:59:04.000000000 +0100 ++++ libcairo-1.4.10/src/cairo-ft-font.c 2007-09-20 21:59:19.000000000 +0100 +@@ -55,6 +55,8 @@ + #include FT_SYNTHESIS_H + #endif + ++#include FT_LCD_FILTER_H ++ + #define DOUBLE_TO_26_6(d) ((FT_F26Dot6)((d) * 64.0)) + #define DOUBLE_FROM_26_6(t) ((double)(t) / 64.0) + #define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0)) +@@ -701,23 +703,300 @@ + return CAIRO_STATUS_SUCCESS; + } + +-/* Empirically-derived subpixel filtering values thanks to Keith +- * Packard and libXft. */ +-static const int filters[3][3] = { +- /* red */ +-#if 0 +- { 65538*4/7,65538*2/7,65538*1/7 }, +- /* green */ +- { 65536*1/4, 65536*2/4, 65537*1/4 }, +- /* blue */ +- { 65538*1/7,65538*2/7,65538*4/7 }, ++/* we sometimes need to convert the glyph bitmap in a FT_GlyphSlot ++ * into a different format. For example, we want to convert a ++ * FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V bitmap into a 32-bit ++ * ARGB or ABGR bitmap. ++ * ++ * this function prepares a target descriptor for this operation. ++ * ++ * input :: target bitmap descriptor. The function will set its ++ * 'width', 'rows' and 'pitch' fields, and only these ++ * ++ * slot :: the glyph slot containing the source bitmap. this ++ * function assumes that slot->format == FT_GLYPH_FORMAT_BITMAP ++ * ++ * mode :: the requested final rendering mode. supported values are ++ * MONO, NORMAL (i.e. gray), LCD and LCD_V ++ * ++ * the function returns the size in bytes of the corresponding buffer, ++ * it's up to the caller to allocate the corresponding memory block ++ * before calling _fill_xrender_bitmap ++ * ++ * it also returns -1 in case of error (e.g. incompatible arguments, ++ * like trying to convert a gray bitmap into a monochrome one) ++ */ ++static int ++_compute_xrender_bitmap_size( FT_Bitmap* target, ++ FT_GlyphSlot slot, ++ FT_Render_Mode mode ) ++{ ++ FT_Bitmap* ftbit; ++ int width, height, pitch; ++ ++ if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) ++ return -1; ++ ++ // compute the size of the final bitmap ++ ftbit = &slot->bitmap; ++ ++ width = ftbit->width; ++ height = ftbit->rows; ++ pitch = (width+3) & ~3; ++ ++ switch ( ftbit->pixel_mode ) ++ { ++ case FT_PIXEL_MODE_MONO: ++ if ( mode == FT_RENDER_MODE_MONO ) ++ { ++ pitch = (((width+31) & ~31) >> 3); ++ break; ++ } ++ /* fall-through */ ++ ++ case FT_PIXEL_MODE_GRAY: ++ if ( mode == FT_RENDER_MODE_LCD || ++ mode == FT_RENDER_MODE_LCD_V ) ++ { ++ /* each pixel is replicated into a 32-bit ARGB value */ ++ pitch = width*4; ++ } ++ break; ++ ++ case FT_PIXEL_MODE_LCD: ++ if ( mode != FT_RENDER_MODE_LCD ) ++ return -1; ++ ++ /* horz pixel triplets are packed into 32-bit ARGB values */ ++ width /= 3; ++ pitch = width*4; ++ break; ++ ++ case FT_PIXEL_MODE_LCD_V: ++ if ( mode != FT_RENDER_MODE_LCD_V ) ++ return -1; ++ ++ /* vert pixel triplets are packed into 32-bit ARGB values */ ++ height /= 3; ++ pitch = width*4; ++ break; ++ ++ default: /* unsupported source format */ ++ return -1; ++ } ++ ++ target->width = width; ++ target->rows = height; ++ target->pitch = pitch; ++ target->buffer = NULL; ++ ++ return pitch * height; ++} ++ ++/* this functions converts the glyph bitmap found in a FT_GlyphSlot ++ * into a different format (see _compute_xrender_bitmap_size) ++ * ++ * you should call this function after _compute_xrender_bitmap_size ++ * ++ * target :: target bitmap descriptor. Note that its 'buffer' pointer ++ * must point to memory allocated by the caller ++ * ++ * slot :: the glyph slot containing the source bitmap ++ * ++ * mode :: the requested final rendering mode ++ * ++ * bgr :: boolean, set if BGR or VBGR pixel ordering is needed ++ */ ++static void ++_fill_xrender_bitmap( FT_Bitmap* target, ++ FT_GlyphSlot slot, ++ FT_Render_Mode mode, ++ int bgr ) ++{ ++ FT_Bitmap* ftbit = &slot->bitmap; ++ unsigned char* srcLine = ftbit->buffer; ++ unsigned char* dstLine = target->buffer; ++ int src_pitch = ftbit->pitch; ++ int width = target->width; ++ int height = target->rows; ++ int pitch = target->pitch; ++ int subpixel; ++ int h; ++ ++ subpixel = ( mode == FT_RENDER_MODE_LCD || ++ mode == FT_RENDER_MODE_LCD_V ); ++ ++ if ( src_pitch < 0 ) ++ srcLine -= src_pitch*(ftbit->rows-1); ++ ++ target->pixel_mode = ftbit->pixel_mode; ++ ++ switch ( ftbit->pixel_mode ) ++ { ++ case FT_PIXEL_MODE_MONO: ++ if ( subpixel ) /* convert mono to ARGB32 values */ ++ { ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ { ++ int x; ++ ++ for ( x = 0; x < width; x++ ) ++ { ++ if ( srcLine[(x >> 3)] & (0x80 >> (x & 7)) ) ++ ((unsigned int*)dstLine)[x] = 0xffffffffU; ++ } ++ } ++ target->pixel_mode = FT_PIXEL_MODE_LCD; ++ } ++ else if ( mode == FT_RENDER_MODE_NORMAL ) /* convert mono to 8-bit gray */ ++ { ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ { ++ int x; ++ ++ for ( x = 0; x < width; x++ ) ++ { ++ if ( srcLine[(x >> 3)] & (0x80 >> (x & 7)) ) ++ dstLine[x] = 0xff; ++ } ++ } ++ target->pixel_mode = FT_PIXEL_MODE_GRAY; ++ } ++ else /* copy mono to mono */ ++ { ++ int bytes = (width+7) >> 3; ++ ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ memcpy( dstLine, srcLine, bytes ); ++ } ++ break; ++ ++ case FT_PIXEL_MODE_GRAY: ++ if ( subpixel ) /* convert gray to ARGB32 values */ ++ { ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ { ++ int x; ++ unsigned int* dst = (unsigned int*)dstLine; ++ ++ for ( x = 0; x < width; x++ ) ++ { ++ unsigned int pix = srcLine[x]; ++ ++ pix |= (pix << 8); ++ pix |= (pix << 16); ++ ++ dst[x] = pix; ++ } ++ } ++ target->pixel_mode = FT_PIXEL_MODE_LCD; ++ } ++ else /* copy gray into gray */ ++ { ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ memcpy( dstLine, srcLine, width ); ++ } ++ break; ++ ++ case FT_PIXEL_MODE_LCD: ++ if ( !bgr ) ++ { ++ /* convert horizontal RGB into ARGB32 */ ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ { ++ int x; ++ unsigned char* src = srcLine; ++ unsigned int* dst = (unsigned int*)dstLine; ++ ++ for ( x = 0; x < width; x++, src += 3 ) ++ { ++ unsigned int pix; ++ ++ pix = ((unsigned int)src[0] << 16) | ++ ((unsigned int)src[1] << 8) | ++ ((unsigned int)src[2] ) | ++ ((unsigned int)src[1] << 24) ; ++ ++ dst[x] = pix; ++ } ++ } ++ } ++ else ++ { ++ /* convert horizontal BGR into ARGB32 */ ++ for ( h = height; h > 0; h--, srcLine += src_pitch, dstLine += pitch ) ++ { ++ int x; ++ unsigned char* src = srcLine; ++ unsigned int* dst = (unsigned int*)dstLine; ++ ++ for ( x = 0; x < width; x++, src += 3 ) ++ { ++ unsigned int pix; ++ ++ pix = ((unsigned int)src[2] << 16) | ++ ((unsigned int)src[1] << 8) | ++ ((unsigned int)src[0] ) | ++ ((unsigned int)src[1] << 24) ; ++ ++ dst[x] = pix; ++ } ++ } ++ } ++ break; ++ ++ default: /* FT_PIXEL_MODE_LCD_V */ ++ /* convert vertical RGB into ARGB32 */ ++ if ( !bgr ) ++ { ++ for ( h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch ) ++ { ++ int x; ++ unsigned char* src = srcLine; ++ unsigned int* dst = (unsigned int*)dstLine; ++ ++ for ( x = 0; x < width; x++, src += 1 ) ++ { ++ unsigned int pix; ++#if 1 ++ pix = ((unsigned int)src[0] << 16) | ++ ((unsigned int)src[src_pitch] << 8) | ++ ((unsigned int)src[src_pitch*2] ) | ++ 0xFF000000 ; ++#else ++ pix = ((unsigned int)src[0] << 16) | ++ ((unsigned int)src[src_pitch] << 8) | ++ ((unsigned int)src[src_pitch*2] ) | ++ ((unsigned int)src[src_pitch] << 24) ; + #endif +- { 65538*9/13,65538*3/13,65538*1/13 }, +- /* green */ +- { 65538*1/6, 65538*4/6, 65538*1/6 }, +- /* blue */ +- { 65538*1/13,65538*3/13,65538*9/13 }, +-}; ++ dst[x] = pix; ++ } ++ } ++ } ++ else ++ { ++ for ( h = height; h > 0; h--, srcLine += 3*src_pitch, dstLine += pitch ) ++ { ++ int x; ++ unsigned char* src = srcLine; ++ unsigned int* dst = (unsigned int*)dstLine; ++ ++ for ( x = 0; x < width; x++, src += 1 ) ++ { ++ unsigned int pix; ++ ++ pix = ((unsigned int)src[src_pitch*2] << 16) | ++ ((unsigned int)src[src_pitch] << 8) | ++ ((unsigned int)src[0] ) | ++ ((unsigned int)src[src_pitch] << 24) ; ++ ++ dst[x] = pix; ++ } ++ } ++ } ++ } ++} ++ + + /* Fills in val->image with an image surface created from @bitmap + */ +@@ -730,12 +1009,14 @@ + int width, height, stride; + unsigned char *data; + int format = CAIRO_FORMAT_A8; +- cairo_bool_t subpixel = FALSE; ++ cairo_image_surface_t *image; + + width = bitmap->width; + height = bitmap->rows; + +- switch (bitmap->pixel_mode) { ++ { ++ switch (bitmap->pixel_mode) ++ { + case FT_PIXEL_MODE_MONO: + stride = (((width + 31) & ~31) >> 3); + if (own_buffer) { +@@ -765,7 +1046,6 @@ + } + } + } +- + #ifndef WORDS_BIGENDIAN + { + unsigned char *d = data; +@@ -777,17 +1057,15 @@ + } + } + #endif ++ + format = CAIRO_FORMAT_A1; + break; + + case FT_PIXEL_MODE_LCD: + case FT_PIXEL_MODE_LCD_V: + case FT_PIXEL_MODE_GRAY: +- switch (font_options->antialias) { +- case CAIRO_ANTIALIAS_DEFAULT: +- case CAIRO_ANTIALIAS_GRAY: +- case CAIRO_ANTIALIAS_NONE: +- default: ++ if (font_options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) ++ { + stride = bitmap->pitch; + if (own_buffer) { + data = bitmap->buffer; +@@ -800,107 +1078,19 @@ + memcpy (data, bitmap->buffer, stride * height); + } + format = CAIRO_FORMAT_A8; +- break; +- case CAIRO_ANTIALIAS_SUBPIXEL: { +- int x, y; +- unsigned char *in_line, *out_line, *in; +- unsigned int *out; +- unsigned int red, green, blue; +- int rf, gf, bf; +- int s; +- int o, os; +- unsigned char *data_rgba; +- unsigned int width_rgba, stride_rgba; +- int vmul = 1; +- int hmul = 1; ++ } else { ++ // if we get there, the data from the source bitmap ++ // really comes from _fill_xrender_bitmap, and is ++ // made of 32-bit ARGB or ABGR values ++ assert(own_buffer != 0); ++ assert(bitmap->pixel_mode != FT_PIXEL_MODE_GRAY); + +- switch (font_options->subpixel_order) { +- case CAIRO_SUBPIXEL_ORDER_DEFAULT: +- case CAIRO_SUBPIXEL_ORDER_RGB: +- case CAIRO_SUBPIXEL_ORDER_BGR: +- default: +- width /= 3; +- hmul = 3; +- break; +- case CAIRO_SUBPIXEL_ORDER_VRGB: +- case CAIRO_SUBPIXEL_ORDER_VBGR: +- vmul = 3; +- height /= 3; +- break; +- } +- /* +- * Filter the glyph to soften the color fringes +- */ +- width_rgba = width; ++ data = bitmap->buffer; + stride = bitmap->pitch; +- stride_rgba = (width_rgba * 4 + 3) & ~3; +- data_rgba = calloc (1, stride_rgba * height); +- if (data_rgba == NULL) { +- if (own_buffer) +- free (bitmap->buffer); +- _cairo_error (CAIRO_STATUS_NO_MEMORY); +- return CAIRO_STATUS_NO_MEMORY; +- } +- +- os = 1; +- switch (font_options->subpixel_order) { +- case CAIRO_SUBPIXEL_ORDER_VRGB: +- os = stride; +- case CAIRO_SUBPIXEL_ORDER_DEFAULT: +- case CAIRO_SUBPIXEL_ORDER_RGB: +- default: +- rf = 0; +- gf = 1; +- bf = 2; +- break; +- case CAIRO_SUBPIXEL_ORDER_VBGR: +- os = stride; +- case CAIRO_SUBPIXEL_ORDER_BGR: +- bf = 0; +- gf = 1; +- rf = 2; +- break; +- } +- in_line = bitmap->buffer; +- out_line = data_rgba; +- for (y = 0; y < height; y++) +- { +- in = in_line; +- out = (unsigned int *) out_line; +- in_line += stride * vmul; +- out_line += stride_rgba; +- for (x = 0; x < width * hmul; x += hmul) +- { +- red = green = blue = 0; +- o = 0; +- for (s = 0; s < 3; s++) +- { +- red += filters[rf][s]*in[x+o]; +- green += filters[gf][s]*in[x+o]; +- blue += filters[bf][s]*in[x+o]; +- o += os; +- } +- red = red / 65536; +- green = green / 65536; +- blue = blue / 65536; +- *out++ = (green << 24) | (red << 16) | (green << 8) | blue; +- } +- } +- +- /* Images here are stored in native format. The +- * backend must convert to its own format as needed +- */ +- +- if (own_buffer) +- free (bitmap->buffer); +- data = data_rgba; +- stride = stride_rgba; + format = CAIRO_FORMAT_ARGB32; +- subpixel = TRUE; +- break; +- } + } + break; ++ + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + /* These could be triggered by very rare types of TrueType fonts */ +@@ -911,20 +1101,21 @@ + return CAIRO_STATUS_NO_MEMORY; + } + +- *surface = (cairo_image_surface_t *) ++ /* XXX */ ++ *surface = image = (cairo_image_surface_t *) + cairo_image_surface_create_for_data (data, + format, + width, height, stride); +- if ((*surface)->base.status) { ++ if (image->base.status) { + free (data); + return CAIRO_STATUS_NO_MEMORY; + } + +- if (subpixel) +- pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE); +- +- _cairo_image_surface_assume_ownership_of_data ((*surface)); ++ if (font_options->antialias == CAIRO_ANTIALIAS_SUBPIXEL) ++ pixman_image_set_component_alpha (image->pixman_image, TRUE); + ++ _cairo_image_surface_assume_ownership_of_data (image); ++ } + return CAIRO_STATUS_SUCCESS; + } + +@@ -948,16 +1139,61 @@ + cairo_font_options_t *font_options, + cairo_image_surface_t **surface) + { ++ int rgba = FC_RGBA_UNKNOWN; ++ int lcd_filter = FC_LCD_FILTER_DEFAULT; + FT_GlyphSlot glyphslot = face->glyph; + FT_Outline *outline = &glyphslot->outline; + FT_Bitmap bitmap; + FT_BBox cbox; +- FT_Matrix matrix; +- int hmul = 1; +- int vmul = 1; + unsigned int width, height, stride; +- cairo_bool_t subpixel = FALSE; ++ cairo_format_t format; + cairo_status_t status; ++ FT_Error fterror; ++ FT_Library library = glyphslot->library; ++ FT_Render_Mode render_mode = FT_RENDER_MODE_NORMAL; ++ ++ switch (font_options->antialias) ++ { ++ case CAIRO_ANTIALIAS_NONE: ++ render_mode = FT_RENDER_MODE_MONO; ++ break; ++ ++ case CAIRO_ANTIALIAS_SUBPIXEL: ++ switch (font_options->subpixel_order) ++ { ++ case CAIRO_SUBPIXEL_ORDER_DEFAULT: ++ case CAIRO_SUBPIXEL_ORDER_RGB: ++ case CAIRO_SUBPIXEL_ORDER_BGR: ++ render_mode = FT_RENDER_MODE_LCD; ++ break; ++ ++ case CAIRO_SUBPIXEL_ORDER_VRGB: ++ case CAIRO_SUBPIXEL_ORDER_VBGR: ++ render_mode = FT_RENDER_MODE_LCD_V; ++ break; ++ } ++ ++ switch (font_options->lcd_filter) ++ { ++ case CAIRO_LCD_FILTER_NONE: ++ lcd_filter = FC_LCD_FILTER_NONE; ++ break; ++ case CAIRO_LCD_FILTER_DEFAULT: ++ lcd_filter = FC_LCD_FILTER_DEFAULT; ++ break; ++ case CAIRO_LCD_FILTER_LIGHT: ++ lcd_filter = FC_LCD_FILTER_LIGHT; ++ break; ++ case CAIRO_LCD_FILTER_LEGACY: ++ lcd_filter = FC_LCD_FILTER_LEGACY; ++ break; ++ } ++ break; ++ ++ case CAIRO_ANTIALIAS_DEFAULT: ++ case CAIRO_ANTIALIAS_GRAY: ++ render_mode = FT_RENDER_MODE_NORMAL; ++ } + + FT_Outline_Get_CBox (outline, &cbox); + +@@ -968,100 +1204,93 @@ + + width = (unsigned int) ((cbox.xMax - cbox.xMin) >> 6); + height = (unsigned int) ((cbox.yMax - cbox.yMin) >> 6); +- stride = (width * hmul + 3) & ~3; ++ stride = (width + 3) & ~3; + + if (width * height == 0) { +- cairo_format_t format; + /* Looks like fb handles zero-sized images just fine */ +- switch (font_options->antialias) { +- case CAIRO_ANTIALIAS_NONE: ++ switch (render_mode) ++ { ++ case FT_RENDER_MODE_MONO: + format = CAIRO_FORMAT_A1; + break; +- case CAIRO_ANTIALIAS_SUBPIXEL: +- format= CAIRO_FORMAT_ARGB32; ++ case FT_RENDER_MODE_LCD: ++ case FT_RENDER_MODE_LCD_V: ++ format = CAIRO_FORMAT_ARGB32; + break; +- case CAIRO_ANTIALIAS_DEFAULT: +- case CAIRO_ANTIALIAS_GRAY: + default: + format = CAIRO_FORMAT_A8; +- break; + } + + (*surface) = (cairo_image_surface_t *) + cairo_image_surface_create_for_data (NULL, format, 0, 0, 0); + if ((*surface)->base.status) + return CAIRO_STATUS_NO_MEMORY; ++ + } else { + +- matrix.xx = matrix.yy = 0x10000L; +- matrix.xy = matrix.yx = 0; ++ int bitmap_size; + +- switch (font_options->antialias) { +- case CAIRO_ANTIALIAS_NONE: +- bitmap.pixel_mode = FT_PIXEL_MODE_MONO; +- bitmap.num_grays = 1; +- stride = ((width + 31) & -32) >> 3; ++ switch (render_mode) ++ { ++ case FT_RENDER_MODE_LCD: ++ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_BGR ) { ++ rgba = FC_RGBA_BGR; ++ } else { ++ rgba = FC_RGBA_RGB; ++ } + break; +- case CAIRO_ANTIALIAS_DEFAULT: +- case CAIRO_ANTIALIAS_GRAY: +- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; +- bitmap.num_grays = 256; +- stride = (width + 3) & -4; ++ ++ case FT_RENDER_MODE_LCD_V: ++ if (font_options->subpixel_order == CAIRO_SUBPIXEL_ORDER_VBGR ) { ++ rgba = FC_RGBA_VBGR; ++ } else { ++ rgba = FC_RGBA_VRGB; ++ } + break; +- case CAIRO_ANTIALIAS_SUBPIXEL: +- switch (font_options->subpixel_order) { +- case CAIRO_SUBPIXEL_ORDER_RGB: +- case CAIRO_SUBPIXEL_ORDER_BGR: +- case CAIRO_SUBPIXEL_ORDER_DEFAULT: ++ + default: +- matrix.xx *= 3; +- hmul = 3; +- subpixel = TRUE; +- break; +- case CAIRO_SUBPIXEL_ORDER_VRGB: +- case CAIRO_SUBPIXEL_ORDER_VBGR: +- matrix.yy *= 3; +- vmul = 3; +- subpixel = TRUE; +- break; ++ ; + } +- FT_Outline_Transform (outline, &matrix); + +- bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; +- bitmap.num_grays = 256; +- stride = (width * hmul + 3) & -4; +- } ++ FT_Library_SetLcdFilter( library, lcd_filter ); + +- bitmap.pitch = stride; +- bitmap.width = width * hmul; +- bitmap.rows = height * vmul; +- bitmap.buffer = calloc (1, stride * bitmap.rows); ++ fterror = FT_Render_Glyph( face->glyph, render_mode ); + +- if (bitmap.buffer == NULL) { ++ FT_Library_SetLcdFilter( library, FT_LCD_FILTER_NONE ); ++ ++ if (fterror != 0) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY; + } + +- FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul); ++ bitmap_size = _compute_xrender_bitmap_size( &bitmap, ++ face->glyph, ++ render_mode ); ++ if ( bitmap_size < 0 ) ++ return CAIRO_STATUS_NO_MEMORY; + +- if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) { +- free (bitmap.buffer); ++ bitmap.buffer = calloc(1, bitmap_size); ++ if (bitmap.buffer == NULL) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY; + } + ++ _fill_xrender_bitmap( &bitmap, face->glyph, render_mode, ++ (rgba == FC_RGBA_BGR || rgba == FC_RGBA_VBGR) ); ++ ++ // NOTE: _get_bitmap_surface will free bitmap.buffer if there is an error + status = _get_bitmap_surface (&bitmap, TRUE, font_options, surface); + if (status) + return status; +- } + + /* + * Note: the font's coordinate system is upside down from ours, so the + * Y coordinate of the control box needs to be negated. + */ + cairo_surface_set_device_offset (&(*surface)->base, +- floor ((double) cbox.xMin / 64.0), +- floor (-(double) cbox.yMax / 64.0)); ++ (double) glyphslot->bitmap_left, ++ (double)-glyphslot->bitmap_top); ++ } + + return CAIRO_STATUS_SUCCESS; + } +@@ -1433,11 +1662,11 @@ + case CAIRO_SUBPIXEL_ORDER_DEFAULT: + case CAIRO_SUBPIXEL_ORDER_RGB: + case CAIRO_SUBPIXEL_ORDER_BGR: +- load_target |= FT_LOAD_TARGET_LCD; ++ load_target = FT_LOAD_TARGET_LCD; + break; + case CAIRO_SUBPIXEL_ORDER_VRGB: + case CAIRO_SUBPIXEL_ORDER_VBGR: +- load_target |= FT_LOAD_TARGET_LCD_V; ++ load_target = FT_LOAD_TARGET_LCD_V; + break; + } + } +diff -urNad libcairo-1.4.10~/src/cairo-types-private.h libcairo-1.4.10/src/cairo-types-private.h +--- libcairo-1.4.10~/src/cairo-types-private.h 2007-09-20 21:59:04.000000000 +0100 ++++ libcairo-1.4.10/src/cairo-types-private.h 2007-09-20 22:00:39.000000000 +0100 +@@ -50,9 +50,27 @@ + + typedef cairo_array_t cairo_user_data_array_t; + ++/** ++ * cairo_lcd_filter_t: ++ * @CAIRO_LCD_FILTER_DEFAULT: Default LCD filter ++ * @CAIRO_LCD_FILTER_NONE: Do not perform LCD filtering ++ * @CAIRO_LCD_FILTER_LIGHT: Variant lighter filter ++ * @CAIRO_LCD_FILTER_LEGACY: Use the legacy LCD filter ++ * ++ * The LCD filter specifies the low-pass filter applied to LCD-optimized ++ * bitmaps generated with an antialiasing mode of %CAIRO_ANTIALIAS_SUBPIXEL. ++ **/ ++typedef enum _cairo_lcd_filter { ++ CAIRO_LCD_FILTER_DEFAULT, ++ CAIRO_LCD_FILTER_NONE, ++ CAIRO_LCD_FILTER_LIGHT, ++ CAIRO_LCD_FILTER_LEGACY ++} cairo_lcd_filter_t; ++ + struct _cairo_font_options { + cairo_antialias_t antialias; + cairo_subpixel_order_t subpixel_order; ++ cairo_lcd_filter_t lcd_filter; + cairo_hint_style_t hint_style; + cairo_hint_metrics_t hint_metrics; + }; +diff -urNad libcairo-1.4.10~/src/cairo-xlib-screen.c libcairo-1.4.10/src/cairo-xlib-screen.c +--- libcairo-1.4.10~/src/cairo-xlib-screen.c 2007-09-20 21:59:04.000000000 +0100 ++++ libcairo-1.4.10/src/cairo-xlib-screen.c 2007-09-20 21:59:19.000000000 +0100 +@@ -138,8 +138,10 @@ + cairo_bool_t xft_antialias; + int xft_hintstyle; + int xft_rgba; ++ int xft_lcdfilter; + cairo_antialias_t antialias; + cairo_subpixel_order_t subpixel_order; ++ cairo_lcd_filter_t lcd_filter; + cairo_hint_style_t hint_style; + + if (!get_boolean_default (dpy, "antialias", &xft_antialias)) +@@ -187,6 +189,9 @@ + #endif + } + ++ if (!get_integer_default (dpy, "lcdfilter", &xft_lcdfilter)) ++ xft_lcdfilter = FC_LCD_FILTER_DEFAULT; ++ + if (xft_hinting) { + switch (xft_hintstyle) { + case FC_HINT_NONE: +@@ -227,6 +232,22 @@ + subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; + } + ++ switch (xft_lcdfilter) { ++ case FC_LCD_FILTER_NONE: ++ lcd_filter = CAIRO_LCD_FILTER_NONE; ++ break; ++ case FC_LCD_FILTER_LIGHT: ++ lcd_filter = CAIRO_LCD_FILTER_LIGHT; ++ break; ++ case FC_LCD_FILTER_LEGACY: ++ lcd_filter = CAIRO_LCD_FILTER_LEGACY; ++ break; ++ case FC_LCD_FILTER_DEFAULT: ++ default: ++ lcd_filter = CAIRO_LCD_FILTER_DEFAULT; ++ break; ++ } ++ + if (xft_antialias) { + if (subpixel_order == CAIRO_SUBPIXEL_ORDER_DEFAULT) + antialias = CAIRO_ANTIALIAS_GRAY; +@@ -239,6 +260,7 @@ + cairo_font_options_set_hint_style (&info->font_options, hint_style); + cairo_font_options_set_antialias (&info->font_options, antialias); + cairo_font_options_set_subpixel_order (&info->font_options, subpixel_order); ++ _cairo_font_options_set_lcd_filter (&info->font_options, lcd_filter); + cairo_font_options_set_hint_metrics (&info->font_options, CAIRO_HINT_METRICS_ON); + } + +diff -urNad libcairo-1.4.10~/src/cairoint.h libcairo-1.4.10/src/cairoint.h +--- libcairo-1.4.10~/src/cairoint.h 2007-09-20 21:59:04.000000000 +0100 ++++ libcairo-1.4.10/src/cairoint.h 2007-09-20 22:00:25.000000000 +0100 +@@ -1498,6 +1498,10 @@ + _cairo_font_options_init_copy (cairo_font_options_t *options, + const cairo_font_options_t *other); + ++cairo_private void ++_cairo_font_options_set_lcd_filter (cairo_font_options_t *options, ++ cairo_lcd_filter_t lcd_filter); ++ + /* cairo_hull.c */ + cairo_private cairo_status_t + _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices); --- libcairo-1.4.10.orig/debian/patches/90_from_git_fix_not_available_glyph_handling.dpatch +++ libcairo-1.4.10/debian/patches/90_from_git_fix_not_available_glyph_handling.dpatch @@ -0,0 +1,45 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 90_from_git_fix_not_available_glyph_handling.dpatch by Sebastien Bacher +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: No description. + +@DPATCH@ +diff -urNad libcairo-1.4.10~/src/cairo-ft-font.c libcairo-1.4.10/src/cairo-ft-font.c +--- libcairo-1.4.10~/src/cairo-ft-font.c 2007-09-28 13:52:47.000000000 +0200 ++++ libcairo-1.4.10/src/cairo-ft-font.c 2007-09-28 13:52:53.000000000 +0200 +@@ -1313,7 +1313,9 @@ + * we avoid the FT_LOAD_NO_RECURSE flag. + */ + error = FT_Render_Glyph (glyphslot, FT_RENDER_MODE_NORMAL); +- if (error) { ++ /* XXX ignoring all other errors for now. They are not fatal, typically ++ * just a glyph-not-found. */ ++ if (error == FT_Err_Out_Of_Memory) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY; + } +@@ -2107,8 +2109,9 @@ + error = FT_Load_Glyph (scaled_font->unscaled->face, + _cairo_scaled_glyph_index(scaled_glyph), + load_flags); +- +- if (error) { ++ /* XXX ignoring all other errors for now. They are not fatal, typically ++ * just a glyph-not-found. */ ++ if (error == FT_Err_Out_Of_Memory) { + status = CAIRO_STATUS_NO_MEMORY; + goto FAIL; + } +@@ -2258,8 +2261,9 @@ + error = FT_Load_Glyph (face, + _cairo_scaled_glyph_index(scaled_glyph), + load_flags | FT_LOAD_NO_BITMAP); +- +- if (error) { ++ /* XXX ignoring all other errors for now. They are not fatal, typically ++ * just a glyph-not-found. */ ++ if (error == FT_Err_Out_Of_Memory) { + _cairo_ft_unscaled_font_unlock_face (unscaled); + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return CAIRO_STATUS_NO_MEMORY;