diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-09-02 20:20:49 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-09-02 20:24:08 -0400 |
commit | 59262577708ddb656851624377efb2a671fa8ca3 (patch) | |
tree | 2c75bd94e2cfe3efb333b0b1509c0540181af100 | |
parent | 5cb3e66305b25a3380f2ca5829ac81e4a27e76d0 (diff) |
Revamp the build system.
Quick summary of changes:
- Move list of cairo source files out of src/Makefile.am and into
src/Sources.mk,
- Generate files src/Config.mk and src/Config.mk.win32 that choose
the right set of source files and headers based on configured
backends and features. This drastically simplifies building
using other build systems. The src/Makefile.win32 file needs
to be updated to reflect these changes.
- Add README files to various directories,
- Add toplevel HACKING file.
50 files changed, 932 insertions, 600 deletions
diff --git a/CODING_STYLE b/CODING_STYLE index 73fe2a9b..92536a44 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -267,4 +267,11 @@ for overflow and will return NULL in that case. 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 +yourself in any more complex situations. + + +TODO +---- + +Write rules for common editors to use this style. Also cleanup/unify +the modlines in the source files. diff --git a/ChangeLog.mk b/ChangeLog.mk index a0275a57..d93cd894 100644 --- a/ChangeLog.mk +++ b/ChangeLog.mk @@ -42,7 +42,8 @@ $(srcdir)/ChangeLog: after=$(srcdir)/ChangeLog.cache-$$nearest_tag..; \ $(MAKE) $(AM_MAKEFLAGS) $$before $$after && \ echo Creating $@ && \ - { cat $$after; echo; cat $$before; } > $@; \ + { echo '# Generated by configure. Do not edit.'; echo; \ + cat $$after; echo; cat $$before; } > $@; \ else \ test -f $@ || \ (echo A git checkout is required to generate $@ >&2 && \ diff --git a/HACKING b/HACKING new file mode 100644 index 00000000..a69c4508 --- /dev/null +++ b/HACKING @@ -0,0 +1,165 @@ +Hacking Cairo +============= + +This is a high-level guide to how the cairo distribution is organized +and how to get started hacking on it. Make sure you read through the +file README before continuing. + + +Coding Style +------------ + +The easiest way to write code in the cairo style is to follow code close +to the place you are hacking, but if you want a written down set of +rules, see file CODING_STYLE. + +Files for backends that depend on languages other than C (C++ or +Objective C for example) may use features specific to those languages. +For example, "//" comments are allowed, though discouraged, in those files. + + +Contact +------- + +Various ways to get in touch with other cairo developers and maintainers +have been enumerated at: + + http://cairographics.org/contact/ + +Most of that information is also reflected in the following sections. + + +Mailing Lists +------------- + +There are various mailing lists that are useful when developing cairo +code. A complete list is always available at: + + http://cairographics.org/lists/ + +It is recommended that cairo developers subscribe to all those lists. +The cairo list by itself generates much more traffic than the others +combined, so developers and contributors should not be intimidated by +the -commit and -bugs lists. + + +Bug Tracking System +------------------- + +We use a standard bugzilla bug tracking system available at: + + http://bugs.freedesktop.org/ + +For straight bug reports, it's best to report them there such that they +are not lost or forgotten. For discussion of new features or +complicated issues, use the mailing list. + + +IRC +--- + +It's a great idea to hang around the cairo IRC channel if you have any +interest in cairo. We use the #cairo channel on irc.freenode.net. + +Make sure you introduce yourself if your nick is not easy to match to +the name you use on the mailing list. + + +Version Control System +---------------------- + +We use /git/ for version control. See: + + http://cairographics.org/download/ + +TODO: +Add links to some git tutorials or better, right a few paragraphs +about how to use git to efficiently hack on cairo. + + +Build System +------------ + +We use the autotools build system with cairo, but with various +customizations and advanced features. Reading configure.in is your +best bet to understanding it, or just ask on IRC. + +To bootstrap the build system run ./autogen.sh. After that the +regular "./configure; make; make install" sequence can be used. + +There is limited support for a win32 build system. +See src/Makefile.win32. + + +ChangeLog +--------- + +We generate ChangeLog files automatically from the git commit log. +No manual ChangeLog writing is necessary. + + +Source Code +----------- + +The library source code and headers live in the src/ directory. +See src/README for more information. + + +Regression Test Suite +--------------------- + +Cairo has a fairly extensive regression-testing suite. Indeed, without +these tests it would be impossible to make a cairo release without +introducing tens of regressions. We still manage to introduce +regressions with each release even with the hundreds of tests we already +have. + +The regression test suite is located under the test/ directory. +See test/README for more information. + + +Performance Test Suite +---------------------- + +There is a small performance-testing suite for cairo. + +The performance test suite is located under the perf/ directory. +See perf/README for more information. + + +Boilerplate +----------- + +The cairo-boilerplate is a small private library used by the regression +and performance test suites. It includes the boilerplace code needed +to initialize various backends for the test suites, as well as allow +tweaking some of the internal workings of the backends for more testing. + +The boilerplate code is localted under the boilerplate/ directory. +See boilerplate/README for more information. + + +Documentation +------------- + +Cairo uses the gtk-doc system for reference API documentation. + +The reference documentation is located under doc/public. +See doc/public/README for more information. + +For more documentation including frequently asked questions, tutorials, +samples, roadmap, todo list, etc visit: + + http://cairographics.org/documentation/ + +Some of those should gradually be moved to doc/. + + +Utilities +--------- + +There are a few useful utilities we have developed that are either +useful when writing code using cairo, or writing cairo, or useful in +general. These tools can be found under the util/ directory. +See util/README for more information. + diff --git a/Makefile.am b/Makefile.am index a47cee4e..aff120e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -66,6 +66,7 @@ EXTRA_DIST = \ COPYING \ COPYING-LGPL-2.1 \ COPYING-MPL-1.1 \ + HACKING \ INSTALL \ NEWS \ PORTING_GUIDE \ @@ -51,7 +51,7 @@ Here are the steps to follow to create a new cairo release: the following command will show each patch that has changed a public header file since the given version: - find src/ -name '*.h' ! -name '*-private.h' ! -name 'cairoint.h' ! -name 'cairo-features-win32.h' | \ + find src/ -name '*.h' ! -name '*-private.h' ! -name 'cairoint.h' ! -name 'cairo-*features*.h' | \ xargs git diff X.Y.Z.. -- 4) Increment cairo_version_{minor|micro} in cairo-version.h: diff --git a/boilerplate/.gitignore b/boilerplate/.gitignore index 49c76a3d..e761d780 100644 --- a/boilerplate/.gitignore +++ b/boilerplate/.gitignore @@ -1,4 +1,5 @@ TAGS +tags *.lo *.la *.exe diff --git a/configure.in b/configure.in index 98a3f23c..bcd74cfd 100644 --- a/configure.in +++ b/configure.in @@ -330,7 +330,8 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE], CAIRO_LIBS="$$1_NONPKGCONFIG_LIBS$$1_LIBS$CAIRO_LIBS" CAIRO_NONPKGCONFIG_CFLAGS="$$1_NONPKGCONFIG_CFLAGS$CAIRO_NONPKGCONFIG_CFLAGS" CAIRO_NONPKGCONFIG_LIBS="$$1_NONPKGCONFIG_LIBS$CAIRO_NONPKGCONFIG_LIBS" - CAIRO_CONFIG_COMMANDS(m4_bpatsubst(src/cairo-$1.pc,_,-), + m4_define([cairo_backend_pc], m4_bpatsubst(src/cairo-$1.pc,_,-)) + AC_CONFIG_FILES(cairo_backend_pc():src/cairo-backend.pc.in, [sed \ -e "s,@backend_name@,$1,g" \ -e "s,@Backend_Name@,$2,g" \ @@ -338,29 +339,62 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE], -e "s,@BACKEND_REQUIRES@,$$1_REQUIRES,g" \ -e "s%@BACKEND_NONPKGCONFIG_LIBS@%$$1_NONPKGCONFIG_LIBS%g" \ -e "s,@BACKEND_NONPKGCONFIG_CFLAGS@,$$1_NONPKGCONFIG_CFLAGS,g" \ - -e "s,@prefix@,$prefix,g" \ - -e "s,@exec_prefix@,$exec_prefix,g" \ - -e "s,@libdir@,$libdir,g" \ - -e "s,@includedir@,$includedir,g" \ - -e "s,@VERSION@,$VERSION,g" \ - $srcdir/src/cairo-backend.pc.in + -i ]cairo_backend_pc()[ || + AC_MSG_ERROR(failed to update cairo_backend_pc()) ], [ $1_BASE='$$1_BASE' $1_REQUIRES='$$1_REQUIRES' $1_NONPKGCONFIG_LIBS='$$1_NONPKGCONFIG_LIBS' $1_NONPKGCONFIG_CFLAGS='$$1_NONPKGCONFIG_CFLAGS' - prefix='$prefix' - exec_prefix='$exec_prefix' - libdir='$libdir' - includedir='$includedir' - VERSION='$VERSION' ]) else - CAIRO_NO_FEATURES="$4 $CAIRO_NO_FEATURES" + # Collect list of all supported but disabled features + AS_IF([test "x$5" = xno],,[ + CAIRO_NO_FEATURES="$4 $CAIRO_NO_FEATURES" + ]) fi fi AM_CONDITIONAL(CAIRO_HAS_$4, test "x$use_$1" = xyes) + # Collect list of all supported features and cairo headers + AS_IF([test "x$5" = xno],[ + CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE' +unsupported_cairo_headers += $(cairo_$1_headers)' + CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32' +unsupported_cairo_headers += $(cairo_$1_headers)' + ],[ + CAIRO_SUPPORTED_FEATURES="$4 $CAIRO_SUPPORTED_FEATURES" + CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE' +supported_cairo_headers += $(cairo_$1_headers)' + CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32' +supported_cairo_headers += $(cairo_$1_headers)' + ]) + # Collect list of all/enabled cairo source files + CAIRO_CONFIG_AMAKE=$CAIRO_CONFIG_AMAKE' +all_cairo_pkgconf += $(cairo_$1_pkgconf) +all_cairo_headers += $(cairo_$1_headers) +all_cairo_private += $(cairo_$1_private) +all_cairo_sources += $(cairo_$1_sources) +if CAIRO_HAS_$4 +enabled_cairo_pkgconf += $(cairo_$1_pkgconf) +enabled_cairo_headers += $(cairo_$1_headers) +enabled_cairo_private += $(cairo_$1_private) +enabled_cairo_sources += $(cairo_$1_sources) +endif +' + CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_WIN32' +all_cairo_pkgconf += $(cairo_$1_pkgconf) +all_cairo_headers += $(cairo_$1_headers) +all_cairo_private += $(cairo_$1_private) +all_cairo_sources += $(cairo_$1_sources) +ifeq ($(CAIRO_HAS_$4),1) +enabled_cairo_pkgconf += $(cairo_$1_pkgconf) +enabled_cairo_headers += $(cairo_$1_headers) +enabled_cairo_private += $(cairo_$1_private) +enabled_cairo_sources += $(cairo_$1_sources) +endif +' + # Collect warning message for enabled unsupported backends AS_IF([test "x$use_[]$1" = xyes && test "x$5" = xno],[ CAIRO_WARNING_MESSAGE="$CAIRO_WARNING_MESSAGE *** The $2 backend is still under active development and @@ -374,24 +408,31 @@ AC_DEFUN([CAIRO_BACKEND_ENABLE], CAIRO_WARNING_MESSAGE="" CAIRO_FEATURES="" CAIRO_NO_FEATURES="" +CAIRO_SUPPORTED_FEATURES="" CAIRO_REQUIRES="" CAIRO_NONPKGCONFIG_CFLAGS="" CAIRO_NONPKGCONFIG_LIBS="$LIBM" CAIRO_LDADD="" CAIRO_CFLAGS=$CAIRO_NONPKGCONFIG_CFLAGS CAIRO_LIBS=$CAIRO_NONPKGCONFIG_LIBS - -dnl =========================================================================== - -PIXMAN_VERSION="0.11.2" -PIXMAN_REQUIRES="pixman-1 >= $PIXMAN_VERSION" -PKG_CHECK_MODULES(pixman, $PIXMAN_REQUIRES, , - [AC_MSG_ERROR([pixman >= $PIXMAN_VERSION is required -(http://cairographics.org/releases/)])]) - -CAIRO_REQUIRES="$PIXMAN_REQUIRES $CAIRO_REQUIRES" -CAIRO_CFLAGS="$pixman_CFLAGS $CAIRO_CFLAGS" -CAIRO_LIBS="$pixman_LIBS $CAIRO_LIBS" +CAIRO_CONFIG_AMAKE='# Generated by configure. Do not edit. + +include $(top_srcdir)/src/Sources.mk + +enabled_cairo_pkgconf = cairo.pc +enabled_cairo_headers = $(cairo_headers) +enabled_cairo_private = $(cairo_private) +enabled_cairo_sources = $(cairo_sources) +all_cairo_pkgconf = +all_cairo_headers = $(cairo_headers) +all_cairo_private = $(cairo_private) +all_cairo_sources = $(cairo_sources) +supported_cairo_headers = $(cairo_headers) +unsupported_cairo_headers = +' +CAIRO_CONFIG_WIN32=$CAIRO_CONFIG_AMAKE' +enabled_cairo_headers += $(_cairo_nodist_headers) $(_cairo_extra_headers) +' dnl =========================================================================== @@ -793,6 +834,23 @@ AC_SUBST(LIBRSVG_CFLAGS) AC_SUBST(LIBRSVG_LIBS) dnl =========================================================================== + +dnl XXX make this a private feature? +CAIRO_BACKEND_ENABLE(test_surfaces, test surfaces, test-surfaces, TEST_SURFACES, no) + +dnl =========================================================================== + +PIXMAN_VERSION="0.11.2" +PIXMAN_REQUIRES="pixman-1 >= $PIXMAN_VERSION" +PKG_CHECK_MODULES(pixman, $PIXMAN_REQUIRES, , + [AC_MSG_ERROR([pixman >= $PIXMAN_VERSION is required +(http://cairographics.org/releases/)])]) + +CAIRO_REQUIRES="$PIXMAN_REQUIRES $CAIRO_REQUIRES" +CAIRO_CFLAGS="$pixman_CFLAGS $CAIRO_CFLAGS" +CAIRO_LIBS="$pixman_LIBS $CAIRO_LIBS" + +dnl =========================================================================== dnl Build the external converter if we have any of the test backends AM_CONDITIONAL(BUILD_ANY2PPM, test "x$test_svg" = "xyes" \ @@ -1013,18 +1071,6 @@ AM_CONDITIONAL(CAIRO_HAS_LCOV, test "x$cairo_has_lcov" = "xyes") dnl =========================================================================== -AC_ARG_ENABLE(test-surfaces, - AS_HELP_STRING([--enable-test-surfaces], - [Add backends for more test suite coverage (no additional public functionality)]), - [use_test_surfaces=$enableval], [use_test_surfaces=no]) - -AM_CONDITIONAL(CAIRO_HAS_TEST_SURFACES, test "x$use_test_surfaces" = "xyes") -if test "x$use_test_surfaces" = "xyes"; then - AC_DEFINE(CAIRO_HAS_TEST_SURFACES, 1, [define in the extra test surface have been built into cairo for the test suite]) -fi - -dnl =========================================================================== - AC_ARG_ENABLE(some-floating-point, AS_HELP_STRING([--disable-some-floating-point], [Disable certain code paths that rely heavily on double precision @@ -1048,6 +1094,12 @@ fi dnl =========================================================================== +CAIRO_CONFIG_COMMANDS([$srcdir/src/Config.mk], + [echo "$CAIRO_CONFIG_AMAKE"], + [CAIRO_CONFIG_AMAKE='$CAIRO_CONFIG_AMAKE']) +CAIRO_CONFIG_COMMANDS([$srcdir/src/Config.mk.win32], + [echo "$CAIRO_CONFIG_WIN32"], + [CAIRO_CONFIG_WIN32='$CAIRO_CONFIG_WIN32']) CAIRO_CONFIG_COMMANDS([src/cairo-features.h], [ echo '/* Generated by configure. Do not edit. */' @@ -1067,21 +1119,21 @@ CAIRO_CONFIG_COMMANDS([src/cairo-features.h], CAIRO_FEATURES='$CAIRO_FEATURES' CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES' ]) -CAIRO_CONFIG_COMMANDS([src/cairo-no-features.h], +CAIRO_CONFIG_COMMANDS([src/cairo-supported-features.h], [ echo '/* Generated by configure. Do not edit. */' - echo '#ifndef CAIRO_NO_FEATURES_H' - echo '#define CAIRO_NO_FEATURES_H' + echo '#ifndef CAIRO_SUPPORTED_FEATURES_H' + echo '#define CAIRO_SUPPORTED_FEATURES_H' echo '' echo '/* This is a dummy header, to trick gtk-doc only */' echo '' - for FEATURE in $CAIRO_NO_FEATURES; do + for FEATURE in $CAIRO_SUPPORTED_FEATURES; do echo "#define CAIRO_HAS_$FEATURE 1" done echo '' echo '#endif' ],[ - CAIRO_NO_FEATURES='$CAIRO_NO_FEATURES' + CAIRO_SUPPORTED_FEATURES='$CAIRO_SUPPORTED_FEATURES' ]) AC_CONFIG_FILES([ Makefile diff --git a/doc/public/Headers.mk b/doc/public/Headers.mk deleted file mode 100644 index 7b9edff1..00000000 --- a/doc/public/Headers.mk +++ /dev/null @@ -1,52 +0,0 @@ -PRIVATE_TEST_HFILES = \ - cairo-analysis-surface-private.h \ - cairo-arc-private.h \ - cairo-atomic-private.h \ - cairo-cache-private.h \ - cairo-clip-private.h \ - cairo-compiler-private.h \ - cairo-fixed-private.h \ - cairo-fixed-type-private.h \ - cairo-freelist-private.h \ - cairo-ft-private.h \ - cairo-glitz-private.h \ - cairo-gstate-private.h \ - cairo-hash-private.h \ - cairo-malloc-private.h \ - cairo-meta-surface-private.h \ - cairo-mutex-impl-private.h \ - cairo-mutex-list-private.h \ - cairo-mutex-private.h \ - cairo-mutex-type-private.h \ - cairo-os2-private.h \ - cairo-output-stream-private.h \ - cairo-paginated-private.h \ - cairo-paginated-surface-private.h \ - cairo-path-fixed-private.h \ - cairo-path-private.h \ - cairo-pdf-operators-private.h \ - cairo-pdf-surface-private.h \ - cairo-private.h \ - cairo-ps-surface-private.h \ - cairo-quartz-private.h \ - cairo-reference-count-private.h \ - cairo-region-private.h \ - cairo-scaled-font-private.h \ - cairo-scaled-font-subsets-private.h \ - cairo-skiplist-private.h \ - cairo-surface-fallback-private.h \ - cairo-surface-private.h \ - cairo-svg-surface-private.h \ - cairo-truetype-subset-private.h \ - cairo-type1-private.h \ - cairo-type3-glyph-surface-private.h \ - cairo-types-private.h \ - cairo-user-font-private.h \ - cairo-wideint-private.h \ - cairo-wideint-type-private.h \ - cairo-win32-private.h \ - cairo-xlib-private.h \ - cairo-xlib-surface-private.h \ - cairo-xlib-xrender-private.h \ - cairo-features-win32.h \ - cairoint.h diff --git a/doc/public/Makefile.am b/doc/public/Makefile.am index 2bab45b2..2b6af97b 100644 --- a/doc/public/Makefile.am +++ b/doc/public/Makefile.am @@ -16,31 +16,15 @@ DOC_SOURCE_DIR=../../src HFILE_GLOB=$(top_srcdir)/src/cairo-*.h CFILE_GLOB=$(top_srcdir)/src/cairo-*.c $(top_srcdir)/src/cairo-*.h -include $(srcdir)/Headers.mk - -UNSUPPORTED_HFILES= \ - cairo-atsui.h \ - cairo-beos.h \ - cairo-directfb.h \ - cairo-glitz.h \ - cairo-os2.h \ - cairo-xcb.h \ - cairo-xcb-xrender.h +include $(top_srcdir)/src/Config.mk # Headers to ignore -IGNORE_HFILES= \ - $(PRIVATE_TEST_HFILES) \ - $(UNSUPPORTED_HFILES) - -Headers.mk: - ( echo "PRIVATE_TEST_HFILES = \\"; \ - find $(top_srcdir)/src \ - -name '*-private.h' | \ - sed 's@.*/@ @; s@$$@ \\@' | \ - LANG=C sort; \ - echo ' cairo-features-win32.h \'; \ - echo ' cairoint.h' ) > $@.tmp - mv $@.tmp $@ +IGNORE_HFILES= \ + cairo-features.h \ + cairo-features-win32.h \ + $(all_cairo_private) \ + $(unsupported_cairo_headers) \ + $(NULL) # CFLAGS and LDFLAGS for compiling scan program. Only needed # if $(DOC_MODULE).types is non-empty. diff --git a/doc/public/README b/doc/public/README new file mode 100644 index 00000000..f3d157b1 --- /dev/null +++ b/doc/public/README @@ -0,0 +1,37 @@ +Cairo Reference Documentation +============================= + +The API documentation is generated using gtk-doc. + + +Building +-------- + +The documentation is not built by default. To build it you need to +configure with gtk-doc enabled (--enable-gtk-doc), and run: + + make doc + + +Adding New API +-------------- + +When adding new symbols and macros to the public API, modify +cairo-section.txt and add new symbols to the right place. + +When adding whole new features, you also need to modify cairo-docs.xml +and add a new file under tmpl/. Beware that the files are tmpl/ are +both manually edited AND modified by gtk-doc, gathering documentation +stub from source files. + + +Tests +----- + +There are some tests in this directory, ensuring proper documentation +syntax as well as checking that all public symbols are fully documented. + +After adding any new API, just run: + + make check + diff --git a/perf/.gitignore b/perf/.gitignore index d9d3b652..858e28a7 100644 --- a/perf/.gitignore +++ b/perf/.gitignore @@ -1,3 +1,5 @@ +TAGS +tags cairo-perf cairo-perf-diff-files valgrind-log diff --git a/src/.gitignore b/src/.gitignore index 04dcae34..128bcc76 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -8,8 +8,10 @@ Makefile.in *.lo *.loT *.pc +Config.mk +Config.mk.win32 cairo-features.h -cairo-no-features.h +cairo-supported-features.h cairo.def *.i *.s @@ -24,4 +26,5 @@ cairo.def *~ .*.sw? TAGS +tags check-has-hidden-symbols.i diff --git a/src/Makefile.am b/src/Makefile.am index 444714b3..c292cad8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,348 +1,60 @@ -backend_pkgconfigs = +include $(srcdir)/Config.mk -cairo_base_headers = cairo.h +EXTRA_DIST = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = +BUILT_SOURCES = -cairo_base_sources = \ - cairo.c \ - cairo.h \ - cairo-private.h \ - cairo-arc.c \ - cairo-arc-private.h \ - cairo-array.c \ - cairo-atomic.c \ - cairo-atomic-private.h \ - cairo-base85-stream.c \ - cairo-bentley-ottmann.c \ - cairo-cache.c \ - cairo-clip.c \ - cairo-clip-private.h \ - cairo-color.c \ - cairo-compiler-private.h \ - cairo-debug.c \ - cairo-fixed.c \ - cairo-font-face.c \ - cairo-font-options.c \ - cairo-freelist.c \ - cairo-freelist-private.h \ - cairo-gstate.c \ - cairo-gstate-private.h \ - cairo-hash.c \ - cairo-hash-private.h \ - cairo-hull.c \ - cairo-image-surface.c \ - cairo-lzw.c \ - cairo-misc.c \ - cairo-malloc-private.h \ - cairo-matrix.c \ - cairo-mutex.c \ - cairo-mutex-private.h \ - cairo-mutex-impl-private.h \ - cairo-mutex-type-private.h \ - cairo-path.c \ - cairo-path-private.h \ - cairo-path-bounds.c \ - cairo-path-fill.c \ - cairo-path-fixed.c \ - cairo-path-fixed-private.h \ - cairo-path-stroke.c \ - cairo-pattern.c \ - cairo-pen.c \ - cairo-polygon.c \ - cairo-rectangle.c \ - cairo-reference-count-private.h \ - cairo-region.c \ - cairo-region-private.h \ - cairo-scaled-font.c \ - cairo-scaled-font-private.h \ - cairo-skiplist.c \ - cairo-skiplist-private.h \ - cairo-slope.c \ - cairo-spline.c \ - cairo-stroke-style.c \ - cairo-surface.c \ - cairo-surface-fallback.c \ - cairo-surface-fallback-private.h \ - cairo-surface-private.h \ - cairo-traps.c \ - cairo-user-font.c \ - cairo-user-font-private.h \ - cairo-unicode.c \ - cairo-output-stream.c \ - cairo-output-stream-private.h \ - cairo-wideint.c \ - cairo-wideint-private.h \ - cairo-wideint-type-private.h \ - cairo-meta-surface.c \ - cairo-meta-surface-private.h \ - cairo-paginated-private.h \ - cairo-paginated-surface.c \ - cairo-paginated-surface-private.h \ - cairo-analysis-surface.c \ - cairo-analysis-surface-private.h \ - cairo-version.c \ - cairo-version.h \ - cairoint.h -cairo_all_sources = $(cairo_base_sources) $(cairo_base_headers) -cairo_headers = $(cairo_base_headers) -cairo_sources = $(cairo_base_sources) - -font_subset_sources_base = \ - cairo-cff-subset.c \ - cairo-truetype-subset.c \ - cairo-type1-fallback.c \ - cairo-type1-private.h \ - cairo-truetype-subset-private.h \ - cairo-type3-glyph-surface.c \ - cairo-type3-glyph-surface-private.h \ - cairo-scaled-font-subsets.c \ - cairo-scaled-font-subsets-private.h -cairo_all_sources += $(font_subset_sources_base) - -font_subset_sources_ft = cairo-type1-subset.c -cairo_all_sources += $(font_subset_sources_ft) -font_subset_sources = $(font_subset_sources_base) -if CAIRO_HAS_FT_FONT -font_subset_sources += $(font_subset_sources_ft) -endif - -pdf_operators_sources = cairo-pdf-operators.c cairo-pdf-operators-private.h - -ps_headers = cairo-ps.h -ps_sources = cairo-ps-surface.c cairo-ps-surface-private.h -cairo_all_sources += $(ps_headers) $(ps_sources) -if CAIRO_HAS_PS_SURFACE -libcairo_pdf_operators_sources = $(pdf_operators_sources) -libcairo_font_subset_sources = $(font_subset_sources) -cairo_headers += $(ps_headers) -cairo_sources += $(ps_sources) -backend_pkgconfigs += cairo-ps.pc -endif - -pdf_headers = cairo-pdf.h -pdf_sources = cairo-pdf-surface.c cairo-pdf-surface-private.h \ - cairo-deflate-stream.c -cairo_all_sources += $(pdf_headers) $(pdf_sources) -if CAIRO_HAS_PDF_SURFACE -libcairo_pdf_operators_sources = $(pdf_operators_sources) -libcairo_font_subset_sources = $(font_subset_sources) -cairo_headers += $(pdf_headers) -cairo_sources += $(pdf_sources) -backend_pkgconfigs += cairo-pdf.pc -endif - -png_sources = cairo-png.c -cairo_all_sources += $(png_sources) -if CAIRO_HAS_PNG_FUNCTIONS -cairo_sources += $(png_sources) -backend_pkgconfigs += cairo-png.pc -endif - -svg_headers = cairo-svg.h -svg_sources = cairo-svg-surface.c cairo-svg-surface-private.h -cairo_all_sources += $(svg_headers) $(svg_sources) -if CAIRO_HAS_SVG_SURFACE -libcairo_font_subset_sources = $(font_subset_sources) -cairo_headers += $(svg_headers) -cairo_sources += $(svg_sources) -backend_pkgconfigs += cairo-svg.pc -endif - -cairo_sources += $(libcairo_pdf_operators_sources) -cairo_sources += $(libcairo_font_subset_sources) - -test_sources = test-fallback-surface.c test-fallback-surface.h \ - test-meta-surface.c test-meta-surface.h \ - test-paginated-surface.c test-paginated-surface.h -cairo_all_sources += $(test_sources) -if CAIRO_HAS_TEST_SURFACES -cairo_sources += $(test_sources) -endif - -xlib_headers = cairo-xlib.h -xlib_sources = cairo-xlib-surface.c \ - cairo-xlib-surface-private.h \ - cairo-xlib-display.c \ - cairo-xlib-screen.c \ - cairo-xlib-visual.c \ - cairo-xlib-private.h \ - cairo-xlib-xrender-private.h -cairo_all_sources += $(xlib_headers) $(xlib_sources) -if CAIRO_HAS_XLIB_SURFACE -cairo_headers += $(xlib_headers) -cairo_sources += $(xlib_sources) -backend_pkgconfigs += cairo-xlib.pc -endif - -xlib_xrender_headers = cairo-xlib-xrender.h -cairo_all_sources += $(xlib_xrender_headers) -if CAIRO_HAS_XLIB_XRENDER_SURFACE -cairo_headers += $(xlib_xrender_headers) -backend_pkgconfigs += cairo-xlib-xrender.pc -endif - -xcb_headers = cairo-xcb.h cairo-xcb-xrender.h -xcb_sources = cairo-xcb-surface.c -cairo_all_sources += $(xcb_headers) $(xcb_sources) -if CAIRO_HAS_XCB_SURFACE -cairo_headers += $(xcb_headers) -cairo_sources += $(xcb_sources) -backend_pkgconfigs += cairo-xcb.pc -endif - -quartz_headers = cairo-quartz.h -quartz_sources = cairo-quartz-surface.c cairo-quartz-image-surface.c cairo-quartz-private.h -cairo_all_sources += $(quartz_headers) $(quartz_sources) -if CAIRO_HAS_QUARTZ_SURFACE -cairo_headers += $(quartz_headers) -cairo_sources += $(quartz_sources) -backend_pkgconfigs += cairo-quartz.pc -endif -if CAIRO_HAS_QUARTZ_IMAGE_SURFACE -cairo_headers += cairo-quartz-image.h -backend_pkgconfigs += cairo-quartz-image.pc -endif - -quartz_font_sources = cairo-quartz-font.c -cairo_all_sources += $(quartz_font_sources) -if CAIRO_HAS_QUARTZ_FONT -cairo_sources += $(quartz_font_sources) -backend_pkgconfigs += cairo-quartz-font.pc -endif - -os_win32_sources = cairo-win32.c -cairo_all_sources += $(os_win32_sources) if OS_WIN32 -cairo_sources += $(os_win32_sources) export_symbols = -export-symbols cairo.def cairo_def_dependency = cairo.def endif -win32_headers = cairo-win32.h -win32_sources = cairo-win32-surface.c cairo-win32-printing-surface.c cairo-win32-private.h -cairo_all_sources += $(win32_headers) $(win32_sources) -if CAIRO_HAS_WIN32_SURFACE -cairo_headers += $(win32_headers) -cairo_sources += $(win32_sources) -backend_pkgconfigs += cairo-win32.pc -endif +EXTRA_DIST += cairo-features-win32.h Config.mk.win32 +MAINTAINERCLEANFILES += cairo-features-win32.h Config.mk.win32 -win32_font_sources = cairo-win32-font.c -cairo_all_sources += $(win32_font_sources) -if CAIRO_HAS_WIN32_FONT -cairo_sources += $(win32_font_sources) -backend_pkgconfigs += cairo-win32-font.pc -endif - -os2_headers = cairo-os2.h -os2_sources = cairo-os2-surface.c cairo-os2-private.h -cairo_all_sources += $(os2_headers) $(os2_sources) -if CAIRO_HAS_OS2_SURFACE -cairo_headers += $(os2_headers) -cairo_sources += $(os2_sources) -backend_pkgconfigs += cairo-os2.pc -endif - -beos_headers = cairo-beos.h -beos_sources = cairo-beos-surface.cpp -cairo_all_sources += $(beos_headers) $(beos_sources) -if CAIRO_HAS_BEOS_SURFACE -cairo_headers += $(beos_headers) -# automake is stupid enough to always use c++ linker if we enable the -# following line, even if beos surface is not enabled. Disable it for now. -#cairo_sources += $(beos_sources) -backend_pkgconfigs += cairo-beos.pc -endif - -glitz_headers = cairo-glitz.h -glitz_sources = cairo-glitz-surface.c cairo-glitz-private.h -cairo_all_sources += $(glitz_headers) $(glitz_sources) -if CAIRO_HAS_GLITZ_SURFACE -cairo_headers += $(glitz_headers) -cairo_sources += $(glitz_sources) -backend_pkgconfigs += cairo-glitz.pc -endif - -directfb_headers = cairo-directfb.h -directfb_sources = cairo-directfb-surface.c -cairo_all_sources += $(directfb_headers) $(directfb_sources) -if CAIRO_HAS_DIRECTFB_SURFACE -cairo_headers += $(directfb_headers) -cairo_sources += $(directfb_sources) -backend_pkgconfigs += cairo-directfb.pc -endif - -ft_headers = cairo-ft.h -ft_sources = cairo-ft-font.c cairo-ft-private.h -cairo_all_sources += $(ft_headers) $(ft_sources) -if CAIRO_HAS_FT_FONT -cairo_headers += $(ft_headers) -cairo_sources += $(ft_sources) -backend_pkgconfigs += cairo-ft.pc -endif +$(top_builddir)/config.h: $(top_srcdir)/config.h.in + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h -# These names match automake style variable definition conventions so -# without these lines, automake will complain during the handling of -# the libcairo_la_LIBADD below. (The INCLUDES is an autoconf only -# term and automake does not care about it) -FONTCONFIG_LIBS=@FONTCONFIG_LIBS@ -XRENDER_LIBS=@XRENDER_LIBS@ +all_cairo_files = \ + $(cairo_all_headers) \ + $(cairo_all_private) \ + $(cairo_all_sources) \ + $(NULL) cairoincludedir = $(includedir)/cairo -cairoinclude_HEADERS = \ - cairo-deprecated.h \ - $(top_srcdir)/cairo-version.h \ - $(cairo_headers) - -nodist_cairoinclude_HEADERS = \ - cairo-features.h +cairoinclude_HEADERS = $(enabled_cairo_headers) lib_LTLIBRARIES = libcairo.la -# source files that cannot be passed to compiler directly. -# mostly when they depend recursively on cairoint.h. that is, -# cairoint.h includes them in the middle. -cairo_special_sources = \ - cairo-cache-private.h \ - cairo-fixed-private.h \ - cairo-fixed-type-private.h \ - cairo-mutex-list-private.h \ - cairo-types-private.h - -libcairo_la_SOURCES = \ - $(cairo_sources) \ - $(cairo_special_sources) - -cairo_all_source_files = \ - $(cairo_all_sources) \ - $(cairo_special_sources) - +libcairo_la_SOURCES = \ + $(enabled_cairo_headers) \ + $(enabled_cairo_private) \ + $(enabled_cairo_sources) \ + $(NULL) libcairo_la_LDFLAGS = -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols) - libcairo_la_CFLAGS = -I$(srcdir) $(CAIRO_CFLAGS) - -libcairo_la_LIBADD = $(CAIRO_LIBS) $(noinst_LTLIBRARIES) $(CAIRO_LDADD) - -libcairo_la_DEPENDENCIES = $(cairo_def_dependency) $(noinst_LTLIBRARIES) +libcairo_la_LIBADD = $(CAIRO_LIBS) $(CAIRO_LDADD) +libcairo_la_DEPENDENCIES = $(cairo_def_dependency) + +# Special headers +cairoinclude_HEADERS += $(top_srcdir)/cairo-version.h +nodist_cairoinclude_HEADERS = cairo-features.h +libcairo_la_SOURCES += cairo-version.h cairo-features.h +BUILT_SOURCES += cairo-features.h cairo-supported-features.h +DISTCLEANFILES += cairo-features.h cairo-supported-features.h +cairo-features.h cairo-supported-features.h: + cd $(top_builddir) && ./config.status src/$@ pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = cairo.pc $(backend_pkgconfigs) -DISTCLEANFILES = $(backend_pkgconfigs) -EXTRA_DIST = cairo-backend.pc.in cairo-features-win32.h -$(backend_pkgconfigs): $(top_srcdir)/configure - cd $(top_builddir) && ./config.status --recheck +pkgconfig_DATA = $(enabled_cairo_pkgconf) -$(top_builddir)/config.h: $(top_srcdir)/config.h.in - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) config.h - -DISTCLEANFILES += cairo-features.h cairo-no-features.h -cairo-features.h cairo-no-features.h: - cd $(top_builddir) && ./config.status src/$@ - -CLEANFILES = cairo.def -cairo.def: $(cairo_headers) cairo-features.h +CLEANFILES += cairo.def +cairo.def: cairo-features.h $(enabled_cairo_headers) @echo Generating $@ @(echo EXPORTS; \ - (cd $(srcdir); cat $(cairo_headers) || echo 'cairo_ERROR ()' ) | \ + (cd $(srcdir); cat $(enabled_cairo_headers) || echo 'cairo_ERROR ()' ) | \ grep -v -E '^# *include' | \ ( cat cairo-features.h - | $(CPP) - || echo 'cairo_ERROR ()' ) | \ grep -E '^cairo_.* \(' | \ @@ -352,40 +64,27 @@ cairo.def: $(cairo_headers) cairo-features.h ) >$@ @ ! grep -q cairo_ERROR $@ || ($(RM) $@; false) -install-data-local: - @if test -f "$(DESTDIR)$(includedir)/cairo.h" || test -f "$(DESTDIR)$(includedir)/cairo-features.h" ; then \ - echo "****************************************************************" ; \ - echo "*** Error: Old headers found. You should remove the following" ; \ - echo "*** files and then type 'make install' again." ; \ - ls $(includedir)/cairo*.h ; \ - echo "****************************************************************" ; \ - false ; \ - fi - -TESTS_ENVIRONMENT = srcdir="$(srcdir)" MAKE="$(MAKE)" cairo_all_source_files="$(cairo_all_source_files)" +TESTS_ENVIRONMENT = srcdir="$(srcdir)" MAKE="$(MAKE)" all_cairo_files="$(all_cairo_files)" enabled_cairo_files="$(enabled_cairo_files)" TESTS = check-def.sh check-plt.sh check-headers.sh check-cairoint.sh check-doc-syntax.sh EXTRA_DIST += $(TESTS) check-has-hidden-symbols.c -DISTCLEANFILES += check-has-hidden-symbols.i -# Delete intermediate files as well -clean-local: - -${FIND} . -name '*.[is]' -print | ${XARGS} ${RM} # The pre-processed result is used by check-{def,plt}.sh to determine whether # cairo has been compiled with symbol hiding. .c.i: $(cairoinclude_HEADERS) $(nodist_cairoinclude_HEADERS) cairoint.h $(top_builddir)/config.h $(CPP) -DHAVE_CONFIG_H -I$(top_builddir) -I. $(libcairo_la_CFLAGS) $< -o $@ +CLEANFILES += *.i *.s SPARSE = sparse sparse: - @status=true; for f in $(cairo_sources); do \ + @status=true; for f in $(enabled_cairo_sources); do \ echo sparse $$f; \ $(SPARSE) -I$(top_builddir) $(libcairo_la_CFLAGS) -DHAVE_CONFIG_H $$f || status=false; \ done; $$status SPLINT = splint -badflag splint: - @status=true; for f in $(cairo_sources); do \ + @status=true; for f in $(enabled_cairo_sources); do \ test "$$f" = "`echo "$$f" | sed 's/[.]h$$//'`" || continue; \ echo sparse $$f; \ $(SPLINT) -I$(top_builddir) $(libcairo_la_CFLAGS) -DHAVE_CONFIG_H $$f || status=false; \ @@ -394,7 +93,7 @@ splint: UNO = uno uno: @cpp_flags=`echo $(libcairo_la_CFLAGS) | sed 's/\(-I.*\) /\1 /g'`; \ - files=`echo $(cairo_sources) | sed 's/[^ ]*\.h//g'`; \ + files=`echo $(enabled_cairo_sources) | sed 's/[^ ]*\.h//g'`; \ $(UNO) -I$(top_builddir) $$cpp_flags -DHAVE_CONFIG_H -U__GNUC__ $$files EXTRA_DIST += Makefile.win32 diff --git a/src/Makefile.win32 b/src/Makefile.win32 index 5fcf6053..753fb9a9 100644 --- a/src/Makefile.win32 +++ b/src/Makefile.win32 @@ -1,8 +1,9 @@ - SUBMAKEFILE = 1 include ../Makefile.win32 +include Config.mk.win32 + srcdir = `pwd` SOURCES = \ diff --git a/src/README b/src/README new file mode 100644 index 00000000..f29dd3ac --- /dev/null +++ b/src/README @@ -0,0 +1,58 @@ +Cairo Library Source Code +========================= + +This directory contains the source code to the cairo library. + + +Source Code Listing +------------------- + +The canonical list of source files is the file Source.mk. See that +file for how it works. + + +New Backends +------------ + +The rule of the thumb for adding new backends is to see how other +backends are integrated. Pick one of the simpler, unsupported, backends +and search the entire tree for it, and go from there. + +To add new backends you need to basically: + + * Modify $(top_srcdir)/configure.in to add checks for your backend. + + * Modify Sources.mk to add source files for your backend, + + * Modify $(top_srcdir)/boilerplate/ to add boilerplate code for + testing your new backend. + + +New API +------- + +After adding new API, run "make check" in this directory and fix any +reported issues. Also add new API to the right location in +$(top_srcdir)/doc/public/cairo-sections.txt and run "make check" +in $(top_builddir)/doc/public to make sure that any newly added +documentation is correctly hooked up. + +Do not forget to add tests for the new API. See next section. + + +Tests +----- + +There are some tests in this directory that check the source code and +the build for various issues. The tests are very quick to run, and +particularly should be run after any documentation or API changes. It +does not hurt to run them after any source modification either. Run +them simply by calling: + + make check + +There are also extensive regression tests in $(top_srcdir)/test. It is +a good idea to run that test suite for any changes made to the source +code. Moreover, for any new feature, API, or bug fix, new tests should +be added to the regression test suite to test the new code. + diff --git a/src/Sources.mk b/src/Sources.mk new file mode 100644 index 00000000..8652dad9 --- /dev/null +++ b/src/Sources.mk @@ -0,0 +1,246 @@ +# Sources.mk +# +# This file is the canonical location listing all the source files used +# to build the cairo library. Every source file is categorized as one of: +# +# * public header file +# * private header file (must end in -private.h except for cairoint.h) +# * source code file +# +# Every source file should be specified exactly once, grouped with the +# backend/feature that uses the source file. If more than one +# backend/feature use the file (like pdf_operators or font_subset files), +# the files should be appended to to the base cairo files, and the code +# inside them enabled/disabled using C preprocessor macros defined in +# cairoint.h. See how pdf_operators or font_subset are handled. +# +# The sources are picked up according to the configured backends/features +# by the generated file Config.mk or Config.mk.win32. +# +# These are a few special source files. Those are not included in this +# file to not confuse build systems. Each build system must handle them +# separately. These files include: +# +# * cairo-features.h: +# This file is generated by configure and includes macros signifying +# which backends/features are enabled. This file should be installed +# like other public headers, but should NOT be distributed in the +# cairo distribution. +# +# * cairo-features-win32.h: +# This is a dummy file for use as cairo-featurs.h when building on +# win32. This file is not used during the build and should NOT be +# installed. +# +# * cairo-version.h: +# This is a dummy header file used during the build, but it should +# NOT be installed. Its sole purpose is to make sure changes in the +# cairo version do not trigger a full rebuild of the library, but +# just the functions actually using the version information. +# +# * $(top_srcdir)/cairo-version.h: +# This is the real file holding the cairo version number. This file +# should be installed like other public headers. This is used during +# the build by cairo-version.c only. +# +# * cairo-supported-features.h: +# This file is generated by configure and includes macros signifying +# all supported supported backends/features. This is used by gtk-doc +# to generate documentation for all those macros, enabled or not. +# This file is NOT used during the build of the library and should NOT +# be installed or distributed. +# +# Please follow the strict syntax of this file, including keeping file +# lists sorted. +# + +cairo_headers = cairo.h cairo-deprecated.h +cairo_private = \ + cairoint.h \ + cairo-analysis-surface-private.h \ + cairo-arc-private.h \ + cairo-atomic-private.h \ + cairo-cache-private.h \ + cairo-clip-private.h \ + cairo-compiler-private.h \ + cairo-fixed-private.h \ + cairo-fixed-type-private.h \ + cairo-freelist-private.h \ + cairo-gstate-private.h \ + cairo-hash-private.h \ + cairo-malloc-private.h \ + cairo-meta-surface-private.h \ + cairo-mutex-impl-private.h \ + cairo-mutex-list-private.h \ + cairo-mutex-private.h \ + cairo-mutex-type-private.h \ + cairo-output-stream-private.h \ + cairo-paginated-private.h \ + cairo-paginated-surface-private.h \ + cairo-path-fixed-private.h \ + cairo-path-private.h \ + cairo-private.h \ + cairo-reference-count-private.h \ + cairo-region-private.h \ + cairo-scaled-font-private.h \ + cairo-skiplist-private.h \ + cairo-surface-fallback-private.h \ + cairo-surface-private.h \ + cairo-types-private.h \ + cairo-user-font-private.h \ + cairo-wideint-private.h \ + cairo-wideint-type-private.h \ + $(NULL) +cairo_sources = \ + cairo-analysis-surface.c \ + cairo-arc.c \ + cairo-array.c \ + cairo-atomic.c \ + cairo-base85-stream.c \ + cairo-bentley-ottmann.c \ + cairo.c \ + cairo-cache.c \ + cairo-clip.c \ + cairo-color.c \ + cairo-debug.c \ + cairo-fixed.c \ + cairo-font-face.c \ + cairo-font-options.c \ + cairo-freelist.c \ + cairo-gstate.c \ + cairo-hash.c \ + cairo-hull.c \ + cairo-image-surface.c \ + cairo-lzw.c \ + cairo-matrix.c \ + cairo-meta-surface.c \ + cairo-misc.c \ + cairo-mutex.c \ + cairo-output-stream.c \ + cairo-paginated-surface.c \ + cairo-path-bounds.c \ + cairo-path.c \ + cairo-path-fill.c \ + cairo-path-fixed.c \ + cairo-path-stroke.c \ + cairo-pattern.c \ + cairo-pen.c \ + cairo-polygon.c \ + cairo-rectangle.c \ + cairo-region.c \ + cairo-scaled-font.c \ + cairo-skiplist.c \ + cairo-slope.c \ + cairo-spline.c \ + cairo-stroke-style.c \ + cairo-surface.c \ + cairo-surface-fallback.c \ + cairo-traps.c \ + cairo-unicode.c \ + cairo-user-font.c \ + cairo-version.c \ + cairo-wideint.c \ + $(NULL) + +_cairo_font_subset_private = \ + cairo-scaled-font-subsets-private.h \ + cairo-truetype-subset-private.h \ + cairo-type1-private.h \ + cairo-type3-glyph-surface-private.h \ + $(NULL) +_cairo_font_subset_sources = \ + cairo-cff-subset.c \ + cairo-scaled-font-subsets.c \ + cairo-truetype-subset.c \ + cairo-type1-fallback.c \ + cairo-type1-subset.c \ + cairo-type3-glyph-surface.c \ + $(NULL) +cairo_private += $(_cairo_font_subset_private) +cairo_sources += $(_cairo_font_subset_sources) + +_cairo_pdf_operators_private = cairo-pdf-operators-private.h +_cairo_pdf_operators_sources = cairo-pdf-operators.c +cairo_private += $(_cairo_pdf_operators_private) +cairo_sources += $(_cairo_pdf_operators_sources) + +cairo_png_sources = cairo-png.c + +cairo_ps_headers = cairo-ps.h +cairo_ps_private = cairo-ps-surface-private.h +cairo_ps_sources = cairo-ps-surface.c + +cairo_pdf_headers = cairo-pdf.h +cairo_pdf_private = cairo-pdf-surface-private.h +cairo_pdf_sources = cairo-pdf-surface.c cairo-deflate-stream.c + +cairo_svg_headers = cairo-svg.h +cairo_svg_private = cairo-svg-surface-private.h +cairo_svg_sources = cairo-svg-surface.c + +cairo_ft_headers = cairo-ft.h +cairo_ft_private = cairo-ft-private.h +cairo_ft_sources = cairo-ft-font.c + +# These are private, even though they look like public headers +cairo_test_surfaces_private = \ + test-fallback-surface.h \ + test-meta-surface.h \ + test-paginated-surface.h \ + $(NULL) +cairo_test_surfaces_sources = \ + test-fallback-surface.c \ + test-meta-surface.c \ + test-paginated-surface.c \ + $(NULL) + +cairo_xlib_headers = cairo-xlib.h +cairo_xlib_private = \ + cairo-xlib-private.h \ + cairo-xlib-surface-private.h \ + cairo-xlib-xrender-private.h \ + $(NULL) +cairo_xlib_sources = \ + cairo-xlib-display.c \ + cairo-xlib-screen.c \ + cairo-xlib-surface.c \ + cairo-xlib-visual.c \ + $(NULL) + +cairo_xlib_xrender_headers = cairo-xlib-xrender.h + +# XXX split xcb-xrender. or better yet, merge it into xcb. xcb is so recent +# that it's hard to imagine having xcb but not render. +cairo_xcb_headers = cairo-xcb.h cairo-xcb-xrender.h +cairo_xcb_sources = cairo-xcb-surface.c + +cairo_quartz_headers = cairo-quartz.h +cairo_quartz_private = cairo-quartz-private.h +cairo_quartz_sources = cairo-quartz-surface.c + +cairo_quratz_image_headers = cairo-quartz-image.h +cairo_quratz_image_sources = cairo-quartz-image-surface.c + +cairo_quartz_font_sources = cairo-quartz-font.c + +cairo_win32_headers = cairo-win32.h +cairo_win32_private = cairo-win32-private.h +cairo_win32_sources = cairo-win32-surface.c cairo-win32-printing-surface.c + +cairo_win32_font_sources = cairo-win32-font.c + +cairo_os2_headers = cairo-os2.h +cairo_os2_private = cairo-os2-private.h +cairo_os2_sources = cairo-os2-surface.c + +# automake is stupid enough to always use c++ linker if we enable the +# following lines, even if beos surface is not enabled. Disable it for now. +cairo_beos_headers = cairo-beos.h +#cairo_beos_sources = cairo-beos-surface.cpp + +cairo_glitz_headers = cairo-glitz.h +cairo_glitz_private = cairo-glitz-private.h +cairo_glitz_sources = cairo-glitz-surface.c + +cairo_directfb_headers = cairo-directfb.h +cairo_directfb_sources = cairo-directfb-surface.c diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c index 53c5a175..008cc68a 100644 --- a/src/cairo-cff-subset.c +++ b/src/cairo-cff-subset.c @@ -41,6 +41,9 @@ #define _BSD_SOURCE /* for snprintf(), strdup() */ #include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-scaled-font-subsets-private.h" #include "cairo-truetype-subset-private.h" #include <string.h> @@ -2282,3 +2285,5 @@ _cairo_cff_fallback_fini (cairo_cff_subset_t *subset) free (subset->widths); free (subset->data); } + +#endif /* CAIRO_HAS_FONT_SUBSET */ diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h index 2e1eabd6..36c0fbdc 100644 --- a/src/cairo-clip-private.h +++ b/src/cairo-clip-private.h @@ -36,8 +36,11 @@ #ifndef CAIRO_CLIP_PRIVATE_H #define CAIRO_CLIP_PRIVATE_H +#include "cairo-types-private.h" #include "cairo-compiler-private.h" #include "cairo-path-fixed-private.h" +#include "cairo-reference-count-private.h" +#include "cairo-region-private.h" extern const cairo_private cairo_rectangle_list_t _cairo_rectangles_nil; diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h index 6c14048a..295b5875 100644 --- a/src/cairo-compiler-private.h +++ b/src/cairo-compiler-private.h @@ -38,7 +38,9 @@ #ifndef CAIRO_COMPILER_PRIVATE_H #define CAIRO_COMPILER_PRIVATE_H -CAIRO_BEGIN_DECLS +#if HAVE_CONFIG_H +#include "config.h" +#endif #if __GNUC__ >= 3 && defined(__ELF__) && !defined(__sun) # define slim_hidden_proto(name) slim_hidden_proto1(name, slim_hidden_int_name(name)) cairo_private @@ -126,6 +128,4 @@ CAIRO_BEGIN_DECLS #define inline __inline__ #endif -CAIRO_END_DECLS - #endif diff --git a/src/cairo-freelist-private.h b/src/cairo-freelist-private.h index 218c4c00..48791c23 100644 --- a/src/cairo-freelist-private.h +++ b/src/cairo-freelist-private.h @@ -23,6 +23,7 @@ #define CAIRO_FREELIST_H #include "cairo-types-private.h" +#include "cairo-compiler-private.h" /* Opaque implementation types. */ typedef struct _cairo_freelist cairo_freelist_t; diff --git a/src/cairo-misc.c b/src/cairo-misc.c index 9a0ede08..b927c941 100644 --- a/src/cairo-misc.c +++ b/src/cairo-misc.c @@ -3,6 +3,7 @@ * * Copyright © 2002 University of Southern California * Copyright © 2005 Red Hat, Inc. + * Copyright © 2007 Adrian Johnson * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public @@ -34,6 +35,7 @@ * * Contributor(s): * Carl D. Worth <cworth@cworth.org> + * Adrian Johnson <ajohnson@redneon.com> */ #include "cairoint.h" @@ -599,3 +601,69 @@ _cairo_lround (double d) #undef MSW #undef LSW } + + +#ifdef _WIN32 + +#define WIN32_LEAN_AND_MEAN +/* We require Windows 2000 features such as ETO_PDY */ +#if !defined(WINVER) || (WINVER < 0x0500) +# define WINVER 0x0500 +#endif +#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500) +# define _WIN32_WINNT 0x0500 +#endif + +#include <windows.h> +#include <io.h> + +/* tmpfile() replacment for Windows. + * + * On Windows tmpfile() creates the file in the root directory. This + * may fail due to unsufficient privileges. + */ +FILE * +_cairo_win32_tmpfile (void) +{ + DWORD path_len; + WCHAR path_name[MAX_PATH + 1]; + WCHAR file_name[MAX_PATH + 1]; + HANDLE handle; + int fd; + FILE *fp; + + path_len = GetTempPathW (MAX_PATH, path_name); + if (path_len <= 0 || path_len >= MAX_PATH) + return NULL; + + if (GetTempFileNameW (path_name, L"ps_", 0, file_name) == 0) + return NULL; + + handle = CreateFileW (file_name, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + DeleteFileW (file_name); + return NULL; + } + + fd = _open_osfhandle((intptr_t) handle, 0); + if (fd < 0) { + CloseHandle (handle); + return NULL; + } + + fp = fdopen(fd, "w+b"); + if (fp == NULL) { + _close(fd); + return NULL; + } + + return fp; +} + +#endif /* _WIN32 */ diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h index db3393a6..db65bd18 100644 --- a/src/cairo-mutex-impl-private.h +++ b/src/cairo-mutex-impl-private.h @@ -45,10 +45,6 @@ #include "config.h" #endif -#include "cairo-features.h" - -CAIRO_BEGIN_DECLS - /* A fully qualified no-operation statement */ #define CAIRO_MUTEX_IMPL_NOOP do {/*no-op*/} while (0) @@ -221,6 +217,4 @@ CAIRO_BEGIN_DECLS #endif -CAIRO_END_DECLS - #endif diff --git a/src/cairo-mutex-private.h b/src/cairo-mutex-private.h index 61b87d7a..d4bf68b1 100644 --- a/src/cairo-mutex-private.h +++ b/src/cairo-mutex-private.h @@ -41,6 +41,10 @@ #ifndef CAIRO_MUTEX_PRIVATE_H #define CAIRO_MUTEX_PRIVATE_H +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include "cairo-mutex-type-private.h" CAIRO_BEGIN_DECLS diff --git a/src/cairo-mutex-type-private.h b/src/cairo-mutex-type-private.h index d8079a34..2314be1d 100644 --- a/src/cairo-mutex-type-private.h +++ b/src/cairo-mutex-type-private.h @@ -41,12 +41,6 @@ #ifndef CAIRO_MUTEX_TYPE_PRIVATE_H #define CAIRO_MUTEX_TYPE_PRIVATE_H -#if HAVE_CONFIG_H -#include "config.h" -#endif - -#include "cairo-features.h" - #include "cairo-compiler-private.h" #include "cairo-mutex-impl-private.h" diff --git a/src/cairo-output-stream-private.h b/src/cairo-output-stream-private.h index 15cd2c03..37239f26 100644 --- a/src/cairo-output-stream-private.h +++ b/src/cairo-output-stream-private.h @@ -39,6 +39,10 @@ #include "cairo-compiler-private.h" #include "cairo-types-private.h" +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> + typedef cairo_status_t (*cairo_output_stream_write_func_t) (cairo_output_stream_t *output_stream, const unsigned char *data, unsigned int length); diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h index 9fcb2e18..4a5990d4 100644 --- a/src/cairo-path-fixed-private.h +++ b/src/cairo-path-fixed-private.h @@ -36,6 +36,8 @@ #ifndef CAIRO_PATH_FIXED_PRIVATE_H #define CAIRO_PATH_FIXED_PRIVATE_H +#include "cairo-types-private.h" + enum cairo_path_op { CAIRO_PATH_OP_MOVE_TO = 0, CAIRO_PATH_OP_LINE_TO = 1, diff --git a/src/cairo-pdf-operators-private.h b/src/cairo-pdf-operators-private.h index 1c23da5a..a85839bb 100644 --- a/src/cairo-pdf-operators-private.h +++ b/src/cairo-pdf-operators-private.h @@ -162,5 +162,4 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, cairo_bool_t backward, cairo_scaled_font_t *scaled_font); - #endif /* CAIRO_PDF_OPERATORS_H */ diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c index 47293753..435503ca 100644 --- a/src/cairo-pdf-operators.c +++ b/src/cairo-pdf-operators.c @@ -40,6 +40,9 @@ */ #include "cairoint.h" + +#if CAIRO_HAS_PDF_OPERATORS + #include "cairo-pdf-operators-private.h" #include "cairo-path-fixed-private.h" #include "cairo-output-stream-private.h" @@ -1425,3 +1428,5 @@ _cairo_pdf_operators_show_text_glyphs (cairo_pdf_operators_t *pdf_operators, return _cairo_output_stream_get_status (pdf_operators->stream); } + +#endif /* CAIRO_HAS_PDF_OPERATORS */ diff --git a/src/cairo-ps-surface-private.h b/src/cairo-ps-surface-private.h index 95a5dc55..79ac983a 100644 --- a/src/cairo-ps-surface-private.h +++ b/src/cairo-ps-surface-private.h @@ -46,6 +46,8 @@ #include "cairo-surface-private.h" #include "cairo-pdf-operators-private.h" +#include <time.h> + typedef struct cairo_ps_surface { cairo_surface_t base; diff --git a/src/cairo-reference-count-private.h b/src/cairo-reference-count-private.h index aef8a1f8..8dbc1abc 100644 --- a/src/cairo-reference-count-private.h +++ b/src/cairo-reference-count-private.h @@ -37,6 +37,10 @@ #ifndef CAIRO_REFRENCE_COUNT_PRIVATE_H #define CAIRO_REFRENCE_COUNT_PRIVATE_H +#if HAVE_CONFIG_H +#include "config.h" +#endif + #include "cairo-atomic-private.h" CAIRO_BEGIN_DECLS diff --git a/src/cairo-region-private.h b/src/cairo-region-private.h index 53c1e8a0..1902500d 100644 --- a/src/cairo-region-private.h +++ b/src/cairo-region-private.h @@ -40,6 +40,7 @@ #include <pixman.h> #include "cairo-compiler-private.h" +#include "cairo-types-private.h" /* #cairo_region_t is defined in cairoint.h */ diff --git a/src/cairo-scaled-font-subsets-private.h b/src/cairo-scaled-font-subsets-private.h index e8773181..c7991a7e 100644 --- a/src/cairo-scaled-font-subsets-private.h +++ b/src/cairo-scaled-font-subsets-private.h @@ -39,6 +39,8 @@ #include "cairoint.h" +#if CAIRO_HAS_FONT_SUBSET + typedef struct _cairo_scaled_font_subsets_glyph { unsigned int font_id; unsigned int subset_id; @@ -421,6 +423,9 @@ typedef struct _cairo_type1_subset { unsigned long trailer_length; } cairo_type1_subset_t; + +#if CAIRO_HAS_FT_FONT + /** * _cairo_type1_subset_init: * @type1_subset: a #cairo_type1_subset_t to initialize @@ -454,6 +459,9 @@ _cairo_type1_subset_init (cairo_type1_subset_t *type_subset, cairo_private void _cairo_type1_subset_fini (cairo_type1_subset_t *subset); +#endif /* CAIRO_HAS_FT_FONT */ + + /** * _cairo_type1_scaled_font_is_type1: * @scaled_font: a #cairo_scaled_font_t @@ -592,4 +600,6 @@ _cairo_truetype_index_to_ucs4 (cairo_scaled_font_t *scaled_font, unsigned long index, uint32_t *ucs4); +#endif /* CAIRO_HAS_FONT_SUBSET */ + #endif /* CAIRO_SCALED_FONT_SUBSETS_PRIVATE_H */ diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c index f4ba9265..9d951441 100644 --- a/src/cairo-scaled-font-subsets.c +++ b/src/cairo-scaled-font-subsets.c @@ -42,6 +42,9 @@ #define _BSD_SOURCE /* for snprintf(), strdup() */ #include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-scaled-font-subsets-private.h" #include "cairo-user-font-private.h" @@ -1014,3 +1017,5 @@ CLEANUP_HASH: return status; } + +#endif /* CAIRO_HAS_FONT_SUBSET */ diff --git a/src/cairo-truetype-subset-private.h b/src/cairo-truetype-subset-private.h index e4be77ce..397a9f38 100644 --- a/src/cairo-truetype-subset-private.h +++ b/src/cairo-truetype-subset-private.h @@ -39,6 +39,8 @@ #include "cairoint.h" +#if CAIRO_HAS_FONT_SUBSET + /* The structs defined here should strictly follow the TrueType * specification and not be padded. We use only 16-bit integer * in their definition to guarantee that. The fields of type @@ -192,4 +194,6 @@ typedef struct _tt_glyph_data { tt_composite_glyph_t glyph; } tt_glyph_data_t; +#endif /* CAIRO_HAS_FONT_SUBSET */ + #endif /* CAIRO_TRUETYPE_SUBSET_PRIVATE_H */ diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c index 892ce412..20bb7c67 100644 --- a/src/cairo-truetype-subset.c +++ b/src/cairo-truetype-subset.c @@ -43,6 +43,8 @@ #define _BSD_SOURCE /* for snprintf(), strdup() */ #include "cairoint.h" +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-scaled-font-subsets-private.h" #include "cairo-truetype-subset-private.h" @@ -1323,3 +1325,5 @@ cleanup: return status; } + +#endif /* CAIRO_HAS_FONT_SUBSET */ diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c index 539ddf22..75503103 100644 --- a/src/cairo-type1-fallback.c +++ b/src/cairo-type1-fallback.c @@ -35,6 +35,9 @@ #define _BSD_SOURCE /* for snprintf(), strdup() */ #include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-type1-private.h" #include "cairo-scaled-font-subsets-private.h" #include "cairo-path-fixed-private.h" @@ -873,3 +876,5 @@ _cairo_type2_charstrings_fini (cairo_type2_charstrings_t *type2_subset) free (type2_subset->widths); } + +#endif /* CAIRO_HAS_FONT_SUBSET */ diff --git a/src/cairo-type1-private.h b/src/cairo-type1-private.h index ae28e058..171c2249 100644 --- a/src/cairo-type1-private.h +++ b/src/cairo-type1-private.h @@ -36,10 +36,16 @@ #ifndef CAIRO_TYPE1_PRIVATE_H #define CAIRO_TYPE1_PRIVATE_H +#include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + /* Magic constants for the type1 eexec encryption */ #define CAIRO_TYPE1_ENCRYPT_C1 ((unsigned short) 52845) #define CAIRO_TYPE1_ENCRYPT_C2 ((unsigned short) 22719) #define CAIRO_TYPE1_PRIVATE_DICT_KEY ((unsigned short) 55665) #define CAIRO_TYPE1_CHARSTRING_KEY ((unsigned short) 4330) +#endif /* CAIRO_HAS_FONT_SUBSET */ + #endif /* CAIRO_TYPE1_PRIVATE_H */ diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c index b5141818..8e1d3292 100644 --- a/src/cairo-type1-subset.c +++ b/src/cairo-type1-subset.c @@ -38,13 +38,19 @@ * http://partners.adobe.com/public/developer/en/font/T1_SPEC.PDF */ + #define _BSD_SOURCE /* for snprintf(), strdup() */ #include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-type1-private.h" #include "cairo-scaled-font-subsets-private.h" #include "cairo-output-stream-private.h" /* XXX: Eventually, we need to handle other font backends */ +#if CAIRO_HAS_FT_FONT + #include "cairo-ft-private.h" #include <ft2build.h> @@ -1405,3 +1411,7 @@ _cairo_type1_scaled_font_is_type1 (cairo_scaled_font_t *scaled_font) return is_type1; } + +#endif /* CAIRO_HAS_FT_FONT */ + +#endif /* CAIRO_HAS_FONT_SUBSET */ diff --git a/src/cairo-type3-glyph-surface-private.h b/src/cairo-type3-glyph-surface-private.h index 69819886..47aba01c 100644 --- a/src/cairo-type3-glyph-surface-private.h +++ b/src/cairo-type3-glyph-surface-private.h @@ -37,6 +37,10 @@ #ifndef CAIRO_TYPE3_GLYPH_SURFACE_PRIVATE_H #define CAIRO_TYPE3_GLYPH_SURFACE_PRIVATE_H +#include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-surface-private.h" #include "cairo-pdf-operators-private.h" @@ -71,4 +75,6 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface, cairo_box_t *bbox, double *width); +#endif /* CAIRO_HAS_FONT_SUBSET */ + #endif /* CAIRO_TYPE3_GLYPH_SURFACE_PRIVATE_H */ diff --git a/src/cairo-type3-glyph-surface.c b/src/cairo-type3-glyph-surface.c index eab756e3..4c3afb40 100644 --- a/src/cairo-type3-glyph-surface.c +++ b/src/cairo-type3-glyph-surface.c @@ -35,6 +35,9 @@ */ #include "cairoint.h" + +#if CAIRO_HAS_FONT_SUBSET + #include "cairo-type3-glyph-surface-private.h" #include "cairo-output-stream-private.h" #include "cairo-meta-surface-private.h" @@ -443,3 +446,5 @@ _cairo_type3_glyph_surface_emit_glyph (void *abstract_surface, return status; } + +#endif /* CAIRO_HAS_FONT_SUBSET */ diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h index f2a6f631..91bfa8a5 100644 --- a/src/cairo-types-private.h +++ b/src/cairo-types-private.h @@ -45,17 +45,27 @@ #include "cairo-fixed-type-private.h" typedef struct _cairo_array cairo_array_t; -typedef struct _cairo_hash_table cairo_hash_table_t; typedef struct _cairo_cache cairo_cache_t; -typedef struct _cairo_hash_entry cairo_hash_entry_t; -typedef struct _cairo_surface_backend cairo_surface_backend_t; typedef struct _cairo_clip cairo_clip_t; +typedef struct _cairo_clip_path cairo_clip_path_t; +typedef struct _cairo_color cairo_color_t; +typedef struct _cairo_font_face_backend cairo_font_face_backend_t; +typedef struct _cairo_gstate cairo_gstate_t; +typedef struct _cairo_hash_entry cairo_hash_entry_t; +typedef struct _cairo_hash_table cairo_hash_table_t; +typedef struct _cairo_image_surface cairo_image_surface_t; typedef struct _cairo_output_stream cairo_output_stream_t; -typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t; typedef struct _cairo_paginated_surface_backend cairo_paginated_surface_backend_t; +typedef struct _cairo_path_fixed cairo_path_fixed_t; +typedef struct _cairo_rectangle_int16 cairo_glyph_size_t; +typedef struct _cairo_region cairo_region_t; typedef struct _cairo_scaled_font_backend cairo_scaled_font_backend_t; -typedef struct _cairo_font_face_backend cairo_font_face_backend_t; +typedef struct _cairo_scaled_font_subsets cairo_scaled_font_subsets_t; +typedef struct _cairo_solid_pattern cairo_solid_pattern_t; +typedef struct _cairo_surface_backend cairo_surface_backend_t; +typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t; typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t; + typedef cairo_array_t cairo_user_data_array_t; /** @@ -156,8 +166,6 @@ typedef enum _cairo_internal_surface_type { CAIRO_INTERNAL_SURFACE_TYPE_TYPE3_GLYPH } cairo_internal_surface_type_t; -typedef struct _cairo_region cairo_region_t; - typedef struct _cairo_point { cairo_fixed_t x; cairo_fixed_t y; @@ -199,8 +207,6 @@ struct _cairo_rectangle_int32 { uint32_t width, height; }; -typedef struct _cairo_rectangle_int16 cairo_glyph_size_t; - struct _cairo_point_int16 { int16_t x, y; }; @@ -233,13 +239,11 @@ typedef enum _cairo_direction { CAIRO_DIRECTION_REVERSE } cairo_direction_t; -typedef struct _cairo_path_fixed cairo_path_fixed_t; typedef enum _cairo_clip_mode { CAIRO_CLIP_MODE_PATH, CAIRO_CLIP_MODE_REGION, CAIRO_CLIP_MODE_MASK } cairo_clip_mode_t; -typedef struct _cairo_clip_path cairo_clip_path_t; typedef struct _cairo_edge { cairo_line_t edge; @@ -292,9 +296,6 @@ typedef struct _cairo_pen { cairo_pen_vertex_t vertices_embedded[32]; } cairo_pen_t; -typedef struct _cairo_color cairo_color_t; -typedef struct _cairo_image_surface cairo_image_surface_t; - typedef struct _cairo_stroke_style { double line_width; cairo_line_cap_t line_cap; diff --git a/src/cairo-user-font-private.h b/src/cairo-user-font-private.h index d75c24b6..2a39ff97 100644 --- a/src/cairo-user-font-private.h +++ b/src/cairo-user-font-private.h @@ -38,6 +38,7 @@ #define CAIRO_USER_FONT_PRIVATE_H #include "cairo.h" +#include "cairo-compiler-private.h" cairo_private cairo_bool_t _cairo_font_face_is_user (cairo_font_face_t *font_face); diff --git a/src/cairo-win32.c b/src/cairo-win32.c deleted file mode 100644 index a656ff8e..00000000 --- a/src/cairo-win32.c +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- 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 Adrian Johnson - * - * 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 Adrian Johnson. - * - * Contributor(s): - * Adrian Johnson <ajohnson@redneon.com> - */ - -#define WIN32_LEAN_AND_MEAN -/* We require Windows 2000 features such as ETO_PDY */ -#if !defined(WINVER) || (WINVER < 0x0500) -# define WINVER 0x0500 -#endif -#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500) -# define _WIN32_WINNT 0x0500 -#endif - -#include "cairoint.h" - -#include <windows.h> -#include <io.h> - -/* tmpfile() replacment for Windows. - * - * On Windows tmpfile() creates the file in the root directory. This - * may fail due to unsufficient privileges. - */ -FILE * -_cairo_win32_tmpfile (void) -{ - DWORD path_len; - WCHAR path_name[MAX_PATH + 1]; - WCHAR file_name[MAX_PATH + 1]; - HANDLE handle; - int fd; - FILE *fp; - - path_len = GetTempPathW (MAX_PATH, path_name); - if (path_len <= 0 || path_len >= MAX_PATH) - return NULL; - - if (GetTempFileNameW (path_name, L"ps_", 0, file_name) == 0) - return NULL; - - handle = CreateFileW (file_name, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, - NULL); - if (handle == INVALID_HANDLE_VALUE) { - DeleteFileW (file_name); - return NULL; - } - - fd = _open_osfhandle((intptr_t) handle, 0); - if (fd < 0) { - CloseHandle (handle); - return NULL; - } - - fp = fdopen(fd, "w+b"); - if (fp == NULL) { - _close(fd); - return NULL; - } - - return fp; -} diff --git a/src/cairo-xlib-xrender-private.h b/src/cairo-xlib-xrender-private.h index a61a67e5..329262c7 100644 --- a/src/cairo-xlib-xrender-private.h +++ b/src/cairo-xlib-xrender-private.h @@ -33,6 +33,11 @@ #ifndef CAIRO_XLIB_XRENDER_PRIVATE_H #define CAIRO_XLIB_XRENDER_PRIVATE_H +#include "cairo-features.h" +#include "cairo-compiler-private.h" + +#include <X11/Xlib.h> + #if CAIRO_HAS_XLIB_XRENDER_SURFACE #include "cairo-xlib-xrender.h" @@ -52,7 +57,7 @@ * take a pointer as first argument */ __attribute__((__unused__)) static void _void_consume (void *p, ...) { } -__attribute__((__unused__)) static void * _voidp_consume (void *p, ...) { return NULL; } +__attribute__((__unused__)) static void * _voidp_consume (void *p, ...) { return (void *)0; } __attribute__((__unused__)) static int _int_consume (void *p, ...) { return 0; } __attribute__((__unused__)) static void _void_consume_free (Display *p, XID n) { } diff --git a/src/cairoint.h b/src/cairoint.h index 69865462..bffceb3e 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -75,6 +75,14 @@ #include "cairo-compiler-private.h" +#if defined(CAIRO_HAS_PS_SURFACE) || defined(CAIRO_HAS_PDF_SURFACE) || defined(CAIRO_HAS_SVG_SURFACE) +#define CAIRO_HAS_FONT_SUBSET 1 +#endif + +#if defined(CAIRO_HAS_PS_SURFACE) || defined(CAIRO_HAS_PDF_SURFACE) +#define CAIRO_HAS_PDF_OPERATORS 1 +#endif + CAIRO_BEGIN_DECLS #ifdef _WIN32 @@ -316,8 +324,6 @@ _cairo_user_data_array_set_data (cairo_user_data_array_t *array, cairo_private unsigned long _cairo_hash_string (const char *c); -typedef struct _cairo_unscaled_font_backend cairo_unscaled_font_backend_t; - /* * A #cairo_unscaled_font_t is just an opaque handle we use in the * glyph cache. @@ -504,8 +510,6 @@ extern const cairo_private struct _cairo_scaled_font_backend _cairo_quartz_scale #endif -typedef struct _cairo_solid_pattern cairo_solid_pattern_t; - struct _cairo_surface_backend { cairo_surface_type_t type; @@ -972,8 +976,6 @@ typedef struct _cairo_traps { #define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0 #define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0 -typedef struct _cairo_gstate cairo_gstate_t; - typedef struct _cairo_stroke_face { cairo_point_t ccw; cairo_point_t point; diff --git a/src/check-doc-syntax.sh b/src/check-doc-syntax.sh index bd07c4d1..98ea61e9 100755 --- a/src/check-doc-syntax.sh +++ b/src/check-doc-syntax.sh @@ -17,7 +17,7 @@ echo Checking documentation for incorrect syntax # Note: this test is also run from doc/public/ to check the SGML files if test "x$SGML_DOCS" = x; then - FILES=$cairo_all_source_files + FILES=$all_cairo_files if test "x$FILES" = x; then FILES=`find "$srcdir" -name '*.h' -or -name '*.c' -or -name '*.cpp'` fi diff --git a/test/.gitignore b/test/.gitignore index 3011930a..14cc7df6 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,4 +1,5 @@ TAGS +tags .deps .libs Makefile diff --git a/test/Makefile.am b/test/Makefile.am index 002f5786..7f837138 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -914,6 +914,9 @@ CLEANFILES = \ index.html \ ref.hash \ png-test.png \ + svg-surface-source.svg \ + pdf-surface-source.pdf \ + ps-surface-source.ps \ $(EXTRA_LTLIBRARIES) \ $(EXTRA_PROGRAMS) diff --git a/test/pdiff/.gitignore b/test/pdiff/.gitignore index d2e5a947..f44ed659 100644 --- a/test/pdiff/.gitignore +++ b/test/pdiff/.gitignore @@ -1 +1,3 @@ +TAGS +tags perceptualdiff diff --git a/util/README b/util/README new file mode 100644 index 00000000..62527dd5 --- /dev/null +++ b/util/README @@ -0,0 +1,69 @@ +Cairo Utilities +=============== + +There are a varieties of utilities we use with cairo. + + +backtrace-symbols +----------------- + +This is a small shared library designed to be preloaded by the +linker and its purpose is to make the backtrace_symbols() function +of glibc produce more useful source reference information. + +Build by: + + make backtrace-symbols.so + +and use by: + + LD_PRELOAD=$PWD/backtrace-symbols.so app-to-run + +This code should be contributed back to glibc at some point. + + +malloc-stats +------------ + +This is a small shared library designed to be preloaded by the +linker and its purpose is to make the malloc_stats() function +of glibc produce more useful information. + +Build by: + + make malloc-stats.so + +and use by: + + LD_PRELOAD=$PWD/malloc-stats.so app-to-run + +This works best when backtrace-symbols is in use. That is: + + LD_PRELOAD="$PWD/backtrace-symbols.so $PWD/malloc-stats.so" app-to-run + + +cairo-trace +----------- + +This tool can be used to trace all the cairo function calls made by an +applications. This is useful for either extracting a test case triggering +a bug from an application, or simply to get a general idea of how an +application is using cairo. + +This tool lives outside the cairo source distribution right now and can +be found in a git repository at: + + http://cgit.freedesktop.org/~ickle/cairo-trace/ + +There are plans to move it to this directory in the future, and possibly +install it on the system. + + +cairo-api-update and xr2cairo +----------------------------- + +These two scripts were used to convert source code written for pre-1.0 +cairo to newer API. See $(top_srcdir)/PORTING_GUIDE for more information. + +These files are obsolete now and may be removed in a future version. + |