diff options
Diffstat (limited to 'boilerplate')
40 files changed, 2783 insertions, 1772 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am index 980bae4..10fb6af 100644 --- a/boilerplate/Makefile.am +++ b/boilerplate/Makefile.am @@ -20,8 +20,12 @@ libcairoboilerplate_la_SOURCES = \ $(enabled_cairo_boilerplate_headers) \ $(enabled_cairo_boilerplate_private) \ $(enabled_cairo_boilerplate_sources) \ + cairo-boilerplate-constructors.c \ $(NULL) libcairoboilerplate_la_LIBADD = $(top_builddir)/src/libcairo.la +if CAIRO_HAS_DL +libcairoboilerplate_la_LIBADD += -ldl +endif if CAIRO_HAS_BEOS_SURFACE # BeOS system headers trigger this warning @@ -45,6 +49,15 @@ if CAIRO_HAS_WIN32_SURFACE libcairoboilerplate_la_LIBADD += -lwinspool endif +libcairoboilerplate_la_LIBADD += $(CAIROBOILERPLATE_LIBS) + +cairo-boilerplate-constructors.c: Makefile $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors.sh + (cd $(srcdir) && sh ./make-cairo-boilerplate-constructors.sh $(enabled_cairo_boilerplate_sources)) > $@ + +BUILT_SOURCES += cairo-boilerplate-constructors.c +EXTRA_DIST += $(BUILT_SOURCES) make-cairo-boilerplate-constructors.sh +CLEANFILES += $(BUILT_SOURCES) + test: check if CROSS_COMPILING diff --git a/boilerplate/Makefile.am.features b/boilerplate/Makefile.am.features index 877dd5f..ad9f263 100644 --- a/boilerplate/Makefile.am.features +++ b/boilerplate/Makefile.am.features @@ -45,6 +45,16 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_xcb_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_xcb_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_qt_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_qt_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_qt_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_qt_sources) +if CAIRO_HAS_QT_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_qt_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_qt_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_qt_sources) +endif + supported_cairo_boilerplate_headers += $(cairo_boilerplate_quartz_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_quartz_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_quartz_private) @@ -95,6 +105,16 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_win32_font_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_win32_font_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_skia_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_skia_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_skia_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_skia_sources) +if CAIRO_HAS_SKIA_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_skia_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_skia_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_skia_sources) +endif + unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_os2_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_os2_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_os2_private) @@ -115,6 +135,26 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_beos_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_beos_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_drm_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_drm_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_drm_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_drm_sources) +if CAIRO_HAS_DRM_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_drm_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_drm_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_drm_sources) +endif + +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_gallium_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_gallium_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_gallium_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_gallium_sources) +if CAIRO_HAS_GALLIUM_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_gallium_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_gallium_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_gallium_sources) +endif + supported_cairo_boilerplate_headers += $(cairo_boilerplate_png_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_png_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_png_private) @@ -125,6 +165,16 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_png_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_png_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_gl_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_gl_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_gl_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_gl_sources) +if CAIRO_HAS_GL_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_gl_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_gl_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_gl_sources) +endif + unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_glitz_private) @@ -145,6 +195,46 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_directfb_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_directfb_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_vg_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_vg_sources) +if CAIRO_HAS_VG_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_vg_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_vg_sources) +endif + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_eagle_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_eagle_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_eagle_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_eagle_sources) +if CAIRO_HAS_EAGLE_FUNCTIONS +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_eagle_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_eagle_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_eagle_sources) +endif + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_egl_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_egl_sources) +if CAIRO_HAS_EGL_FUNCTIONS +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_egl_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_egl_sources) +endif + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_glx_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_glx_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_glx_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_glx_sources) +if CAIRO_HAS_GLX_FUNCTIONS +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_glx_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_glx_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_glx_sources) +endif + unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_script_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_script_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_script_private) @@ -220,6 +310,32 @@ enabled_cairo_boilerplate_headers += $(cairo_boilerplate_image_headers) enabled_cairo_boilerplate_private += $(cairo_boilerplate_image_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_image_sources) +supported_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_meta_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_meta_sources) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_meta_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_meta_sources) + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_tee_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_tee_sources) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_tee_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_tee_sources) + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_xml_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_xml_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_xml_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_xml_sources) +if CAIRO_HAS_XML_SURFACE +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_xml_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_xml_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_xml_sources) +endif + supported_cairo_boilerplate_headers += $(cairo_boilerplate_user_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_user_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_user_private) @@ -227,3 +343,24 @@ all_cairo_boilerplate_sources += $(cairo_boilerplate_user_sources) enabled_cairo_boilerplate_headers += $(cairo_boilerplate_user_headers) enabled_cairo_boilerplate_private += $(cairo_boilerplate_user_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_user_sources) + +all_cairo_boilerplate_private += $(cairo_boilerplate_trace_private) $(cairo_boilerplate_trace_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_trace_sources) +if CAIRO_HAS_TRACE +enabled_cairo_boilerplate_private += $(cairo_boilerplate_trace_private) $(cairo_boilerplate_trace_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_trace_sources) +endif + +all_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources) +if CAIRO_HAS_INTERPRETER +enabled_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources) +endif + +all_cairo_boilerplate_private += $(cairo_boilerplate_symbol_lookup_private) $(cairo_boilerplate_symbol_lookup_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_symbol_lookup_sources) +if CAIRO_HAS_SYMBOL_LOOKUP +enabled_cairo_boilerplate_private += $(cairo_boilerplate_symbol_lookup_private) $(cairo_boilerplate_symbol_lookup_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_symbol_lookup_sources) +endif diff --git a/boilerplate/Makefile.in b/boilerplate/Makefile.in index 3986a02..3ae9e1c 100644 --- a/boilerplate/Makefile.in +++ b/boilerplate/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.10.2 from Makefile.am. +# Makefile.in generated by automake 1.11 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -25,8 +26,9 @@ # VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c @@ -56,65 +58,102 @@ check_PROGRAMS = check-link$(EXEEXT) @CAIRO_HAS_XCB_SURFACE_TRUE@am__append_7 = $(cairo_boilerplate_xcb_headers) @CAIRO_HAS_XCB_SURFACE_TRUE@am__append_8 = $(cairo_boilerplate_xcb_private) @CAIRO_HAS_XCB_SURFACE_TRUE@am__append_9 = $(cairo_boilerplate_xcb_sources) -@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__append_10 = $(cairo_boilerplate_quartz_headers) -@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__append_11 = $(cairo_boilerplate_quartz_private) -@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__append_12 = $(cairo_boilerplate_quartz_sources) -@CAIRO_HAS_QUARTZ_FONT_TRUE@am__append_13 = $(cairo_boilerplate_quartz_font_headers) -@CAIRO_HAS_QUARTZ_FONT_TRUE@am__append_14 = $(cairo_boilerplate_quartz_font_private) -@CAIRO_HAS_QUARTZ_FONT_TRUE@am__append_15 = $(cairo_boilerplate_quartz_font_sources) -@CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TRUE@am__append_16 = $(cairo_boilerplate_quartz_image_headers) -@CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TRUE@am__append_17 = $(cairo_boilerplate_quartz_image_private) -@CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TRUE@am__append_18 = $(cairo_boilerplate_quartz_image_sources) -@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_19 = $(cairo_boilerplate_win32_headers) -@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_20 = $(cairo_boilerplate_win32_private) -@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_21 = $(cairo_boilerplate_win32_sources) -@CAIRO_HAS_WIN32_FONT_TRUE@am__append_22 = $(cairo_boilerplate_win32_font_headers) -@CAIRO_HAS_WIN32_FONT_TRUE@am__append_23 = $(cairo_boilerplate_win32_font_private) -@CAIRO_HAS_WIN32_FONT_TRUE@am__append_24 = $(cairo_boilerplate_win32_font_sources) -@CAIRO_HAS_OS2_SURFACE_TRUE@am__append_25 = $(cairo_boilerplate_os2_headers) -@CAIRO_HAS_OS2_SURFACE_TRUE@am__append_26 = $(cairo_boilerplate_os2_private) -@CAIRO_HAS_OS2_SURFACE_TRUE@am__append_27 = $(cairo_boilerplate_os2_sources) -@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_28 = $(cairo_boilerplate_beos_headers) -@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_29 = $(cairo_boilerplate_beos_private) -@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_30 = $(cairo_boilerplate_beos_sources) -@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_31 = $(cairo_boilerplate_png_headers) -@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_32 = $(cairo_boilerplate_png_private) -@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_33 = $(cairo_boilerplate_png_sources) -@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__append_34 = $(cairo_boilerplate_glitz_headers) -@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__append_35 = $(cairo_boilerplate_glitz_private) -@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__append_36 = $(cairo_boilerplate_glitz_sources) -@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__append_37 = $(cairo_boilerplate_directfb_headers) -@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__append_38 = $(cairo_boilerplate_directfb_private) -@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__append_39 = $(cairo_boilerplate_directfb_sources) -@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__append_40 = $(cairo_boilerplate_script_headers) -@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__append_41 = $(cairo_boilerplate_script_private) -@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__append_42 = $(cairo_boilerplate_script_sources) -@CAIRO_HAS_FT_FONT_TRUE@am__append_43 = $(cairo_boilerplate_ft_headers) -@CAIRO_HAS_FT_FONT_TRUE@am__append_44 = $(cairo_boilerplate_ft_private) -@CAIRO_HAS_FT_FONT_TRUE@am__append_45 = $(cairo_boilerplate_ft_sources) -@CAIRO_HAS_FC_FONT_TRUE@am__append_46 = $(cairo_boilerplate_fc_headers) -@CAIRO_HAS_FC_FONT_TRUE@am__append_47 = $(cairo_boilerplate_fc_private) -@CAIRO_HAS_FC_FONT_TRUE@am__append_48 = $(cairo_boilerplate_fc_sources) -@CAIRO_HAS_PS_SURFACE_TRUE@am__append_49 = $(cairo_boilerplate_ps_headers) -@CAIRO_HAS_PS_SURFACE_TRUE@am__append_50 = $(cairo_boilerplate_ps_private) -@CAIRO_HAS_PS_SURFACE_TRUE@am__append_51 = $(cairo_boilerplate_ps_sources) -@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_52 = $(cairo_boilerplate_pdf_headers) -@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_53 = $(cairo_boilerplate_pdf_private) -@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_54 = $(cairo_boilerplate_pdf_sources) -@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_55 = $(cairo_boilerplate_svg_headers) -@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_56 = $(cairo_boilerplate_svg_private) -@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_57 = $(cairo_boilerplate_svg_sources) -@CAIRO_HAS_TEST_SURFACES_TRUE@am__append_58 = $(cairo_boilerplate_test_surfaces_private) $(cairo_boilerplate_test_surfaces_headers) -@CAIRO_HAS_TEST_SURFACES_TRUE@am__append_59 = $(cairo_boilerplate_test_surfaces_sources) +@CAIRO_HAS_QT_SURFACE_TRUE@am__append_10 = $(cairo_boilerplate_qt_headers) +@CAIRO_HAS_QT_SURFACE_TRUE@am__append_11 = $(cairo_boilerplate_qt_private) +@CAIRO_HAS_QT_SURFACE_TRUE@am__append_12 = $(cairo_boilerplate_qt_sources) +@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__append_13 = $(cairo_boilerplate_quartz_headers) +@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__append_14 = $(cairo_boilerplate_quartz_private) +@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__append_15 = $(cairo_boilerplate_quartz_sources) +@CAIRO_HAS_QUARTZ_FONT_TRUE@am__append_16 = $(cairo_boilerplate_quartz_font_headers) +@CAIRO_HAS_QUARTZ_FONT_TRUE@am__append_17 = $(cairo_boilerplate_quartz_font_private) +@CAIRO_HAS_QUARTZ_FONT_TRUE@am__append_18 = $(cairo_boilerplate_quartz_font_sources) +@CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TRUE@am__append_19 = $(cairo_boilerplate_quartz_image_headers) +@CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TRUE@am__append_20 = $(cairo_boilerplate_quartz_image_private) +@CAIRO_HAS_QUARTZ_IMAGE_SURFACE_TRUE@am__append_21 = $(cairo_boilerplate_quartz_image_sources) +@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_22 = $(cairo_boilerplate_win32_headers) +@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_23 = $(cairo_boilerplate_win32_private) +@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_24 = $(cairo_boilerplate_win32_sources) +@CAIRO_HAS_WIN32_FONT_TRUE@am__append_25 = $(cairo_boilerplate_win32_font_headers) +@CAIRO_HAS_WIN32_FONT_TRUE@am__append_26 = $(cairo_boilerplate_win32_font_private) +@CAIRO_HAS_WIN32_FONT_TRUE@am__append_27 = $(cairo_boilerplate_win32_font_sources) +@CAIRO_HAS_SKIA_SURFACE_TRUE@am__append_28 = $(cairo_boilerplate_skia_headers) +@CAIRO_HAS_SKIA_SURFACE_TRUE@am__append_29 = $(cairo_boilerplate_skia_private) +@CAIRO_HAS_SKIA_SURFACE_TRUE@am__append_30 = $(cairo_boilerplate_skia_sources) +@CAIRO_HAS_OS2_SURFACE_TRUE@am__append_31 = $(cairo_boilerplate_os2_headers) +@CAIRO_HAS_OS2_SURFACE_TRUE@am__append_32 = $(cairo_boilerplate_os2_private) +@CAIRO_HAS_OS2_SURFACE_TRUE@am__append_33 = $(cairo_boilerplate_os2_sources) +@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_34 = $(cairo_boilerplate_beos_headers) +@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_35 = $(cairo_boilerplate_beos_private) +@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_36 = $(cairo_boilerplate_beos_sources) +@CAIRO_HAS_DRM_SURFACE_TRUE@am__append_37 = $(cairo_boilerplate_drm_headers) +@CAIRO_HAS_DRM_SURFACE_TRUE@am__append_38 = $(cairo_boilerplate_drm_private) +@CAIRO_HAS_DRM_SURFACE_TRUE@am__append_39 = $(cairo_boilerplate_drm_sources) +@CAIRO_HAS_GALLIUM_SURFACE_TRUE@am__append_40 = $(cairo_boilerplate_gallium_headers) +@CAIRO_HAS_GALLIUM_SURFACE_TRUE@am__append_41 = $(cairo_boilerplate_gallium_private) +@CAIRO_HAS_GALLIUM_SURFACE_TRUE@am__append_42 = $(cairo_boilerplate_gallium_sources) +@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_43 = $(cairo_boilerplate_png_headers) +@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_44 = $(cairo_boilerplate_png_private) +@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_45 = $(cairo_boilerplate_png_sources) +@CAIRO_HAS_GL_SURFACE_TRUE@am__append_46 = $(cairo_boilerplate_gl_headers) +@CAIRO_HAS_GL_SURFACE_TRUE@am__append_47 = $(cairo_boilerplate_gl_private) +@CAIRO_HAS_GL_SURFACE_TRUE@am__append_48 = $(cairo_boilerplate_gl_sources) +@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__append_49 = $(cairo_boilerplate_glitz_headers) +@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__append_50 = $(cairo_boilerplate_glitz_private) +@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__append_51 = $(cairo_boilerplate_glitz_sources) +@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__append_52 = $(cairo_boilerplate_directfb_headers) +@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__append_53 = $(cairo_boilerplate_directfb_private) +@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__append_54 = $(cairo_boilerplate_directfb_sources) +@CAIRO_HAS_VG_SURFACE_TRUE@am__append_55 = $(cairo_boilerplate_vg_headers) +@CAIRO_HAS_VG_SURFACE_TRUE@am__append_56 = $(cairo_boilerplate_vg_private) +@CAIRO_HAS_VG_SURFACE_TRUE@am__append_57 = $(cairo_boilerplate_vg_sources) +@CAIRO_HAS_EAGLE_FUNCTIONS_TRUE@am__append_58 = $(cairo_boilerplate_eagle_headers) +@CAIRO_HAS_EAGLE_FUNCTIONS_TRUE@am__append_59 = $(cairo_boilerplate_eagle_private) +@CAIRO_HAS_EAGLE_FUNCTIONS_TRUE@am__append_60 = $(cairo_boilerplate_eagle_sources) +@CAIRO_HAS_EGL_FUNCTIONS_TRUE@am__append_61 = $(cairo_boilerplate_egl_headers) +@CAIRO_HAS_EGL_FUNCTIONS_TRUE@am__append_62 = $(cairo_boilerplate_egl_private) +@CAIRO_HAS_EGL_FUNCTIONS_TRUE@am__append_63 = $(cairo_boilerplate_egl_sources) +@CAIRO_HAS_GLX_FUNCTIONS_TRUE@am__append_64 = $(cairo_boilerplate_glx_headers) +@CAIRO_HAS_GLX_FUNCTIONS_TRUE@am__append_65 = $(cairo_boilerplate_glx_private) +@CAIRO_HAS_GLX_FUNCTIONS_TRUE@am__append_66 = $(cairo_boilerplate_glx_sources) +@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__append_67 = $(cairo_boilerplate_script_headers) +@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__append_68 = $(cairo_boilerplate_script_private) +@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__append_69 = $(cairo_boilerplate_script_sources) +@CAIRO_HAS_FT_FONT_TRUE@am__append_70 = $(cairo_boilerplate_ft_headers) +@CAIRO_HAS_FT_FONT_TRUE@am__append_71 = $(cairo_boilerplate_ft_private) +@CAIRO_HAS_FT_FONT_TRUE@am__append_72 = $(cairo_boilerplate_ft_sources) +@CAIRO_HAS_FC_FONT_TRUE@am__append_73 = $(cairo_boilerplate_fc_headers) +@CAIRO_HAS_FC_FONT_TRUE@am__append_74 = $(cairo_boilerplate_fc_private) +@CAIRO_HAS_FC_FONT_TRUE@am__append_75 = $(cairo_boilerplate_fc_sources) +@CAIRO_HAS_PS_SURFACE_TRUE@am__append_76 = $(cairo_boilerplate_ps_headers) +@CAIRO_HAS_PS_SURFACE_TRUE@am__append_77 = $(cairo_boilerplate_ps_private) +@CAIRO_HAS_PS_SURFACE_TRUE@am__append_78 = $(cairo_boilerplate_ps_sources) +@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_79 = $(cairo_boilerplate_pdf_headers) +@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_80 = $(cairo_boilerplate_pdf_private) +@CAIRO_HAS_PDF_SURFACE_TRUE@am__append_81 = $(cairo_boilerplate_pdf_sources) +@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_82 = $(cairo_boilerplate_svg_headers) +@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_83 = $(cairo_boilerplate_svg_private) +@CAIRO_HAS_SVG_SURFACE_TRUE@am__append_84 = $(cairo_boilerplate_svg_sources) +@CAIRO_HAS_TEST_SURFACES_TRUE@am__append_85 = $(cairo_boilerplate_test_surfaces_private) $(cairo_boilerplate_test_surfaces_headers) +@CAIRO_HAS_TEST_SURFACES_TRUE@am__append_86 = $(cairo_boilerplate_test_surfaces_sources) +@CAIRO_HAS_XML_SURFACE_TRUE@am__append_87 = $(cairo_boilerplate_xml_headers) +@CAIRO_HAS_XML_SURFACE_TRUE@am__append_88 = $(cairo_boilerplate_xml_private) +@CAIRO_HAS_XML_SURFACE_TRUE@am__append_89 = $(cairo_boilerplate_xml_sources) +@CAIRO_HAS_TRACE_TRUE@am__append_90 = $(cairo_boilerplate_trace_private) $(cairo_boilerplate_trace_headers) +@CAIRO_HAS_TRACE_TRUE@am__append_91 = $(cairo_boilerplate_trace_sources) +@CAIRO_HAS_INTERPRETER_TRUE@am__append_92 = $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +@CAIRO_HAS_INTERPRETER_TRUE@am__append_93 = $(cairo_boilerplate_interpreter_sources) +@CAIRO_HAS_SYMBOL_LOOKUP_TRUE@am__append_94 = $(cairo_boilerplate_symbol_lookup_private) $(cairo_boilerplate_symbol_lookup_headers) +@CAIRO_HAS_SYMBOL_LOOKUP_TRUE@am__append_95 = $(cairo_boilerplate_symbol_lookup_sources) +@CAIRO_HAS_DL_TRUE@am__append_96 = -ldl # BeOS system headers trigger this warning -@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_60 = -Wno-multichar -@CAIRO_CAN_TEST_GLITZ_AGL_SURFACE_TRUE@am__append_61 = $(GLITZ_AGL_LIBS) -@CAIRO_CAN_TEST_GLITZ_EGL_SURFACE_TRUE@am__append_62 = $(GLITZ_EGL_LIBS) -@CAIRO_CAN_TEST_GLITZ_GLX_SURFACE_TRUE@am__append_63 = $(GLITZ_GLX_LIBS) -@CAIRO_CAN_TEST_GLITZ_WGL_SURFACE_TRUE@am__append_64 = $(GLITZ_WGL_LIBS) -@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_65 = -lwinspool -@CROSS_COMPILING_FALSE@am__append_66 = check-link$(EXEEXT) +@CAIRO_HAS_BEOS_SURFACE_TRUE@am__append_97 = -Wno-multichar +@CAIRO_CAN_TEST_GLITZ_AGL_SURFACE_TRUE@am__append_98 = $(GLITZ_AGL_LIBS) +@CAIRO_CAN_TEST_GLITZ_EGL_SURFACE_TRUE@am__append_99 = $(GLITZ_EGL_LIBS) +@CAIRO_CAN_TEST_GLITZ_GLX_SURFACE_TRUE@am__append_100 = $(GLITZ_GLX_LIBS) +@CAIRO_CAN_TEST_GLITZ_WGL_SURFACE_TRUE@am__append_101 = $(GLITZ_WGL_LIBS) +@CAIRO_HAS_WIN32_SURFACE_TRUE@am__append_102 = -lwinspool +@CROSS_COMPILING_FALSE@am__append_103 = check-link$(EXEEXT) subdir = boilerplate ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/build/aclocal.cairo.m4 \ @@ -145,6 +184,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = am__DEPENDENCIES_1 = @CAIRO_CAN_TEST_GLITZ_AGL_SURFACE_TRUE@am__DEPENDENCIES_2 = \ @CAIRO_CAN_TEST_GLITZ_AGL_SURFACE_TRUE@ $(am__DEPENDENCIES_1) @@ -155,32 +195,26 @@ am__DEPENDENCIES_1 = @CAIRO_CAN_TEST_GLITZ_WGL_SURFACE_TRUE@am__DEPENDENCIES_5 = \ @CAIRO_CAN_TEST_GLITZ_WGL_SURFACE_TRUE@ $(am__DEPENDENCIES_1) libcairoboilerplate_la_DEPENDENCIES = $(top_builddir)/src/libcairo.la \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) \ + $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) am__libcairoboilerplate_la_SOURCES_DIST = cairo-boilerplate-getopt.h \ cairo-boilerplate-scaled-font.h cairo-boilerplate-system.h \ cairo-boilerplate.h cairo-boilerplate-xlib.h \ - cairo-boilerplate-xlib-private.h \ - cairo-boilerplate-xcb-private.h \ - cairo-boilerplate-quartz-private.h \ - cairo-boilerplate-win32-private.h \ - cairo-boilerplate-beos-private.h \ - cairo-boilerplate-glitz-private.h \ - cairo-boilerplate-directfb-private.h \ - cairo-boilerplate-script-private.h \ - cairo-boilerplate-ps-private.h cairo-boilerplate-pdf-private.h \ - cairo-boilerplate-svg-private.h \ - cairo-boilerplate-test-surfaces-private.h \ - cairo-boilerplate-getopt.c cairo-boilerplate-system.c \ - cairo-boilerplate.c cairo-boilerplate-xlib.c \ - cairo-boilerplate-xcb.c cairo-boilerplate-quartz.c \ + cairo-boilerplate-private.h cairo-boilerplate-getopt.c \ + cairo-boilerplate-system.c cairo-boilerplate.c \ + cairo-boilerplate-xlib.c cairo-boilerplate-xcb.c \ + cairo-boilerplate-qt.cpp cairo-boilerplate-quartz.c \ cairo-boilerplate-win32.c cairo-boilerplate-win32-printing.c \ - cairo-boilerplate-glitz-agl.c cairo-boilerplate-glitz-glx.c \ - cairo-boilerplate-glitz-wgl.c cairo-boilerplate-directfb.c \ + cairo-boilerplate-skia.c cairo-boilerplate-drm.c \ + cairo-boilerplate-gl.c cairo-boilerplate-glitz-agl.c \ + cairo-boilerplate-glitz-glx.c cairo-boilerplate-glitz-wgl.c \ + cairo-boilerplate-directfb.c cairo-boilerplate-vg.c \ cairo-boilerplate-script.c cairo-boilerplate-ps.c \ cairo-boilerplate-pdf.c cairo-boilerplate-svg.c \ - cairo-boilerplate-test-surfaces.c + cairo-boilerplate-test-surfaces.c \ + cairo-boilerplate-constructors.c am__objects_1 = @CAIRO_HAS_XLIB_SURFACE_TRUE@am__objects_2 = $(am__objects_1) am__objects_3 = $(am__objects_1) $(am__objects_2) $(am__objects_1) \ @@ -189,60 +223,72 @@ am__objects_3 = $(am__objects_1) $(am__objects_2) $(am__objects_1) \ $(am__objects_1) $(am__objects_1) $(am__objects_1) \ $(am__objects_1) $(am__objects_1) $(am__objects_1) \ $(am__objects_1) $(am__objects_1) $(am__objects_1) \ - $(am__objects_1) $(am__objects_1) -@CAIRO_HAS_XCB_SURFACE_TRUE@am__objects_4 = $(am__objects_1) -@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__objects_5 = $(am__objects_1) -@CAIRO_HAS_WIN32_SURFACE_TRUE@am__objects_6 = $(am__objects_1) -@CAIRO_HAS_BEOS_SURFACE_TRUE@am__objects_7 = $(am__objects_1) -@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__objects_8 = $(am__objects_1) -@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__objects_9 = $(am__objects_1) -@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__objects_10 = $(am__objects_1) -@CAIRO_HAS_PS_SURFACE_TRUE@am__objects_11 = $(am__objects_1) -@CAIRO_HAS_PDF_SURFACE_TRUE@am__objects_12 = $(am__objects_1) -@CAIRO_HAS_SVG_SURFACE_TRUE@am__objects_13 = $(am__objects_1) -@CAIRO_HAS_TEST_SURFACES_TRUE@am__objects_14 = $(am__objects_1) -am__objects_15 = $(am__objects_2) $(am__objects_1) $(am__objects_4) \ - $(am__objects_5) $(am__objects_1) $(am__objects_1) \ - $(am__objects_6) $(am__objects_1) $(am__objects_1) \ - $(am__objects_7) $(am__objects_1) $(am__objects_8) \ - $(am__objects_9) $(am__objects_10) $(am__objects_1) \ - $(am__objects_1) $(am__objects_11) $(am__objects_12) \ - $(am__objects_13) $(am__objects_14) -am__objects_16 = cairo-boilerplate-getopt.lo \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) +am__objects_4 = $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_1) \ + $(am__objects_1) +am__objects_5 = cairo-boilerplate-getopt.lo \ cairo-boilerplate-system.lo cairo-boilerplate.lo -am__objects_17 = cairo-boilerplate-xlib.lo -@CAIRO_HAS_XLIB_SURFACE_TRUE@am__objects_18 = $(am__objects_17) -am__objects_19 = cairo-boilerplate-xcb.lo -@CAIRO_HAS_XCB_SURFACE_TRUE@am__objects_20 = $(am__objects_19) -am__objects_21 = cairo-boilerplate-quartz.lo -@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__objects_22 = $(am__objects_21) -am__objects_23 = cairo-boilerplate-win32.lo \ +am__objects_6 = cairo-boilerplate-xlib.lo +@CAIRO_HAS_XLIB_SURFACE_TRUE@am__objects_7 = $(am__objects_6) +am__objects_8 = cairo-boilerplate-xcb.lo +@CAIRO_HAS_XCB_SURFACE_TRUE@am__objects_9 = $(am__objects_8) +am__objects_10 = cairo-boilerplate-qt.lo +@CAIRO_HAS_QT_SURFACE_TRUE@am__objects_11 = $(am__objects_10) +am__objects_12 = cairo-boilerplate-quartz.lo +@CAIRO_HAS_QUARTZ_SURFACE_TRUE@am__objects_13 = $(am__objects_12) +am__objects_14 = cairo-boilerplate-win32.lo \ cairo-boilerplate-win32-printing.lo -@CAIRO_HAS_WIN32_SURFACE_TRUE@am__objects_24 = $(am__objects_23) -am__objects_25 = cairo-boilerplate-glitz-agl.lo \ +@CAIRO_HAS_WIN32_SURFACE_TRUE@am__objects_15 = $(am__objects_14) +am__objects_16 = cairo-boilerplate-skia.lo +@CAIRO_HAS_SKIA_SURFACE_TRUE@am__objects_17 = $(am__objects_16) +am__objects_18 = cairo-boilerplate-drm.lo +@CAIRO_HAS_DRM_SURFACE_TRUE@am__objects_19 = $(am__objects_18) +am__objects_20 = cairo-boilerplate-gl.lo +@CAIRO_HAS_GL_SURFACE_TRUE@am__objects_21 = $(am__objects_20) +am__objects_22 = cairo-boilerplate-glitz-agl.lo \ cairo-boilerplate-glitz-glx.lo cairo-boilerplate-glitz-wgl.lo -@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__objects_26 = $(am__objects_25) -am__objects_27 = cairo-boilerplate-directfb.lo -@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__objects_28 = $(am__objects_27) -am__objects_29 = cairo-boilerplate-script.lo -@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__objects_30 = $(am__objects_29) -am__objects_31 = cairo-boilerplate-ps.lo -@CAIRO_HAS_PS_SURFACE_TRUE@am__objects_32 = $(am__objects_31) -am__objects_33 = cairo-boilerplate-pdf.lo -@CAIRO_HAS_PDF_SURFACE_TRUE@am__objects_34 = $(am__objects_33) -am__objects_35 = cairo-boilerplate-svg.lo -@CAIRO_HAS_SVG_SURFACE_TRUE@am__objects_36 = $(am__objects_35) -am__objects_37 = cairo-boilerplate-test-surfaces.lo -@CAIRO_HAS_TEST_SURFACES_TRUE@am__objects_38 = $(am__objects_37) -am__objects_39 = $(am__objects_16) $(am__objects_18) $(am__objects_1) \ - $(am__objects_20) $(am__objects_22) $(am__objects_1) \ - $(am__objects_1) $(am__objects_24) $(am__objects_1) \ +@CAIRO_HAS_GLITZ_SURFACE_TRUE@am__objects_23 = $(am__objects_22) +am__objects_24 = cairo-boilerplate-directfb.lo +@CAIRO_HAS_DIRECTFB_SURFACE_TRUE@am__objects_25 = $(am__objects_24) +am__objects_26 = cairo-boilerplate-vg.lo +@CAIRO_HAS_VG_SURFACE_TRUE@am__objects_27 = $(am__objects_26) +am__objects_28 = cairo-boilerplate-script.lo +@CAIRO_HAS_SCRIPT_SURFACE_TRUE@am__objects_29 = $(am__objects_28) +am__objects_30 = cairo-boilerplate-ps.lo +@CAIRO_HAS_PS_SURFACE_TRUE@am__objects_31 = $(am__objects_30) +am__objects_32 = cairo-boilerplate-pdf.lo +@CAIRO_HAS_PDF_SURFACE_TRUE@am__objects_33 = $(am__objects_32) +am__objects_34 = cairo-boilerplate-svg.lo +@CAIRO_HAS_SVG_SURFACE_TRUE@am__objects_35 = $(am__objects_34) +am__objects_36 = cairo-boilerplate-test-surfaces.lo +@CAIRO_HAS_TEST_SURFACES_TRUE@am__objects_37 = $(am__objects_36) +am__objects_38 = $(am__objects_5) $(am__objects_7) $(am__objects_1) \ + $(am__objects_9) $(am__objects_11) $(am__objects_13) \ + $(am__objects_1) $(am__objects_1) $(am__objects_15) \ + $(am__objects_1) $(am__objects_17) $(am__objects_1) \ + $(am__objects_1) $(am__objects_19) $(am__objects_1) \ + $(am__objects_1) $(am__objects_21) $(am__objects_23) \ + $(am__objects_25) $(am__objects_27) $(am__objects_1) \ + $(am__objects_1) $(am__objects_1) $(am__objects_29) \ + $(am__objects_1) $(am__objects_1) $(am__objects_31) \ + $(am__objects_33) $(am__objects_35) $(am__objects_37) \ $(am__objects_1) $(am__objects_1) $(am__objects_1) \ - $(am__objects_26) $(am__objects_28) $(am__objects_30) \ - $(am__objects_1) $(am__objects_1) $(am__objects_32) \ - $(am__objects_34) $(am__objects_36) $(am__objects_38) -am_libcairoboilerplate_la_OBJECTS = $(am__objects_3) $(am__objects_15) \ - $(am__objects_39) + $(am__objects_1) +am_libcairoboilerplate_la_OBJECTS = $(am__objects_3) $(am__objects_4) \ + $(am__objects_38) cairo-boilerplate-constructors.lo libcairoboilerplate_la_OBJECTS = $(am_libcairoboilerplate_la_OBJECTS) check_link_SOURCES = check-link.c check_link_OBJECTS = check-link.$(OBJEXT) @@ -250,16 +296,25 @@ check_link_DEPENDENCIES = libcairoboilerplate.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build/depcomp am__depfiles_maybe = depfiles +am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(libcairoboilerplate_la_SOURCES) check-link.c DIST_SOURCES = $(am__libcairoboilerplate_la_SOURCES_DIST) check-link.c ETAGS = etags CTAGS = ctags +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ @@ -271,6 +326,7 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BFD_LIBS = @BFD_LIBS@ +CAIROBOILERPLATE_LIBS = @CAIROBOILERPLATE_LIBS@ CAIROPERF_LIBS = @CAIROPERF_LIBS@ CAIRO_CFLAGS = @CAIRO_CFLAGS@ CAIRO_LDFLAGS = @CAIRO_LDFLAGS@ @@ -365,6 +421,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKGCONFIG_REQUIRES = @PKGCONFIG_REQUIRES@ @@ -376,6 +433,7 @@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SHM_LIBS = @SHM_LIBS@ SHTOOL = @SHTOOL@ STRIP = @STRIP@ V = @V@ @@ -412,8 +470,17 @@ datarootdir = @datarootdir@ directfb_CFLAGS = @directfb_CFLAGS@ directfb_LIBS = @directfb_LIBS@ docdir = @docdir@ +drm_CFLAGS = @drm_CFLAGS@ +drm_LIBS = @drm_LIBS@ dvidir = @dvidir@ +eagle_CFLAGS = @eagle_CFLAGS@ +eagle_LIBS = @eagle_LIBS@ exec_prefix = @exec_prefix@ +gallium_DIR = @gallium_DIR@ +gl_CFLAGS = @gl_CFLAGS@ +gl_LIBS = @gl_LIBS@ +glib_CFLAGS = @glib_CFLAGS@ +glib_LIBS = @glib_LIBS@ glitz_CFLAGS = @glitz_CFLAGS@ glitz_LIBS = @glitz_LIBS@ gtk_CFLAGS = @gtk_CFLAGS@ @@ -433,6 +500,7 @@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ +mesa_DIR = @mesa_DIR@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ @@ -444,9 +512,14 @@ png_REQUIRES = @png_REQUIRES@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +pthread_CFLAGS = @pthread_CFLAGS@ +pthread_LIBS = @pthread_LIBS@ +qt_CFLAGS = @qt_CFLAGS@ +qt_LIBS = @qt_LIBS@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ shavedir = @shavedir@ +skia_DIR = @skia_DIR@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ @@ -459,14 +532,15 @@ xlib_CFLAGS = @xlib_CFLAGS@ xlib_LIBS = @xlib_LIBS@ xlib_xrender_CFLAGS = @xlib_xrender_CFLAGS@ xlib_xrender_LIBS = @xlib_xrender_LIBS@ -BUILT_SOURCES = +BUILT_SOURCES = cairo-boilerplate-constructors.c CLEANFILES = *.i *.s *.gch $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) \ - $(check_PROGRAMS) + $(check_PROGRAMS) $(BUILT_SOURCES) DISTCLEANFILES = $(BUILT_SOURCES) -EXTRA_DIST = Makefile.win32 Makefile.win32.features +EXTRA_DIST = Makefile.win32 Makefile.win32.features $(BUILT_SOURCES) \ + make-cairo-boilerplate-constructors.sh EXTRA_LTLIBRARIES = libcairoboilerplate.la MAINTAINERCLEANFILES = Makefile.in -TESTS = $(am__append_66) +TESTS = $(am__append_103) cairo_boilerplate_headers = \ cairo-boilerplate-getopt.h \ cairo-boilerplate-scaled-font.h \ @@ -480,39 +554,36 @@ cairo_boilerplate_sources = \ cairo-boilerplate.c \ $(NULL) +cairo_boilerplate_private = \ + cairo-boilerplate-private.h \ + $(NULL) + # 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_boilerplate_beos_private = cairo-boilerplate-beos-private.h #libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos.cpp -cairo_boilerplate_directfb_private = cairo-boilerplate-directfb-private.h cairo_boilerplate_directfb_sources = cairo-boilerplate-directfb.c -cairo_boilerplate_glitz_private = cairo-boilerplate-glitz-private.h +cairo_boilerplate_drm_sources = cairo-boilerplate-drm.c +cairo_boilerplate_gl_sources = cairo-boilerplate-gl.c cairo_boilerplate_glitz_sources = \ cairo-boilerplate-glitz-agl.c \ cairo-boilerplate-glitz-glx.c \ cairo-boilerplate-glitz-wgl.c \ $(NULL) -cairo_boilerplate_pdf_private = cairo-boilerplate-pdf-private.h cairo_boilerplate_pdf_sources = cairo-boilerplate-pdf.c -cairo_boilerplate_ps_private = cairo-boilerplate-ps-private.h cairo_boilerplate_ps_sources = cairo-boilerplate-ps.c -cairo_boilerplate_quartz_private = cairo-boilerplate-quartz-private.h +cairo_boilerplate_qt_sources = cairo-boilerplate-qt.cpp cairo_boilerplate_quartz_sources = cairo-boilerplate-quartz.c -cairo_boilerplate_script_private = cairo-boilerplate-script-private.h cairo_boilerplate_script_sources = cairo-boilerplate-script.c -cairo_boilerplate_svg_private = cairo-boilerplate-svg-private.h +cairo_boilerplate_skia_sources = cairo-boilerplate-skia.c cairo_boilerplate_svg_sources = cairo-boilerplate-svg.c -cairo_boilerplate_test_surfaces_private = cairo-boilerplate-test-surfaces-private.h cairo_boilerplate_test_surfaces_sources = cairo-boilerplate-test-surfaces.c -cairo_boilerplate_win32_private = cairo-boilerplate-win32-private.h cairo_boilerplate_win32_sources = cairo-boilerplate-win32.c cairo-boilerplate-win32-printing.c -cairo_boilerplate_xcb_private = cairo-boilerplate-xcb-private.h cairo_boilerplate_xcb_sources = cairo-boilerplate-xcb.c cairo_boilerplate_xlib_headers = cairo-boilerplate-xlib.h -cairo_boilerplate_xlib_private = cairo-boilerplate-xlib-private.h cairo_boilerplate_xlib_sources = cairo-boilerplate-xlib.c +cairo_boilerplate_vg_sources = cairo-boilerplate-vg.c supported_cairo_boilerplate_headers = $(cairo_boilerplate_headers) \ $(cairo_boilerplate_xlib_headers) \ $(cairo_boilerplate_xlib_xrender_headers) \ @@ -521,36 +592,57 @@ supported_cairo_boilerplate_headers = $(cairo_boilerplate_headers) \ $(cairo_boilerplate_win32_headers) \ $(cairo_boilerplate_win32_font_headers) \ $(cairo_boilerplate_png_headers) \ + $(cairo_boilerplate_eagle_headers) \ + $(cairo_boilerplate_egl_headers) \ + $(cairo_boilerplate_glx_headers) \ $(cairo_boilerplate_ft_headers) \ $(cairo_boilerplate_fc_headers) \ $(cairo_boilerplate_ps_headers) \ $(cairo_boilerplate_pdf_headers) \ $(cairo_boilerplate_svg_headers) \ $(cairo_boilerplate_image_headers) \ + $(cairo_boilerplate_meta_headers) \ + $(cairo_boilerplate_tee_headers) \ + $(cairo_boilerplate_xml_headers) \ $(cairo_boilerplate_user_headers) unsupported_cairo_boilerplate_headers = \ $(cairo_boilerplate_xcb_headers) \ + $(cairo_boilerplate_qt_headers) \ $(cairo_boilerplate_quartz_image_headers) \ + $(cairo_boilerplate_skia_headers) \ $(cairo_boilerplate_os2_headers) \ $(cairo_boilerplate_beos_headers) \ + $(cairo_boilerplate_drm_headers) \ + $(cairo_boilerplate_gallium_headers) \ + $(cairo_boilerplate_gl_headers) \ $(cairo_boilerplate_glitz_headers) \ $(cairo_boilerplate_directfb_headers) \ + $(cairo_boilerplate_vg_headers) \ $(cairo_boilerplate_script_headers) all_cairo_boilerplate_files = $(all_cairo_boilerplate_headers) $(all_cairo_boilerplate_private) $(all_cairo_boilerplate_sources) all_cairo_boilerplate_headers = $(cairo_boilerplate_headers) \ $(cairo_boilerplate_xlib_headers) \ $(cairo_boilerplate_xlib_xrender_headers) \ $(cairo_boilerplate_xcb_headers) \ + $(cairo_boilerplate_qt_headers) \ $(cairo_boilerplate_quartz_headers) \ $(cairo_boilerplate_quartz_font_headers) \ $(cairo_boilerplate_quartz_image_headers) \ $(cairo_boilerplate_win32_headers) \ $(cairo_boilerplate_win32_font_headers) \ + $(cairo_boilerplate_skia_headers) \ $(cairo_boilerplate_os2_headers) \ $(cairo_boilerplate_beos_headers) \ + $(cairo_boilerplate_drm_headers) \ + $(cairo_boilerplate_gallium_headers) \ $(cairo_boilerplate_png_headers) \ + $(cairo_boilerplate_gl_headers) \ $(cairo_boilerplate_glitz_headers) \ $(cairo_boilerplate_directfb_headers) \ + $(cairo_boilerplate_vg_headers) \ + $(cairo_boilerplate_eagle_headers) \ + $(cairo_boilerplate_egl_headers) \ + $(cairo_boilerplate_glx_headers) \ $(cairo_boilerplate_script_headers) \ $(cairo_boilerplate_ft_headers) \ $(cairo_boilerplate_fc_headers) \ @@ -558,21 +650,33 @@ all_cairo_boilerplate_headers = $(cairo_boilerplate_headers) \ $(cairo_boilerplate_pdf_headers) \ $(cairo_boilerplate_svg_headers) \ $(cairo_boilerplate_image_headers) \ + $(cairo_boilerplate_meta_headers) \ + $(cairo_boilerplate_tee_headers) \ + $(cairo_boilerplate_xml_headers) \ $(cairo_boilerplate_user_headers) all_cairo_boilerplate_private = $(cairo_boilerplate_private) \ $(cairo_boilerplate_xlib_private) \ $(cairo_boilerplate_xlib_xrender_private) \ $(cairo_boilerplate_xcb_private) \ + $(cairo_boilerplate_qt_private) \ $(cairo_boilerplate_quartz_private) \ $(cairo_boilerplate_quartz_font_private) \ $(cairo_boilerplate_quartz_image_private) \ $(cairo_boilerplate_win32_private) \ $(cairo_boilerplate_win32_font_private) \ + $(cairo_boilerplate_skia_private) \ $(cairo_boilerplate_os2_private) \ $(cairo_boilerplate_beos_private) \ + $(cairo_boilerplate_drm_private) \ + $(cairo_boilerplate_gallium_private) \ $(cairo_boilerplate_png_private) \ + $(cairo_boilerplate_gl_private) \ $(cairo_boilerplate_glitz_private) \ $(cairo_boilerplate_directfb_private) \ + $(cairo_boilerplate_vg_private) \ + $(cairo_boilerplate_eagle_private) \ + $(cairo_boilerplate_egl_private) \ + $(cairo_boilerplate_glx_private) \ $(cairo_boilerplate_script_private) \ $(cairo_boilerplate_ft_private) \ $(cairo_boilerplate_fc_private) \ @@ -582,21 +686,39 @@ all_cairo_boilerplate_private = $(cairo_boilerplate_private) \ $(cairo_boilerplate_test_surfaces_private) \ $(cairo_boilerplate_test_surfaces_headers) \ $(cairo_boilerplate_image_private) \ - $(cairo_boilerplate_user_private) + $(cairo_boilerplate_meta_private) \ + $(cairo_boilerplate_tee_private) \ + $(cairo_boilerplate_xml_private) \ + $(cairo_boilerplate_user_private) \ + $(cairo_boilerplate_trace_private) \ + $(cairo_boilerplate_trace_headers) \ + $(cairo_boilerplate_interpreter_private) \ + $(cairo_boilerplate_interpreter_headers) \ + $(cairo_boilerplate_symbol_lookup_private) \ + $(cairo_boilerplate_symbol_lookup_headers) all_cairo_boilerplate_sources = $(cairo_boilerplate_sources) \ $(cairo_boilerplate_xlib_sources) \ $(cairo_boilerplate_xlib_xrender_sources) \ $(cairo_boilerplate_xcb_sources) \ + $(cairo_boilerplate_qt_sources) \ $(cairo_boilerplate_quartz_sources) \ $(cairo_boilerplate_quartz_font_sources) \ $(cairo_boilerplate_quartz_image_sources) \ $(cairo_boilerplate_win32_sources) \ $(cairo_boilerplate_win32_font_sources) \ + $(cairo_boilerplate_skia_sources) \ $(cairo_boilerplate_os2_sources) \ $(cairo_boilerplate_beos_sources) \ + $(cairo_boilerplate_drm_sources) \ + $(cairo_boilerplate_gallium_sources) \ $(cairo_boilerplate_png_sources) \ + $(cairo_boilerplate_gl_sources) \ $(cairo_boilerplate_glitz_sources) \ $(cairo_boilerplate_directfb_sources) \ + $(cairo_boilerplate_vg_sources) \ + $(cairo_boilerplate_eagle_sources) \ + $(cairo_boilerplate_egl_sources) \ + $(cairo_boilerplate_glx_sources) \ $(cairo_boilerplate_script_sources) \ $(cairo_boilerplate_ft_sources) \ $(cairo_boilerplate_fc_sources) \ @@ -605,7 +727,13 @@ all_cairo_boilerplate_sources = $(cairo_boilerplate_sources) \ $(cairo_boilerplate_svg_sources) \ $(cairo_boilerplate_test_surfaces_sources) \ $(cairo_boilerplate_image_sources) \ - $(cairo_boilerplate_user_sources) + $(cairo_boilerplate_meta_sources) \ + $(cairo_boilerplate_tee_sources) \ + $(cairo_boilerplate_xml_sources) \ + $(cairo_boilerplate_user_sources) \ + $(cairo_boilerplate_trace_sources) \ + $(cairo_boilerplate_interpreter_sources) \ + $(cairo_boilerplate_symbol_lookup_sources) enabled_cairo_boilerplate_files = $(enabled_cairo_boilerplate_headers) $(enabled_cairo_boilerplate_private) $(enabled_cairo_boilerplate_sources) enabled_cairo_boilerplate_headers = $(cairo_boilerplate_headers) \ $(am__append_1) $(am__append_4) $(am__append_7) \ @@ -614,7 +742,12 @@ enabled_cairo_boilerplate_headers = $(cairo_boilerplate_headers) \ $(am__append_28) $(am__append_31) $(am__append_34) \ $(am__append_37) $(am__append_40) $(am__append_43) \ $(am__append_46) $(am__append_49) $(am__append_52) \ - $(am__append_55) $(cairo_boilerplate_image_headers) \ + $(am__append_55) $(am__append_58) $(am__append_61) \ + $(am__append_64) $(am__append_67) $(am__append_70) \ + $(am__append_73) $(am__append_76) $(am__append_79) \ + $(am__append_82) $(cairo_boilerplate_image_headers) \ + $(cairo_boilerplate_meta_headers) \ + $(cairo_boilerplate_tee_headers) $(am__append_87) \ $(cairo_boilerplate_user_headers) enabled_cairo_boilerplate_private = $(cairo_boilerplate_private) \ $(am__append_2) $(am__append_5) $(am__append_8) \ @@ -623,9 +756,15 @@ enabled_cairo_boilerplate_private = $(cairo_boilerplate_private) \ $(am__append_29) $(am__append_32) $(am__append_35) \ $(am__append_38) $(am__append_41) $(am__append_44) \ $(am__append_47) $(am__append_50) $(am__append_53) \ - $(am__append_56) $(am__append_58) \ + $(am__append_56) $(am__append_59) $(am__append_62) \ + $(am__append_65) $(am__append_68) $(am__append_71) \ + $(am__append_74) $(am__append_77) $(am__append_80) \ + $(am__append_83) $(am__append_85) \ $(cairo_boilerplate_image_private) \ - $(cairo_boilerplate_user_private) + $(cairo_boilerplate_meta_private) \ + $(cairo_boilerplate_tee_private) $(am__append_88) \ + $(cairo_boilerplate_user_private) $(am__append_90) \ + $(am__append_92) $(am__append_94) enabled_cairo_boilerplate_sources = $(cairo_boilerplate_sources) \ $(am__append_3) $(am__append_6) $(am__append_9) \ $(am__append_12) $(am__append_15) $(am__append_18) \ @@ -633,28 +772,36 @@ enabled_cairo_boilerplate_sources = $(cairo_boilerplate_sources) \ $(am__append_30) $(am__append_33) $(am__append_36) \ $(am__append_39) $(am__append_42) $(am__append_45) \ $(am__append_48) $(am__append_51) $(am__append_54) \ - $(am__append_57) $(am__append_59) \ + $(am__append_57) $(am__append_60) $(am__append_63) \ + $(am__append_66) $(am__append_69) $(am__append_72) \ + $(am__append_75) $(am__append_78) $(am__append_81) \ + $(am__append_84) $(am__append_86) \ $(cairo_boilerplate_image_sources) \ - $(cairo_boilerplate_user_sources) + $(cairo_boilerplate_meta_sources) \ + $(cairo_boilerplate_tee_sources) $(am__append_89) \ + $(cairo_boilerplate_user_sources) $(am__append_91) \ + $(am__append_93) $(am__append_95) #MAINTAINERCLEANFILES += $(srcdir)/Makefile.win32.features AM_CPPFLAGS = -I$(srcdir) -I$(top_builddir)/src -I$(top_srcdir)/src \ - $(CAIRO_CFLAGS) $(NULL) $(am__append_60) + $(CAIRO_CFLAGS) $(NULL) $(am__append_97) AM_LDFLAGS = $(CAIRO_LDFLAGS) libcairoboilerplate_la_SOURCES = \ $(enabled_cairo_boilerplate_headers) \ $(enabled_cairo_boilerplate_private) \ $(enabled_cairo_boilerplate_sources) \ + cairo-boilerplate-constructors.c \ $(NULL) libcairoboilerplate_la_LIBADD = $(top_builddir)/src/libcairo.la \ - $(am__append_61) $(am__append_62) $(am__append_63) \ - $(am__append_64) $(am__append_65) + $(am__append_96) $(am__append_98) $(am__append_99) \ + $(am__append_100) $(am__append_101) $(am__append_102) \ + $(CAIROBOILERPLATE_LIBS) check_link_LDADD = libcairoboilerplate.la all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj +.SUFFIXES: .c .cpp .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/Makefile.am.common $(srcdir)/Makefile.am.features $(top_srcdir)/boilerplate/Makefile.sources $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -664,9 +811,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build/Makefile.am.co exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu boilerplate/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu boilerplate/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu boilerplate/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu boilerplate/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -684,15 +831,18 @@ $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): libcairoboilerplate.la: $(libcairoboilerplate_la_OBJECTS) $(libcairoboilerplate_la_DEPENDENCIES) - $(LINK) $(libcairoboilerplate_la_OBJECTS) $(libcairoboilerplate_la_LIBADD) $(LIBS) + $(CXXLINK) $(libcairoboilerplate_la_OBJECTS) $(libcairoboilerplate_la_LIBADD) $(LIBS) clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list check-link$(EXEEXT): $(check_link_OBJECTS) $(check_link_DEPENDENCIES) @rm -f check-link$(EXEEXT) $(LINK) $(check_link_OBJECTS) $(check_link_LDADD) $(LIBS) @@ -703,18 +853,24 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-constructors.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-directfb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-drm.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-getopt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-gl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-glitz-agl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-glitz-glx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-glitz-wgl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-pdf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-ps.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-qt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-quartz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-script.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-skia.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-svg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-system.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-test-surfaces.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-vg.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-win32-printing.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-win32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cairo-boilerplate-xcb.Plo@am__quote@ @@ -724,25 +880,46 @@ distclean-compile: .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + mostlyclean-libtool: -rm -f *.lo @@ -761,7 +938,7 @@ tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ + set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -769,29 +946,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - tags=; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -800,6 +982,7 @@ check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ list=' $(TESTS) '; \ + $(am__tty_colors); \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ @@ -811,10 +994,10 @@ check-TESTS: $(TESTS) *[\ \ ]$$tst[\ \ ]*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ + col=$$red; res=XPASS; \ ;; \ *) \ - echo "PASS: $$tst"; \ + col=$$grn; res=PASS; \ ;; \ esac; \ elif test $$? -ne 77; then \ @@ -822,17 +1005,18 @@ check-TESTS: $(TESTS) case " $(XFAIL_TESTS) " in \ *[\ \ ]$$tst[\ \ ]*) \ xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ + col=$$lgn; res=XFAIL; \ ;; \ *) \ failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ + col=$$red; res=FAIL; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ + col=$$blu; res=SKIP; \ fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ if test "$$all" -eq 1; then \ tests="test"; \ @@ -874,11 +1058,15 @@ check-TESTS: $(TESTS) dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ + if test "$$failed" -eq 0; then \ + echo "$$grn$$dashes"; \ + else \ + echo "$$red$$dashes"; \ + fi; \ echo "$$banner"; \ test -z "$$skipped" || echo "$$skipped"; \ test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ + echo "$$dashes$$std"; \ test "$$failed" -eq 0; \ else :; fi @@ -898,13 +1086,17 @@ distdir: $(DISTFILES) if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @@ -937,6 +1129,7 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @@ -961,6 +1154,8 @@ dvi-am: html: html-am +html-am: + info: info-am info-am: @@ -969,18 +1164,28 @@ install-data-am: install-dvi: install-dvi-am +install-dvi-am: + install-exec-am: install-html: install-html-am +install-html-am: + install-info: install-info-am +install-info-am: + install-man: install-pdf: install-pdf-am +install-pdf-am: + install-ps: install-ps-am +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -1003,7 +1208,7 @@ ps-am: uninstall-am: -.MAKE: install-am install-strip +.MAKE: all check check-am install install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ @@ -1020,7 +1225,11 @@ uninstall-am: tags uninstall uninstall-am +cairo-boilerplate-constructors.c: Makefile $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors.sh + (cd $(srcdir) && sh ./make-cairo-boilerplate-constructors.sh $(enabled_cairo_boilerplate_sources)) > $@ + test: check + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/boilerplate/Makefile.sources b/boilerplate/Makefile.sources index 1b82bbd..d40d7f9 100644 --- a/boilerplate/Makefile.sources +++ b/boilerplate/Makefile.sources @@ -15,46 +15,32 @@ cairo_boilerplate_sources = \ cairo-boilerplate-system.c \ cairo-boilerplate.c \ $(NULL) +cairo_boilerplate_private = \ + cairo-boilerplate-private.h \ + $(NULL) # 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_boilerplate_beos_private = cairo-boilerplate-beos-private.h #libcairoboilerplate_la_SOURCES += cairo-boilerplate-beos.cpp -cairo_boilerplate_directfb_private = cairo-boilerplate-directfb-private.h cairo_boilerplate_directfb_sources = cairo-boilerplate-directfb.c - -cairo_boilerplate_glitz_private = cairo-boilerplate-glitz-private.h +cairo_boilerplate_drm_sources = cairo-boilerplate-drm.c +cairo_boilerplate_gl_sources = cairo-boilerplate-gl.c cairo_boilerplate_glitz_sources = \ cairo-boilerplate-glitz-agl.c \ cairo-boilerplate-glitz-glx.c \ cairo-boilerplate-glitz-wgl.c \ $(NULL) - -cairo_boilerplate_pdf_private = cairo-boilerplate-pdf-private.h cairo_boilerplate_pdf_sources = cairo-boilerplate-pdf.c - -cairo_boilerplate_ps_private = cairo-boilerplate-ps-private.h cairo_boilerplate_ps_sources = cairo-boilerplate-ps.c - -cairo_boilerplate_quartz_private = cairo-boilerplate-quartz-private.h +cairo_boilerplate_qt_sources = cairo-boilerplate-qt.cpp cairo_boilerplate_quartz_sources = cairo-boilerplate-quartz.c - -cairo_boilerplate_script_private = cairo-boilerplate-script-private.h cairo_boilerplate_script_sources = cairo-boilerplate-script.c - -cairo_boilerplate_svg_private = cairo-boilerplate-svg-private.h +cairo_boilerplate_skia_sources = cairo-boilerplate-skia.c cairo_boilerplate_svg_sources = cairo-boilerplate-svg.c - -cairo_boilerplate_test_surfaces_private = cairo-boilerplate-test-surfaces-private.h cairo_boilerplate_test_surfaces_sources = cairo-boilerplate-test-surfaces.c - -cairo_boilerplate_win32_private = cairo-boilerplate-win32-private.h cairo_boilerplate_win32_sources = cairo-boilerplate-win32.c cairo-boilerplate-win32-printing.c - -cairo_boilerplate_xcb_private = cairo-boilerplate-xcb-private.h cairo_boilerplate_xcb_sources = cairo-boilerplate-xcb.c - cairo_boilerplate_xlib_headers = cairo-boilerplate-xlib.h -cairo_boilerplate_xlib_private = cairo-boilerplate-xlib-private.h cairo_boilerplate_xlib_sources = cairo-boilerplate-xlib.c +cairo_boilerplate_vg_sources = cairo-boilerplate-vg.c diff --git a/boilerplate/Makefile.win32.features b/boilerplate/Makefile.win32.features index d6d5065..3e922ef 100644 --- a/boilerplate/Makefile.win32.features +++ b/boilerplate/Makefile.win32.features @@ -49,6 +49,16 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_xcb_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_xcb_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_qt_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_qt_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_qt_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_qt_sources) +ifeq ($(CAIRO_HAS_QT_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_qt_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_qt_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_qt_sources) +endif + supported_cairo_boilerplate_headers += $(cairo_boilerplate_quartz_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_quartz_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_quartz_private) @@ -99,6 +109,16 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_win32_font_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_win32_font_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_skia_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_skia_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_skia_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_skia_sources) +ifeq ($(CAIRO_HAS_SKIA_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_skia_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_skia_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_skia_sources) +endif + unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_os2_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_os2_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_os2_private) @@ -119,6 +139,26 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_beos_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_beos_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_drm_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_drm_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_drm_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_drm_sources) +ifeq ($(CAIRO_HAS_DRM_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_drm_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_drm_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_drm_sources) +endif + +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_gallium_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_gallium_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_gallium_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_gallium_sources) +ifeq ($(CAIRO_HAS_GALLIUM_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_gallium_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_gallium_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_gallium_sources) +endif + supported_cairo_boilerplate_headers += $(cairo_boilerplate_png_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_png_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_png_private) @@ -129,6 +169,16 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_png_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_png_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_gl_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_gl_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_gl_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_gl_sources) +ifeq ($(CAIRO_HAS_GL_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_gl_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_gl_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_gl_sources) +endif + unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_glitz_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_glitz_private) @@ -149,6 +199,46 @@ enabled_cairo_boilerplate_private += $(cairo_boilerplate_directfb_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_directfb_sources) endif +unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_vg_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_vg_sources) +ifeq ($(CAIRO_HAS_VG_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_vg_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_vg_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_vg_sources) +endif + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_eagle_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_eagle_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_eagle_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_eagle_sources) +ifeq ($(CAIRO_HAS_EAGLE_FUNCTIONS),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_eagle_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_eagle_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_eagle_sources) +endif + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_egl_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_egl_sources) +ifeq ($(CAIRO_HAS_EGL_FUNCTIONS),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_egl_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_egl_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_egl_sources) +endif + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_glx_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_glx_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_glx_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_glx_sources) +ifeq ($(CAIRO_HAS_GLX_FUNCTIONS),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_glx_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_glx_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_glx_sources) +endif + unsupported_cairo_boilerplate_headers += $(cairo_boilerplate_script_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_script_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_script_private) @@ -224,6 +314,32 @@ enabled_cairo_boilerplate_headers += $(cairo_boilerplate_image_headers) enabled_cairo_boilerplate_private += $(cairo_boilerplate_image_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_image_sources) +supported_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_meta_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_meta_sources) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_meta_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_meta_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_meta_sources) + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_tee_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_tee_sources) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_tee_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_tee_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_tee_sources) + +supported_cairo_boilerplate_headers += $(cairo_boilerplate_xml_headers) +all_cairo_boilerplate_headers += $(cairo_boilerplate_xml_headers) +all_cairo_boilerplate_private += $(cairo_boilerplate_xml_private) +all_cairo_boilerplate_sources += $(cairo_boilerplate_xml_sources) +ifeq ($(CAIRO_HAS_XML_SURFACE),1) +enabled_cairo_boilerplate_headers += $(cairo_boilerplate_xml_headers) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_xml_private) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_xml_sources) +endif + supported_cairo_boilerplate_headers += $(cairo_boilerplate_user_headers) all_cairo_boilerplate_headers += $(cairo_boilerplate_user_headers) all_cairo_boilerplate_private += $(cairo_boilerplate_user_private) @@ -231,3 +347,24 @@ all_cairo_boilerplate_sources += $(cairo_boilerplate_user_sources) enabled_cairo_boilerplate_headers += $(cairo_boilerplate_user_headers) enabled_cairo_boilerplate_private += $(cairo_boilerplate_user_private) enabled_cairo_boilerplate_sources += $(cairo_boilerplate_user_sources) + +all_cairo_boilerplate_private += $(cairo_boilerplate_trace_private) $(cairo_boilerplate_trace_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_trace_sources) +ifeq ($(CAIRO_HAS_TRACE),1) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_trace_private) $(cairo_boilerplate_trace_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_trace_sources) +endif + +all_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources) +ifeq ($(CAIRO_HAS_INTERPRETER),1) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_interpreter_private) $(cairo_boilerplate_interpreter_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_interpreter_sources) +endif + +all_cairo_boilerplate_private += $(cairo_boilerplate_symbol_lookup_private) $(cairo_boilerplate_symbol_lookup_headers) +all_cairo_boilerplate_sources += $(cairo_boilerplate_symbol_lookup_sources) +ifeq ($(CAIRO_HAS_SYMBOL_LOOKUP),1) +enabled_cairo_boilerplate_private += $(cairo_boilerplate_symbol_lookup_private) $(cairo_boilerplate_symbol_lookup_headers) +enabled_cairo_boilerplate_sources += $(cairo_boilerplate_symbol_lookup_sources) +endif diff --git a/boilerplate/cairo-boilerplate-beos-private.h b/boilerplate/cairo-boilerplate-beos-private.h deleted file mode 100644 index 1d800c2..0000000 --- a/boilerplate/cairo-boilerplate-beos-private.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _CAIRO_BOILERPLATE_BEOS_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_BEOS_PRIVATE_H_ - -/* Two functions: One for a real window, one for a bitmap */ - -#include <cairo.h> - -CAIRO_BEGIN_DECLS - -extern cairo_surface_t * -_cairo_boilerplate_beos_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -extern void -_cairo_boilerplate_beos_cleanup (void* closure); - -extern cairo_surface_t * -_cairo_boilerplate_beos_create_surface_for_bitmap (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -extern void -_cairo_boilerplate_beos_cleanup_bitmap (void* closure); - -CAIRO_END_DECLS - -#endif diff --git a/boilerplate/cairo-boilerplate-constructors.c b/boilerplate/cairo-boilerplate-constructors.c new file mode 100644 index 0000000..6cbe03c --- /dev/null +++ b/boilerplate/cairo-boilerplate-constructors.c @@ -0,0 +1,25 @@ +/* WARNING: Autogenerated file - see ./make-cairo-boilerplate-constructors.sh! */ + +#include "cairo-boilerplate-private.h" + +void _cairo_boilerplate_register_all (void); + +extern void _register_builtin (void); +extern void _register_xlib (void); +extern void _register_gl (void); +extern void _register_ps (void); +extern void _register_pdf (void); +extern void _register_svg (void); +extern void _register_test (void); + +void +_cairo_boilerplate_register_all (void) +{ + _register_builtin (); + _register_xlib (); + _register_gl (); + _register_ps (); + _register_pdf (); + _register_svg (); + _register_test (); +} diff --git a/boilerplate/cairo-boilerplate-directfb-private.h b/boilerplate/cairo-boilerplate-directfb-private.h deleted file mode 100644 index 87d1b8b..0000000 --- a/boilerplate/cairo-boilerplate-directfb-private.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef CAIRO_TEST_DIRECTFB_H_ -#define CAIRO_TEST_DIRECTFB_H_ - -/* Two functions: One for a real window, one for a bitmap */ - -#include <cairo.h> - -CAIRO_BEGIN_DECLS - -extern cairo_surface_t * -_cairo_boilerplate_directfb_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -extern void -_cairo_boilerplate_directfb_cleanup (void* closure); - -CAIRO_END_DECLS - -#endif diff --git a/boilerplate/cairo-boilerplate-directfb.c b/boilerplate/cairo-boilerplate-directfb.c index 7a6462f..6815dd1 100644 --- a/boilerplate/cairo-boilerplate-directfb.c +++ b/boilerplate/cairo-boilerplate-directfb.c @@ -9,8 +9,7 @@ make check */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-directfb-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-directfb.h> @@ -37,7 +36,7 @@ typedef struct _DFBInfo { IDirectFBSurface *surface; } DFBInfo; -void +static void _cairo_boilerplate_directfb_cleanup (void *closure) { DFBInfo *info = (DFBInfo *) closure; @@ -168,13 +167,13 @@ ERROR: return NULL; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_directfb_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -207,3 +206,27 @@ _cairo_boilerplate_directfb_create_surface (const char *name, else /* mode == CAIRO_BOILERPLATE_MODE_PERF */ return _cairo_boilerplate_directfb_window_create_surface (info, content, width, height); } + +static const cairo_boilerplate_target_t targets[] = { + { + "directfb", "directfb", NULL, NULL, + CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR, 0, + "cairo_directfb_surface_create", + _cairo_boilerplate_directfb_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_directfb_cleanup + }, + { + "directfb-bitmap", "directfb", NULL, NULL, + CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_directfb_surface_create", + _cairo_boilerplate_directfb_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_directfb_cleanup + }, +}; +CAIRO_BOILERPLATE (directfb, targets); diff --git a/boilerplate/cairo-boilerplate-drm.c b/boilerplate/cairo-boilerplate-drm.c new file mode 100644 index 0000000..34d67b5 --- /dev/null +++ b/boilerplate/cairo-boilerplate-drm.c @@ -0,0 +1,93 @@ +/* Cairo - a vector graphics library with display and print output + * + * Copyright © 2009 Chris Wilson + * + * 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 Chris Wilson. + */ + +#include "cairo-boilerplate-private.h" + +#include <cairo-drm.h> + +static cairo_surface_t * +_cairo_boilerplate_drm_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + cairo_drm_device_t *device; + + device = cairo_drm_device_default (); + if (device == NULL) + return NULL; /* skip tests if no supported h/w found */ + + return *closure = cairo_drm_surface_create (device, content, width, height); +} + +static void +_cairo_boilerplate_drm_synchronize (void *closure) +{ + cairo_surface_t *image; + + image = cairo_drm_surface_map (closure); + if (cairo_surface_status (image) == CAIRO_STATUS_SUCCESS) + cairo_drm_surface_unmap (closure, image); +} + +static const cairo_boilerplate_target_t targets[] = { + /* Acceleration architectures may make the results differ by a + * bit, so we set the error tolerance to 1. */ + { + "drm", "drm", NULL, NULL, + CAIRO_SURFACE_TYPE_DRM, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_drm_surface_create", + _cairo_boilerplate_drm_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + NULL, + _cairo_boilerplate_drm_synchronize + }, + { + "drm", "drm", NULL, NULL, + CAIRO_SURFACE_TYPE_DRM, CAIRO_CONTENT_COLOR, 1, + "cairo_drm_surface_create", + _cairo_boilerplate_drm_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + NULL, + _cairo_boilerplate_drm_synchronize + }, +}; +CAIRO_BOILERPLATE (drm, targets) diff --git a/boilerplate/cairo-boilerplate-gl.c b/boilerplate/cairo-boilerplate-gl.c new file mode 100644 index 0000000..8f3669a --- /dev/null +++ b/boilerplate/cairo-boilerplate-gl.c @@ -0,0 +1,165 @@ +/* Cairo - a vector graphics library with display and print output + * + * Copyright © 2009 Chris Wilson + * + * 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 Chris Wilson. + */ + +#include "cairo-boilerplate-private.h" + +#include <cairo-gl.h> + +typedef struct _gl_target_closure { + Display *dpy; + int screen; + + GLXContext gl_ctx; + cairo_gl_context_t *ctx; + cairo_surface_t *surface; +} gl_target_closure_t; + +static void +_cairo_boilerplate_gl_cleanup (void *closure) +{ + gl_target_closure_t *gltc = closure; + + cairo_gl_context_destroy (gltc->ctx); + glXDestroyContext (gltc->dpy, gltc->gl_ctx); + XCloseDisplay (gltc->dpy); + free (gltc); +} + +static cairo_surface_t * +_cairo_boilerplate_gl_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + int rgba_attribs[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_ALPHA_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + int rgb_attribs[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None }; + XVisualInfo *visinfo; + GLXContext gl_ctx; + gl_target_closure_t *gltc; + cairo_surface_t *surface; + Display *dpy; + + gltc = malloc (sizeof (gl_target_closure_t)); + *closure = gltc; + + if (width == 0) + width = 1; + if (height == 0) + height = 1; + + dpy = XOpenDisplay (NULL); + gltc->dpy = dpy; + if (!gltc->dpy) { + fprintf (stderr, "Failed to open display: %s\n", XDisplayName(0)); + free (gltc); + return NULL; + } + + if (mode == CAIRO_BOILERPLATE_MODE_TEST) + XSynchronize (gltc->dpy, 1); + + if (content == CAIRO_CONTENT_COLOR) + visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), rgb_attribs); + else + visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs); + + if (visinfo == NULL) { + fprintf (stderr, "Failed to create RGB, double-buffered visual\n"); + XCloseDisplay (dpy); + free (gltc); + return NULL; + } + + gl_ctx = glXCreateContext (dpy, visinfo, NULL, True); + XFree (visinfo); + + gltc->gl_ctx = gl_ctx; + gltc->ctx = cairo_glx_context_create (dpy, gl_ctx); + + gltc->surface = surface = cairo_gl_surface_create (gltc->ctx, content, + ceil (width), + ceil (height)); + if (cairo_surface_status (surface)) + _cairo_boilerplate_gl_cleanup (gltc); + + return surface; +} + +static void +_cairo_boilerplate_gl_synchronize (void *closure) +{ + gl_target_closure_t *gltc = closure; + + cairo_gl_surface_glfinish (gltc->surface); +} + +static const cairo_boilerplate_target_t targets[] = { + { + "gl", "gl", NULL, NULL, + CAIRO_SURFACE_TYPE_GL, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_gl_surface_create", + _cairo_boilerplate_gl_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_gl_cleanup, + _cairo_boilerplate_gl_synchronize + }, + { + "gl", "gl", NULL, NULL, + CAIRO_SURFACE_TYPE_GL, CAIRO_CONTENT_COLOR, 1, + "cairo_gl_surface_create", + _cairo_boilerplate_gl_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_gl_cleanup, + _cairo_boilerplate_gl_synchronize + }, +}; +CAIRO_BOILERPLATE (gl, targets) diff --git a/boilerplate/cairo-boilerplate-glitz-agl.c b/boilerplate/cairo-boilerplate-glitz-agl.c index dd10a00..679593b 100644 --- a/boilerplate/cairo-boilerplate-glitz-agl.c +++ b/boilerplate/cairo-boilerplate-glitz-agl.c @@ -24,8 +24,7 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-glitz-private.h" +#include "cairo-boilerplate-private.h" #if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE #include <cairo-glitz.h> @@ -98,13 +97,13 @@ _cairo_boilerplate_glitz_agl_create_surface_internal (glitz_format_name_t form return NULL; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_glitz_agl_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -156,7 +155,7 @@ _cairo_boilerplate_glitz_agl_create_surface (const char *name, return surface; } -void +static void _cairo_boilerplate_glitz_agl_cleanup (void *closure) { free (closure); @@ -164,3 +163,29 @@ _cairo_boilerplate_glitz_agl_cleanup (void *closure) } #endif + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE + { + "glitz-agl", "glitz", NULL, NULL, + CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_glitz_surface_create", + _cairo_boilerplate_glitz_agl_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_glitz_agl_cleanup + }, + { + "glitz-agl", "glitz", NULL, NULL, + CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0, + "cairo_glitz_surface_create", + _cairo_boilerplate_glitz_agl_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_glitz_agl_cleanup + }, +#endif +}; +CAIRO_BOILERPLATE (glitz_agl, targets) diff --git a/boilerplate/cairo-boilerplate-glitz-glx.c b/boilerplate/cairo-boilerplate-glitz-glx.c index 4c26b87..d490aec 100644 --- a/boilerplate/cairo-boilerplate-glitz-glx.c +++ b/boilerplate/cairo-boilerplate-glitz-glx.c @@ -24,8 +24,7 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-glitz-private.h" +#include "cairo-boilerplate-private.h" #if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE #include <cairo-glitz.h> @@ -34,7 +33,6 @@ static const cairo_user_data_key_t glitz_closure_key; typedef struct _glitz_glx_target_closure { - glitz_target_closure_base_t base; Display *dpy; int scr; Window win; @@ -151,13 +149,13 @@ _cairo_boilerplate_glitz_glx_create_surface_internal (glitz_format_name_t form return NULL; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_glitz_glx_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -207,9 +205,6 @@ _cairo_boilerplate_glitz_glx_create_surface (const char *name, if (cairo_surface_status (surface)) goto FAIL_CLOSE_DISPLAY; - gxtc->base.width = width; - gxtc->base.height = height; - gxtc->base.content = content; status = cairo_surface_set_user_data (surface, &glitz_closure_key, gxtc, NULL); if (status == CAIRO_STATUS_SUCCESS) @@ -226,7 +221,7 @@ _cairo_boilerplate_glitz_glx_create_surface (const char *name, return surface; } -void +static void _cairo_boilerplate_glitz_glx_cleanup (void *closure) { glitz_glx_target_closure_t *gxtc = closure; @@ -242,3 +237,29 @@ _cairo_boilerplate_glitz_glx_cleanup (void *closure) } #endif + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE + { + "glitz-glx", "glitz", NULL, NULL, + CAIRO_SURFACE_TYPE_GLITZ,CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_glitz_surface_create", + _cairo_boilerplate_glitz_glx_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_glitz_glx_cleanup + }, + { + "glitz-glx", "glitz", NULL, NULL, + CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0, + "cairo_glitz_surface_create", + _cairo_boilerplate_glitz_glx_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_glitz_glx_cleanup + }, +#endif +}; +CAIRO_BOILERPLATE (glitz_glx, targets) diff --git a/boilerplate/cairo-boilerplate-glitz-private.h b/boilerplate/cairo-boilerplate-glitz-private.h deleted file mode 100644 index 052c7e0..0000000 --- a/boilerplate/cairo-boilerplate-glitz-private.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_GLITZ_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_GLITZ_PRIVATE_H_ - -#if HAVE_CONFIG_H -#include "config.h" -#endif - -typedef struct _glitz_target_closure_base { - int width; - int height; - cairo_content_t content; -} glitz_target_closure_base_t; - -#if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE -cairo_surface_t * -_cairo_boilerplate_glitz_glx_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_glitz_glx_cleanup (void *closure); -#endif - -#if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE -cairo_surface_t * -_cairo_boilerplate_glitz_agl_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_glitz_agl_cleanup (void *closure); -#endif - -#if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE -cairo_surface_t * -_cairo_boilerplate_glitz_wgl_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_glitz_wgl_cleanup (void *closure); -#endif - -#endif diff --git a/boilerplate/cairo-boilerplate-glitz-wgl.c b/boilerplate/cairo-boilerplate-glitz-wgl.c index dfd764f..f50d68b 100644 --- a/boilerplate/cairo-boilerplate-glitz-wgl.c +++ b/boilerplate/cairo-boilerplate-glitz-wgl.c @@ -24,8 +24,7 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-glitz-private.h" +#include "cairo-boilerplate-private.h" #if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE #include <cairo-glitz.h> @@ -37,7 +36,7 @@ typedef struct _glitz_wgl_target_closure { glitz_target_closure_base_t base; } glitz_wgl_target_closure_t; -glitz_surface_t * +static glitz_surface_t * _cairo_boilerplate_glitz_wgl_create_surface_internal (glitz_format_name_t formatname, int width, int height, @@ -97,13 +96,13 @@ _cairo_boilerplate_glitz_wgl_create_surface_internal (glitz_format_name_t form return sr; /* will be NULL unless we create it and attach */ } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_glitz_wgl_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -154,11 +153,36 @@ _cairo_boilerplate_glitz_wgl_create_surface (const char *name, return surface; } -void +static void _cairo_boilerplate_glitz_wgl_cleanup (void *closure) { free (closure); glitz_wgl_fini (); } +#endif +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE + { + "glitz-wgl", "glitz", NULL, NULL, + CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_glitz_surface_create", + _cairo_boilerplate_glitz_wgl_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_glitz_wgl_cleanup + }, + { + "glitz-wgl", "glitz", NULL, NULL, + CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0, + "cairo_glitz_surface_create", + _cairo_boilerplate_glitz_wgl_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_glitz_wgl_cleanup + }, #endif +}; +CAIRO_BOILERPLATE (glitz_wgl, targets) diff --git a/boilerplate/cairo-boilerplate-pdf-private.h b/boilerplate/cairo-boilerplate-pdf-private.h deleted file mode 100644 index 3c34c3e..0000000 --- a/boilerplate/cairo-boilerplate-pdf-private.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_PDF_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_PDF_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_pdf_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface, - unsigned int flags); - -cairo_status_t -_cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface); - -cairo_status_t -_cairo_boilerplate_pdf_surface_write_to_png (cairo_surface_t *surface, const char *filename); - -cairo_surface_t * -_cairo_boilerplate_pdf_get_image_surface (cairo_surface_t *surface, - int page, - int width, - int height); - -void -_cairo_boilerplate_pdf_cleanup (void *closure); - -#endif diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c index 7e5e162..191eb1b 100644 --- a/boilerplate/cairo-boilerplate-pdf.c +++ b/boilerplate/cairo-boilerplate-pdf.c @@ -24,19 +24,17 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-pdf-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-pdf.h> #include <cairo-pdf-surface-private.h> #include <cairo-paginated-surface-private.h> -#if HAVE_SIGNAL_H -#include <stdlib.h> -#include <signal.h> +#if ! CAIRO_HAS_META_SURFACE +#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META #endif -cairo_user_data_key_t pdf_closure_key; +static const cairo_user_data_key_t pdf_closure_key; typedef struct _pdf_target_closure { @@ -48,13 +46,13 @@ typedef struct _pdf_target_closure #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0]))) -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_pdf_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -69,8 +67,8 @@ _cairo_boilerplate_pdf_create_surface (const char *name, *closure = ptc = xmalloc (sizeof (pdf_target_closure_t)); - ptc->width = width; - ptc->height = height; + ptc->width = ceil (width); + ptc->height = ceil (height); xasprintf (&ptc->filename, "%s.out.pdf", name); xunlink (ptc->filename); @@ -85,7 +83,7 @@ _cairo_boilerplate_pdf_create_surface (const char *name, ptc->target = surface; surface = cairo_surface_create_similar (ptc->target, CAIRO_CONTENT_COLOR, - width, height); + ptc->width, ptc->height); if (cairo_surface_status (surface)) goto CLEANUP_TARGET; } else { @@ -107,7 +105,7 @@ _cairo_boilerplate_pdf_create_surface (const char *name, return surface; } -cairo_status_t +static cairo_status_t _cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface) { pdf_target_closure_t *ptc = cairo_surface_get_user_data (surface, @@ -135,7 +133,6 @@ _cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface) if (status) return status; - cairo_surface_finish (surface); status = cairo_surface_status (surface); if (status) return status; @@ -151,7 +148,7 @@ _cairo_boilerplate_pdf_finish_surface (cairo_surface_t *surface) return CAIRO_STATUS_SUCCESS; } -cairo_status_t +static cairo_status_t _cairo_boilerplate_pdf_surface_write_to_png (cairo_surface_t *surface, const char *filename) { pdf_target_closure_t *ptc = cairo_surface_get_user_data (surface, &pdf_closure_key); @@ -181,7 +178,7 @@ _cairo_boilerplate_pdf_convert_to_image (cairo_surface_t *surface, int page) return cairo_boilerplate_convert_to_image (ptc->filename, page+1); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_pdf_get_image_surface (cairo_surface_t *surface, int page, int width, @@ -199,7 +196,7 @@ _cairo_boilerplate_pdf_get_image_surface (cairo_surface_t *surface, return surface; } -void +static void _cairo_boilerplate_pdf_cleanup (void *closure) { pdf_target_closure_t *ptc = closure; @@ -209,8 +206,7 @@ _cairo_boilerplate_pdf_cleanup (void *closure) free (ptc); } - -void +static void _cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface, unsigned int flags) { @@ -227,3 +223,34 @@ _cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface, surface = (cairo_pdf_surface_t*) paginated->target; surface->force_fallbacks = TRUE; } + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_PDF_SURFACE + { + "pdf", "pdf", ".pdf", NULL, + CAIRO_SURFACE_TYPE_PDF, + CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, + "cairo_pdf_surface_create", + _cairo_boilerplate_pdf_create_surface, + _cairo_boilerplate_pdf_force_fallbacks, + _cairo_boilerplate_pdf_finish_surface, + _cairo_boilerplate_pdf_get_image_surface, + _cairo_boilerplate_pdf_surface_write_to_png, + _cairo_boilerplate_pdf_cleanup, + NULL, TRUE, TRUE + }, + { + "pdf", "pdf", ".pdf", NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, + "cairo_pdf_surface_create", + _cairo_boilerplate_pdf_create_surface, + _cairo_boilerplate_pdf_force_fallbacks, + _cairo_boilerplate_pdf_finish_surface, + _cairo_boilerplate_pdf_get_image_surface, + _cairo_boilerplate_pdf_surface_write_to_png, + _cairo_boilerplate_pdf_cleanup, + NULL, TRUE, TRUE + }, +#endif +}; +CAIRO_BOILERPLATE (pdf, targets) diff --git a/boilerplate/cairo-boilerplate-quartz-private.h b/boilerplate/cairo-boilerplate-private.h index 573e247..5ef59c5 100644 --- a/boilerplate/cairo-boilerplate-quartz-private.h +++ b/boilerplate/cairo-boilerplate-private.h @@ -1,6 +1,5 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ /* - * Copyright © 2004,2007 Red Hat, Inc. + * Copyright © 2009 Chris Wilson * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without @@ -21,24 +20,30 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * Author: Carl D. Worth <cworth@cworth.org> + * Author: Chris Wilson <chris@chris-wilson.co.uk> */ -#ifndef _CAIRO_BOILERPLATE_QUARTZ_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_QUARTZ_PRIVATE_H_ +#ifndef _CAIRO_BOILERPLATE_PRIVATE_H_ +#define _CAIRO_BOILERPLATE_PRIVATE_H_ -cairo_surface_t * -_cairo_boilerplate_quartz_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); +#include "cairo-boilerplate.h" + +CAIRO_BEGIN_DECLS + +void +_cairo_boilerplate_register_all (void); void -_cairo_boilerplate_quartz_cleanup (void *closure); +_cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets, + unsigned int count); + +#define CAIRO_BOILERPLATE(name__, targets__) \ +void _register_##name__ (void); \ +void _register_##name__ (void) { \ + _cairo_boilerplate_register_backend (targets__, \ + sizeof (targets__) / sizeof (targets__[0])); \ +} + +CAIRO_END_DECLS -#endif +#endif /* _CAIRO_BOILERPLATE_PRIVATE_H_ */ diff --git a/boilerplate/cairo-boilerplate-ps-private.h b/boilerplate/cairo-boilerplate-ps-private.h deleted file mode 100644 index b97c7db..0000000 --- a/boilerplate/cairo-boilerplate-ps-private.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_PS_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_PS_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_ps2_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -cairo_surface_t * -_cairo_boilerplate_ps3_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface, - unsigned int flags); - -void -_cairo_boilerplate_ps_cleanup (void *closure); - -cairo_status_t -_cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface); - -cairo_status_t -_cairo_boilerplate_ps_surface_write_to_png (cairo_surface_t *surface, const char *filename); - -cairo_surface_t * -_cairo_boilerplate_ps_get_image_surface (cairo_surface_t *surface, - int page, - int width, - int height); - -#endif diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c index c3efcea..899a321 100644 --- a/boilerplate/cairo-boilerplate-ps.c +++ b/boilerplate/cairo-boilerplate-ps.c @@ -24,16 +24,15 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-ps-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-ps.h> + #include <cairo-ps-surface-private.h> #include <cairo-paginated-surface-private.h> -#if HAVE_SIGNAL_H -#include <stdlib.h> -#include <signal.h> +#if ! CAIRO_HAS_META_SURFACE +#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META #endif static const cairo_user_data_key_t ps_closure_key; @@ -68,10 +67,10 @@ static cairo_surface_t * _cairo_boilerplate_ps_create_surface (const char *name, cairo_content_t content, cairo_ps_level_t level, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -90,8 +89,8 @@ _cairo_boilerplate_ps_create_surface (const char *name, xunlink (ptc->filename); ptc->level = level; - ptc->width = width; - ptc->height = height; + ptc->width = ceil (width); + ptc->height = ceil (height); surface = cairo_ps_surface_create (ptc->filename, width, height); if (cairo_surface_status (surface)) @@ -105,7 +104,7 @@ _cairo_boilerplate_ps_create_surface (const char *name, ptc->target = surface; surface = cairo_surface_create_similar (ptc->target, CAIRO_CONTENT_COLOR, - width, height); + ptc->width, ptc->height); if (cairo_surface_status (surface)) goto CLEANUP_TARGET; } else { @@ -127,13 +126,13 @@ _cairo_boilerplate_ps_create_surface (const char *name, return surface; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_ps2_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -146,13 +145,13 @@ _cairo_boilerplate_ps2_create_surface (const char *name, closure); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_ps3_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -165,7 +164,7 @@ _cairo_boilerplate_ps3_create_surface (const char *name, closure); } -cairo_status_t +static cairo_status_t _cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface) { ps_target_closure_t *ptc = cairo_surface_get_user_data (surface, @@ -183,6 +182,7 @@ _cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface) if (ptc->target) { cairo_t *cr; + cr = cairo_create (ptc->target); cairo_set_source_surface (cr, surface, 0, 0); cairo_paint (cr); @@ -193,7 +193,6 @@ _cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface) if (status) return status; - cairo_surface_finish (surface); status = cairo_surface_status (surface); if (status) return status; @@ -202,14 +201,10 @@ _cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface) } cairo_surface_finish (surface); - status = cairo_surface_status (surface); - if (status) - return status; - - return CAIRO_STATUS_SUCCESS; + return cairo_surface_status (surface); } -cairo_status_t +static cairo_status_t _cairo_boilerplate_ps_surface_write_to_png (cairo_surface_t *surface, const char *filename) { ps_target_closure_t *ptc = cairo_surface_get_user_data (surface, @@ -232,7 +227,7 @@ _cairo_boilerplate_ps_surface_write_to_png (cairo_surface_t *surface, const char return CAIRO_STATUS_SUCCESS; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_ps_get_image_surface (cairo_surface_t *surface, int page, int width, @@ -266,7 +261,7 @@ _cairo_boilerplate_ps_get_image_surface (cairo_surface_t *surface, return surface; } -void +static void _cairo_boilerplate_ps_cleanup (void *closure) { ps_target_closure_t *ptc = closure; @@ -276,7 +271,7 @@ _cairo_boilerplate_ps_cleanup (void *closure) free (ptc); } -void +static void _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface, unsigned int flags) { @@ -293,3 +288,59 @@ _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface, surface = (cairo_ps_surface_t*) paginated->target; surface->force_fallbacks = TRUE; } + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_PS_SURFACE + { + "ps2", "ps", ".ps", NULL, + CAIRO_SURFACE_TYPE_PS, + CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, + "cairo_ps_surface_create", + _cairo_boilerplate_ps2_create_surface, + _cairo_boilerplate_ps_force_fallbacks, + _cairo_boilerplate_ps_finish_surface, + _cairo_boilerplate_ps_get_image_surface, + _cairo_boilerplate_ps_surface_write_to_png, + _cairo_boilerplate_ps_cleanup, + NULL, TRUE, TRUE + }, + { + "ps2", "ps", ".ps", NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, + "cairo_ps_surface_create", + _cairo_boilerplate_ps2_create_surface, + _cairo_boilerplate_ps_force_fallbacks, + _cairo_boilerplate_ps_finish_surface, + _cairo_boilerplate_ps_get_image_surface, + _cairo_boilerplate_ps_surface_write_to_png, + _cairo_boilerplate_ps_cleanup, + NULL, TRUE, TRUE + }, + { + "ps3", "ps", ".ps", NULL, + CAIRO_SURFACE_TYPE_PS, + CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, + "cairo_ps_surface_create", + _cairo_boilerplate_ps3_create_surface, + _cairo_boilerplate_ps_force_fallbacks, + _cairo_boilerplate_ps_finish_surface, + _cairo_boilerplate_ps_get_image_surface, + _cairo_boilerplate_ps_surface_write_to_png, + _cairo_boilerplate_ps_cleanup, + NULL, TRUE, TRUE + }, + { + "ps3", "ps", ".ps", NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, + "cairo_ps_surface_create", + _cairo_boilerplate_ps3_create_surface, + _cairo_boilerplate_ps_force_fallbacks, + _cairo_boilerplate_ps_finish_surface, + _cairo_boilerplate_ps_get_image_surface, + _cairo_boilerplate_ps_surface_write_to_png, + _cairo_boilerplate_ps_cleanup, + NULL, TRUE, TRUE + }, +#endif +}; +CAIRO_BOILERPLATE (ps, targets) diff --git a/boilerplate/cairo-boilerplate-qt.cpp b/boilerplate/cairo-boilerplate-qt.cpp new file mode 100644 index 0000000..8f19811 --- /dev/null +++ b/boilerplate/cairo-boilerplate-qt.cpp @@ -0,0 +1,113 @@ +/* Cairo - a vector graphics library with display and print output + * + * Copyright © 2009 Chris Wilson + * + * 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 Chris Wilson. + */ + +#include "cairo-boilerplate-private.h" + +#include <cairo-qt.h> + +#include <qapplication.h> +#include <X11/Xlib.h> + +typedef struct _qt_closure { + Display *dpy; + QApplication *app; +} qt_closure_t; + +static void +_cairo_boilerplate_qt_cleanup (void *closure) +{ + qt_closure_t *qtc = (qt_closure_t *) closure; + + delete qtc->app; + XCloseDisplay (qtc->dpy); + free (qtc); +} + +static cairo_surface_t * +_cairo_boilerplate_qt_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + qt_closure_t *qtc; + + qtc = (qt_closure_t *) xcalloc (1, sizeof (qt_closure_t)); + qtc->dpy = XOpenDisplay (NULL); + if (qtc->dpy == NULL) { + free (qtc); + return NULL; + } + + if (mode == CAIRO_BOILERPLATE_MODE_TEST) + XSynchronize (qtc->dpy, True); + + qtc->app = new QApplication (qtc->dpy); + *closure = qtc; + return cairo_qt_surface_create_with_qpixmap (content, width, height); +} + +static void +_cairo_boilerplate_qt_synchronize (void *closure) +{ + qt_closure_t *qtc = (qt_closure_t *) closure; + + qtc->app->flush (); /* not sure if this is sufficient */ +} + +static const cairo_boilerplate_target_t targets[] = { + { + "qt", "qt", NULL, NULL, + CAIRO_SURFACE_TYPE_QT, CAIRO_CONTENT_COLOR_ALPHA, 0, + _cairo_boilerplate_qt_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_qt_cleanup + }, + { + "qt", "qt", NULL, NULL, + CAIRO_SURFACE_TYPE_QT, CAIRO_CONTENT_COLOR, 0, + _cairo_boilerplate_qt_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_qt_cleanup + }, +}; +extern "C" { +CAIRO_BOILERPLATE (qt, targets) +} diff --git a/boilerplate/cairo-boilerplate-quartz.c b/boilerplate/cairo-boilerplate-quartz.c index 3065213..1948d83 100644 --- a/boilerplate/cairo-boilerplate-quartz.c +++ b/boilerplate/cairo-boilerplate-quartz.c @@ -24,18 +24,17 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-quartz-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-quartz.h> -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_quartz_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -49,8 +48,24 @@ _cairo_boilerplate_quartz_create_surface (const char *name, return cairo_quartz_surface_create (format, width, height); } -void -_cairo_boilerplate_quartz_cleanup (void *closure) -{ - /* nothing */ -} +static const cairo_boilerplate_target_t targets[] = { + { + "quartz", "quartz", NULL, NULL, + CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_quartz_surface_create", + _cairo_boilerplate_quartz_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + }, + { + "quartz", "quartz", NULL, NULL, + CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR, 0, + "cairo_quartz_surface_create", + _cairo_boilerplate_quartz_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + }, +}; +CAIRO_BOILERPLATE (quartz, targets) diff --git a/boilerplate/cairo-boilerplate-script-private.h b/boilerplate/cairo-boilerplate-script-private.h deleted file mode 100644 index 480e422..0000000 --- a/boilerplate/cairo-boilerplate-script-private.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2008 Chris Wilson - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Chris Wilson <chris@chris-wilson.co.uk> - */ - -#ifndef _CAIRO_BOILERPLATE_SCRIPT_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_SCRIPT_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_script_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -cairo_status_t -_cairo_boilerplate_script_finish_surface (cairo_surface_t *surface); - -cairo_status_t -_cairo_boilerplate_script_surface_write_to_png (cairo_surface_t *surface, - const char *filename); - -cairo_surface_t * -_cairo_boilerplate_script_get_image_surface (cairo_surface_t *surface, - int page, - int width, - int height); - -void -_cairo_boilerplate_script_cleanup (void *closure); - -#endif diff --git a/boilerplate/cairo-boilerplate-script.c b/boilerplate/cairo-boilerplate-script.c index ae08cbc..e37fdf1 100644 --- a/boilerplate/cairo-boilerplate-script.c +++ b/boilerplate/cairo-boilerplate-script.c @@ -24,31 +24,31 @@ * Author: Chris Wilson <chris@chris-wilson.co.uk> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-script-private.h" +#include "cairo-boilerplate-private.h" #include "cairo-script.h" -cairo_user_data_key_t script_closure_key; +static cairo_user_data_key_t script_closure_key; typedef struct _script_target_closure { char *filename; - int width; - int height; + double width; + double height; } script_target_closure_t; -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_script_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) { script_target_closure_t *ptc; + cairo_script_context_t *ctx; cairo_surface_t *surface; cairo_status_t status; @@ -60,7 +60,9 @@ _cairo_boilerplate_script_create_surface (const char *name, xasprintf (&ptc->filename, "%s.out.cs", name); xunlink (ptc->filename); - surface = cairo_script_surface_create (ptc->filename, width, height); + ctx = cairo_script_context_create (ptc->filename); + surface = cairo_script_surface_create (ctx, content, width, height); + cairo_script_context_destroy (ctx); status = cairo_surface_set_user_data (surface, &script_closure_key, ptc, NULL); @@ -75,14 +77,14 @@ _cairo_boilerplate_script_create_surface (const char *name, return surface; } -cairo_status_t +static cairo_status_t _cairo_boilerplate_script_finish_surface (cairo_surface_t *surface) { cairo_surface_finish (surface); return cairo_surface_status (surface); } -cairo_status_t +static cairo_status_t _cairo_boilerplate_script_surface_write_to_png (cairo_surface_t *surface, const char *filename) { @@ -98,7 +100,7 @@ _cairo_boilerplate_script_convert_to_image (cairo_surface_t *surface, return cairo_boilerplate_convert_to_image (ptc->filename, page); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_script_get_image_surface (cairo_surface_t *surface, int page, int width, @@ -116,10 +118,24 @@ _cairo_boilerplate_script_get_image_surface (cairo_surface_t *surface, return surface; } -void +static void _cairo_boilerplate_script_cleanup (void *closure) { script_target_closure_t *ptc = closure; free (ptc->filename); free (ptc); } + +static const cairo_boilerplate_target_t target[] = {{ + "script", "script", ".cs", NULL, + CAIRO_SURFACE_TYPE_SCRIPT, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_script_surface_create", + _cairo_boilerplate_script_create_surface, + NULL, + _cairo_boilerplate_script_finish_surface, + _cairo_boilerplate_script_get_image_surface, + _cairo_boilerplate_script_surface_write_to_png, + _cairo_boilerplate_script_cleanup, + NULL, FALSE +}}; +CAIRO_BOILERPLATE (script, target) diff --git a/boilerplate/cairo-boilerplate-skia.c b/boilerplate/cairo-boilerplate-skia.c new file mode 100644 index 0000000..13ab00b --- /dev/null +++ b/boilerplate/cairo-boilerplate-skia.c @@ -0,0 +1,52 @@ + +#include "cairo-boilerplate-private.h" + +#include <cairo-skia.h> + +static cairo_surface_t * +_cairo_boilerplate_skia_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + cairo_format_t format; + + *closure = NULL; + + if (content == CAIRO_CONTENT_COLOR_ALPHA) { + format = CAIRO_FORMAT_ARGB32; + } else if (content == CAIRO_CONTENT_COLOR) { + format = CAIRO_FORMAT_RGB24; + } else { + return NULL; + } + + return cairo_skia_surface_create (format, width, height); +} + +static const cairo_boilerplate_target_t targets[] = { + { + "skia", "skia", NULL, NULL, + CAIRO_SURFACE_TYPE_SKIA, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_skia_surface_create", + _cairo_boilerplate_skia_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png + }, + { + "skia", "skia", NULL, NULL, + CAIRO_SURFACE_TYPE_SKIA, CAIRO_CONTENT_COLOR, 0, + "cairo_skia_surface_create", + _cairo_boilerplate_skia_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png + }, +}; +CAIRO_BOILERPLATE (skia, targets) diff --git a/boilerplate/cairo-boilerplate-svg-private.h b/boilerplate/cairo-boilerplate-svg-private.h deleted file mode 100644 index d8c0a8f..0000000 --- a/boilerplate/cairo-boilerplate-svg-private.h +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_SVG_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_SVG_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_svg11_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -cairo_surface_t * -_cairo_boilerplate_svg12_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *surface, - unsigned int flags); - - -cairo_status_t -_cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface); - -cairo_status_t -_cairo_boilerplate_svg_surface_write_to_png (cairo_surface_t *surface, const char *filename); - -cairo_surface_t * -_cairo_boilerplate_svg_get_image_surface (cairo_surface_t *surface, - int page, - int width, - int height); - -void -_cairo_boilerplate_svg_cleanup (void *closure); - -#endif diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c index e6c1355..316e33d 100644 --- a/boilerplate/cairo-boilerplate-svg.c +++ b/boilerplate/cairo-boilerplate-svg.c @@ -24,8 +24,7 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-svg-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-svg.h> #include <cairo-svg-surface-private.h> @@ -36,6 +35,10 @@ #include <signal.h> #endif +#if ! CAIRO_HAS_META_SURFACE +#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META +#endif + static const cairo_user_data_key_t svg_closure_key; typedef struct _svg_target_closure { @@ -48,10 +51,10 @@ static cairo_surface_t * _cairo_boilerplate_svg_create_surface (const char *name, cairo_content_t content, cairo_svg_version_t version, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -62,8 +65,8 @@ _cairo_boilerplate_svg_create_surface (const char *name, *closure = ptc = xmalloc (sizeof (svg_target_closure_t)); - ptc->width = width; - ptc->height = height; + ptc->width = ceil (width); + ptc->height = ceil (height); xasprintf (&ptc->filename, "%s.out.svg", name); xunlink (ptc->filename); @@ -79,7 +82,7 @@ _cairo_boilerplate_svg_create_surface (const char *name, ptc->target = surface; surface = cairo_surface_create_similar (ptc->target, CAIRO_CONTENT_COLOR, - width, height); + ptc->width, ptc->height); if (cairo_surface_status (surface)) goto CLEANUP_TARGET; } else @@ -100,13 +103,13 @@ _cairo_boilerplate_svg_create_surface (const char *name, return surface; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_svg11_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -120,13 +123,13 @@ _cairo_boilerplate_svg11_create_surface (const char *name, closure); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_svg12_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -139,7 +142,7 @@ _cairo_boilerplate_svg12_create_surface (const char *name, closure); } -cairo_status_t +static cairo_status_t _cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface) { svg_target_closure_t *ptc = cairo_surface_get_user_data (surface, @@ -167,7 +170,6 @@ _cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface) if (status) return status; - cairo_surface_finish (surface); status = cairo_surface_status (surface); if (status) return status; @@ -183,7 +185,7 @@ _cairo_boilerplate_svg_finish_surface (cairo_surface_t *surface) return CAIRO_STATUS_SUCCESS; } -cairo_status_t +static cairo_status_t _cairo_boilerplate_svg_surface_write_to_png (cairo_surface_t *surface, const char *filename) { svg_target_closure_t *ptc = cairo_surface_get_user_data (surface, @@ -214,7 +216,7 @@ _cairo_boilerplate_svg_convert_to_image (cairo_surface_t *surface) return cairo_boilerplate_convert_to_image (ptc->filename, 0); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_svg_get_image_surface (cairo_surface_t *surface, int page, int width, @@ -235,7 +237,7 @@ _cairo_boilerplate_svg_get_image_surface (cairo_surface_t *surface, return surface; } -void +static void _cairo_boilerplate_svg_cleanup (void *closure) { svg_target_closure_t *ptc = closure; @@ -245,7 +247,7 @@ _cairo_boilerplate_svg_cleanup (void *closure) free (ptc); } -void +static void _cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *abstract_surface, unsigned int flags) { @@ -262,3 +264,62 @@ _cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *abstract_surface, surface = (cairo_svg_surface_t*) paginated->target; surface->force_fallbacks = TRUE; } + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_SVG_SURFACE + /* It seems we should be able to round-trip SVG content perfectly + * through librsvg and cairo, but for some mysterious reason, some + * systems get an error of 1 for some pixels on some of the text + * tests. XXX: I'd still like to chase these down at some point. + * For now just set the svg error tolerance to 1. */ + { + "svg11", "svg", NULL, NULL, + CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_svg_surface_create", + _cairo_boilerplate_svg11_create_surface, + _cairo_boilerplate_svg_force_fallbacks, + _cairo_boilerplate_svg_finish_surface, + _cairo_boilerplate_svg_get_image_surface, + _cairo_boilerplate_svg_surface_write_to_png, + _cairo_boilerplate_svg_cleanup, + NULL, TRUE, TRUE + }, + { + "svg11", "svg", NULL, NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1, + "cairo_svg_surface_create", + _cairo_boilerplate_svg11_create_surface, + _cairo_boilerplate_svg_force_fallbacks, + _cairo_boilerplate_svg_finish_surface, + _cairo_boilerplate_svg_get_image_surface, + _cairo_boilerplate_svg_surface_write_to_png, + _cairo_boilerplate_svg_cleanup, + NULL, TRUE, TRUE + }, + { + "svg12", "svg", NULL, NULL, + CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_svg_surface_create", + _cairo_boilerplate_svg12_create_surface, + _cairo_boilerplate_svg_force_fallbacks, + _cairo_boilerplate_svg_finish_surface, + _cairo_boilerplate_svg_get_image_surface, + _cairo_boilerplate_svg_surface_write_to_png, + _cairo_boilerplate_svg_cleanup, + NULL, TRUE, TRUE + }, + { + "svg12", "svg", NULL, NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1, + "cairo_svg_surface_create", + _cairo_boilerplate_svg12_create_surface, + _cairo_boilerplate_svg_force_fallbacks, + _cairo_boilerplate_svg_finish_surface, + _cairo_boilerplate_svg_get_image_surface, + _cairo_boilerplate_svg_surface_write_to_png, + _cairo_boilerplate_svg_cleanup, + NULL, TRUE, TRUE + }, +#endif +}; +CAIRO_BOILERPLATE (svg, targets) diff --git a/boilerplate/cairo-boilerplate-test-surfaces-private.h b/boilerplate/cairo-boilerplate-test-surfaces-private.h deleted file mode 100644 index 24a1ae8..0000000 --- a/boilerplate/cairo-boilerplate-test-surfaces-private.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_TEST_SURFACES_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_TEST_SURFACES_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_test_fallback_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -cairo_surface_t * -_cairo_boilerplate_test_fallback16_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - - -cairo_surface_t * -_cairo_boilerplate_test_meta_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - - -cairo_surface_t * -_cairo_boilerplate_test_paginated_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -cairo_status_t -_cairo_boilerplate_test_paginated_surface_write_to_png (cairo_surface_t *surface, - const char *filename); - -cairo_surface_t * -_cairo_boilerplate_test_paginated_get_image_surface (cairo_surface_t *surface, - int page, - int width, - int height); - -void -_cairo_boilerplate_test_paginated_cleanup (void *closure); - -#endif diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c index 644b278..7a3a16b 100644 --- a/boilerplate/cairo-boilerplate-test-surfaces.c +++ b/boilerplate/cairo-boilerplate-test-surfaces.c @@ -24,78 +24,87 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-test-surfaces-private.h" +#include "../cairo-version.h" + +#include "cairo-boilerplate-private.h" + +#include <cairo-types-private.h> #include <test-fallback-surface.h> #include <test-fallback16-surface.h> -#include <test-meta-surface.h> +#if CAIRO_HAS_TEST_PAGINATED_SURFACE #include <test-paginated-surface.h> - -#include <assert.h> - -cairo_surface_t * +#endif +#if CAIRO_HAS_TEST_NULL_SURFACE +#include <test-null-surface.h> +#endif +#if CAIRO_HAS_TEST_WRAPPING_SURFACE +#include <test-wrapping-surface.h> +#endif + +static cairo_surface_t * _cairo_boilerplate_test_fallback_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) { *closure = NULL; - return _cairo_test_fallback_surface_create (content, width, height); + return _cairo_test_fallback_surface_create (content, + ceil (width), ceil (height)); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_test_fallback16_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) { *closure = NULL; - return _cairo_test_fallback16_surface_create (content, width, height); + return _cairo_test_fallback16_surface_create (content, + ceil (width), ceil (height)); } -cairo_surface_t * -_cairo_boilerplate_test_meta_create_surface (const char *name, +#if CAIRO_HAS_TEST_NULL_SURFACE +static cairo_surface_t * +_cairo_boilerplate_test_null_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) { *closure = NULL; - return _cairo_test_meta_surface_create (content, width, height); + return _cairo_test_null_surface_create (content); } +#endif +#if CAIRO_HAS_TEST_PAGINATED_SURFACE static const cairo_user_data_key_t test_paginated_closure_key; typedef struct { - unsigned char *data; - cairo_content_t content; - int width; - int height; - int stride; + cairo_surface_t *target; } test_paginated_closure_t; -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_test_paginated_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -108,18 +117,10 @@ _cairo_boilerplate_test_paginated_create_surface (const char *name, *closure = tpc = xmalloc (sizeof (test_paginated_closure_t)); format = cairo_boilerplate_format_from_content (content); + tpc->target = cairo_image_surface_create (format, + ceil (width), ceil (height)); - tpc->content = content; - tpc->width = width; - tpc->height = height; - tpc->stride = cairo_format_stride_for_width (format, width); - tpc->data = xcalloc (tpc->stride, height); - - surface = _cairo_test_paginated_surface_create_for_data (tpc->data, - tpc->content, - tpc->width, - tpc->height, - tpc->stride); + surface = _cairo_test_paginated_surface_create (tpc->target); if (cairo_surface_status (surface)) goto CLEANUP; @@ -132,8 +133,9 @@ _cairo_boilerplate_test_paginated_create_surface (const char *name, cairo_surface_destroy (surface); surface = cairo_boilerplate_surface_create_in_error (status); + cairo_surface_destroy (tpc->target); + CLEANUP: - free (tpc->data); free (tpc); return surface; } @@ -149,12 +151,10 @@ _cairo_boilerplate_test_paginated_create_surface (const char *name, * test_paginated_surface would not be involved and wouldn't be * tested. */ -cairo_status_t +static cairo_status_t _cairo_boilerplate_test_paginated_surface_write_to_png (cairo_surface_t *surface, const char *filename) { - cairo_surface_t *image; - cairo_format_t format; test_paginated_closure_t *tpc; cairo_status_t status; @@ -165,28 +165,15 @@ _cairo_boilerplate_test_paginated_surface_write_to_png (cairo_surface_t *surface return status; tpc = cairo_surface_get_user_data (surface, &test_paginated_closure_key); - - format = cairo_boilerplate_format_from_content (tpc->content); - - image = cairo_image_surface_create_for_data (tpc->data, - format, - tpc->width, - tpc->height, - tpc->stride); - - status = cairo_surface_write_to_png (image, filename); - cairo_surface_destroy (image); - - return status; + return cairo_surface_write_to_png (tpc->target, filename); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_test_paginated_get_image_surface (cairo_surface_t *surface, int page, int width, int height) { - cairo_format_t format; test_paginated_closure_t *tpc; cairo_status_t status; @@ -201,37 +188,139 @@ _cairo_boilerplate_test_paginated_get_image_surface (cairo_surface_t *surface, return cairo_boilerplate_surface_create_in_error (status); tpc = cairo_surface_get_user_data (surface, &test_paginated_closure_key); - - format = cairo_boilerplate_format_from_content (tpc->content); - - if (0) { - return cairo_image_surface_create_for_data (tpc->data + tpc->stride * (tpc->height - height) + 4 * (tpc->width - width), /* hide the device offset */ - format, - width, - height, - tpc->stride); - } else { - cairo_surface_t *image, *surface; - - image = cairo_image_surface_create_for_data (tpc->data, - format, - tpc->width, - tpc->height, - tpc->stride); - cairo_surface_set_device_offset (image, - tpc->width - width, - tpc->height - height); - surface = _cairo_boilerplate_get_image_surface (image, 0, width, height); - cairo_surface_destroy (image); - return surface; - } + return _cairo_boilerplate_get_image_surface (tpc->target, 0, width, height); } -void +static void _cairo_boilerplate_test_paginated_cleanup (void *closure) { test_paginated_closure_t *tpc = closure; - free (tpc->data); + cairo_surface_destroy (tpc->target); free (tpc); } +#endif + +#if CAIRO_HAS_TEST_WRAPPING_SURFACE +static cairo_surface_t * +_cairo_boilerplate_test_wrapping_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + cairo_surface_t *target; + cairo_surface_t *surface; + cairo_format_t format; + + *closure = NULL; + + format = cairo_boilerplate_format_from_content (content); + target = cairo_image_surface_create (format, ceil (width), ceil (height)); + surface = _cairo_test_wrapping_surface_create (target); + cairo_surface_destroy (target); + + return surface; +} +#endif + +static const cairo_boilerplate_target_t targets[] = { + { + "test-fallback", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, + CAIRO_CONTENT_COLOR_ALPHA, 0, + "_cairo_test_fallback_surface_create", + _cairo_boilerplate_test_fallback_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png + }, + { + "test-fallback", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, + CAIRO_CONTENT_COLOR, 0, + "_cairo_test_fallback_surface_create", + _cairo_boilerplate_test_fallback_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png + }, + { + "test-fallback16", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, + CAIRO_CONTENT_COLOR_ALPHA, 0, + "_cairo_test_fallback16_surface_create", + _cairo_boilerplate_test_fallback16_create_surface, + NULL, NULL, + NULL, /* _cairo_boilerplate_get_image_surface, */ + cairo_surface_write_to_png + }, + { + "test-fallback16", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, + CAIRO_CONTENT_COLOR, 0, + "_cairo_test_fallback16_surface_create", + _cairo_boilerplate_test_fallback16_create_surface, + NULL, NULL, + NULL, /* _cairo_boilerplate_get_image_surface, */ + cairo_surface_write_to_png + }, +#if CAIRO_HAS_TEST_PAGINATED_SURFACE + { + "test-paginated", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED, + CAIRO_CONTENT_COLOR_ALPHA, 0, + "_cairo_test_paginated_surface_create", + _cairo_boilerplate_test_paginated_create_surface, + NULL, NULL, + _cairo_boilerplate_test_paginated_get_image_surface, + _cairo_boilerplate_test_paginated_surface_write_to_png, + _cairo_boilerplate_test_paginated_cleanup, + NULL, + FALSE, TRUE, + }, + { + "test-paginated", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED, + CAIRO_CONTENT_COLOR, 0, + "_cairo_test_paginated_surface_create", + _cairo_boilerplate_test_paginated_create_surface, + NULL, NULL, + _cairo_boilerplate_test_paginated_get_image_surface, + _cairo_boilerplate_test_paginated_surface_write_to_png, + _cairo_boilerplate_test_paginated_cleanup, + NULL, + FALSE, TRUE + }, +#endif +#if CAIRO_HAS_TEST_WRAPPING_SURFACE + { + "test-wrapping", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_TEST_WRAPPING, + CAIRO_CONTENT_COLOR_ALPHA, 0, + "_cairo_test_wrapping_surface_create", + _cairo_boilerplate_test_wrapping_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + }, +#endif +#if CAIRO_HAS_TEST_NULL_SURFACE + { + "null", "image", NULL, NULL, + CAIRO_INTERNAL_SURFACE_TYPE_NULL, + CAIRO_CONTENT_COLOR_ALPHA, 0, + "_cairo_test_null_surface_create", + _cairo_boilerplate_test_null_create_surface, + NULL, NULL, + NULL, NULL, NULL, + NULL, + TRUE, FALSE + }, +#endif +}; +CAIRO_BOILERPLATE (test, targets) diff --git a/boilerplate/cairo-boilerplate-vg.c b/boilerplate/cairo-boilerplate-vg.c new file mode 100644 index 0000000..2ea1a07 --- /dev/null +++ b/boilerplate/cairo-boilerplate-vg.c @@ -0,0 +1,353 @@ +/* Cairo - a vector graphics library with display and print output + * + * Copyright © 2009 Chris Wilson + * + * 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 Chris Wilson. + */ + +#include "cairo-boilerplate-private.h" + +#include <cairo-vg.h> + + /* XXX Not sure how to handle library specific context initialization */ +//#define USE_SHIVA +//#define USE_AMANITH + +#if CAIRO_HAS_GLX_FUNCTIONS + +#include <X11/Xlib.h> +#include <GL/glx.h> + +typedef struct _vg_closure { + Display *dpy; + int screen; + Window win; + + GLXContext ctx; + cairo_surface_t *surface; +} vg_closure_glx_t; + +static void +_cairo_boilerplate_vg_cleanup_glx (void *closure) +{ + vg_closure_glx_t *vgc = closure; + +#ifdef USE_AMANITH + vgDestroyContextAM (); +#endif +#ifdef USE_SHIVA + vgDestroyContextSH (); +#endif + + glXDestroyContext (vgc->dpy, vgc->ctx); + XDestroyWindow (vgc->dpy, vgc->win); + XCloseDisplay (vgc->dpy); + free (vgc); +} + +static cairo_surface_t * +_cairo_boilerplate_vg_create_surface_glx (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + int rgba_attribs[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_ALPHA_SIZE, 1, + GLX_DOUBLEBUFFER, + None + }; + int rgb_attribs[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + None + }; + XVisualInfo *vi; + Display *dpy; + Colormap cmap; + XSetWindowAttributes swa; + cairo_surface_t *surface; + cairo_vg_context_t *context; + vg_closure_glx_t *vgc; + + vgc = malloc (sizeof (vg_closure_glx_t)); + *closure = vgc; + + if (width == 0) + width = 1; + if (height == 0) + height = 1; + + dpy = XOpenDisplay (NULL); + vgc->dpy = dpy; + if (vgc->dpy == NULL) { + fprintf (stderr, "Failed to open display: %s\n", XDisplayName(0)); + free (vgc); + return NULL; + } + + if (content == CAIRO_CONTENT_COLOR) + vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgb_attribs); + else + vi = glXChooseVisual (dpy, DefaultScreen (dpy), rgba_attribs); + + if (vi == NULL) { + fprintf (stderr, "Failed to create RGB, double-buffered visual\n"); + XCloseDisplay (dpy); + free (vgc); + return NULL; + } + + vgc->ctx = glXCreateContext (dpy, vi, NULL, True); + cmap = XCreateColormap (dpy, + RootWindow (dpy, vi->screen), + vi->visual, + AllocNone); + swa.colormap = cmap; + swa.border_pixel = 0; + vgc->win = XCreateWindow (dpy, RootWindow (dpy, vi->screen), + -1, -1, 1, 1, 0, + vi->depth, + InputOutput, + vi->visual, + CWBorderPixel | CWColormap, &swa); + XFreeColormap (dpy, cmap); + XFree (vi); + + XMapWindow (dpy, vgc->win); + + /* we need an active context to initialise VG */ + glXMakeContextCurrent (dpy, vgc->win, vgc->win, vgc->ctx); + +#ifdef USE_AMANITH + vgInitContextAM (width, height, VG_FALSE, VG_TRUE); +#endif +#ifdef USE_SHIVA + vgCreateContextSH (width, height); +#endif + + context = cairo_vg_context_create_for_glx (dpy, vgc->ctx); + vgc->surface = cairo_vg_surface_create (context, content, width, height); + cairo_vg_context_destroy (context); + + surface = vgc->surface; + if (cairo_surface_status (surface)) + _cairo_boilerplate_vg_cleanup_glx (vgc); + + return surface; +} +#endif + +#if CAIRO_HAS_EGL_FUNCTIONS +typedef struct _vg_closure_egl { + EGLDisplay *dpy; + EGLContext *ctx; + EGLSurface *dummy; +} vg_closure_egl_t; + +static void +_cairo_boilerplate_vg_cleanup_egl (void *closure) +{ + vg_closure_egl_t *vgc = closure; + +#ifdef USE_AMANITH + vgDestroyContextAM (); +#endif +#ifdef USE_SHIVA + vgDestroyContextSH (); +#endif + + eglDestroyContext (vgc->dpy, vgc->ctx); + eglDestroySurface (vgc->dpy, vgc->dummy); + eglTerminate (vgc->dpy); + free (vgc); +} + +static cairo_surface_t * +_cairo_boilerplate_vg_create_surface_egl (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + int rgba_attribs[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT, + None + }; + int rgb_attribs[] = { + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE_BIT, + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT, + None + }; + int dummy_attribs[] = { + EGL_WIDTH, 8, EGL_HEIGHT, 8, + EGL_NONE + }; + EGLDisplay *dpy; + int major, minor; + EGLConfig config; + int num_configs; + EGLContext *egl_context; + EGLSurface *dummy; + cairo_vg_context_t *context; + cairo_surface_t *surface; + vg_closure_egl_t *vgc; + + dpy = eglGetDisplay (EGL_DEFAULT_DISPLAY); + + if (! eglInitialize (dpy, &major, &minor)) + return NULL; + + eglBindAPI (EGL_OPENVG_API); + + if (! eglChooseConfig (dpy, + content == CAIRO_CONTENT_COLOR_ALPHA ? + rgba_attribs : rgb_attribs, + &config, 1, &num_configs) || + num_configs != 1) + { + return NULL; + } + + egl_context = eglCreateContext (dpy, config, NULL, NULL); + if (egl_context == NULL) + return NULL; + + /* Create a dummy surface in order to enable a context to initialise VG */ + dummy = eglCreatePbufferSurface (dpy, config, dummy_attribs); + if (dummy == NULL) + return NULL; + if (! eglMakeCurrent (dpy, dummy, dummy, egl_context)) + return NULL; + +#ifdef USE_AMANITH + vgInitContextAM (width, height, VG_FALSE, VG_TRUE); +#endif +#ifdef USE_SHIVA + vgCreateContextSH (width, height); +#endif + + vgc = xmalloc (sizeof (vg_closure_egl_t)); + vgc->dpy = dpy; + vgc->ctx = egl_context; + vgc->dummy = dummy; + *closure = vgc; + + context = cairo_vg_context_create_for_egl (vgc->dpy, vgc->ctx); + surface = cairo_vg_surface_create (context, content, width, height); + cairo_vg_context_destroy (context); + + if (cairo_surface_status (surface)) + _cairo_boilerplate_vg_cleanup_egl (vgc); + + return surface; +} +#endif + +static void +_cairo_boilerplate_vg_synchronize (void *closure) +{ + vgFinish (); +} + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_HAS_GLX_FUNCTIONS + { + "vg-glx", "vg", NULL, NULL, + CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_vg_context_create_for_glx", + _cairo_boilerplate_vg_create_surface_glx, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_vg_cleanup_glx, + _cairo_boilerplate_vg_synchronize + }, + { + "vg-glx", "vg", NULL, NULL, + CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR, 1, + "cairo_vg_context_create_for_glx", + _cairo_boilerplate_vg_create_surface_glx, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_vg_cleanup_glx, + _cairo_boilerplate_vg_synchronize + }, +#endif +#if CAIRO_HAS_EGL_FUNCTIONS + { + "vg-egl", "vg", NULL, NULL, + CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_vg_context_create_for_egl", + _cairo_boilerplate_vg_create_surface_egl, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_vg_cleanup_egl, + _cairo_boilerplate_vg_synchronize + }, + { + "vg-egl", "vg", NULL, NULL, + CAIRO_SURFACE_TYPE_VG, CAIRO_CONTENT_COLOR, 1, + "cairo_vg_context_create_for_egl", + _cairo_boilerplate_vg_create_surface_egl, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_vg_cleanup_egl, + _cairo_boilerplate_vg_synchronize + }, +#endif +}; +CAIRO_BOILERPLATE (vg, targets) diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c index 13a6551..ecaac5f 100644 --- a/boilerplate/cairo-boilerplate-win32-printing.c +++ b/boilerplate/cairo-boilerplate-win32-printing.c @@ -34,8 +34,7 @@ # define _WIN32_WINNT 0x0500 #endif -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-win32-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-win32.h> #include <cairo-win32-private.h> @@ -59,10 +58,9 @@ # define FEATURESETTING_PSLEVEL 0x0002 #endif -cairo_user_data_key_t win32_closure_key; +static cairo_user_data_key_t win32_closure_key; -typedef struct _win32_target_closure -{ +typedef struct _win32_target_closure { char *filename; int width; int height; @@ -161,13 +159,13 @@ create_printer_dc (win32_target_closure_t *ptc) ptc->bottom_margin = 72.0*(page_height - printable_height - top_margin)/y_dpi; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_win32_printing_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -233,7 +231,7 @@ _cairo_boilerplate_win32_printing_create_surface (const char *name, return surface; } -cairo_status_t +static cairo_status_t _cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface, const char *filename) { win32_target_closure_t *ptc = cairo_surface_get_user_data (surface, &win32_closure_key); @@ -300,7 +298,7 @@ _cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface return CAIRO_STATUS_SUCCESS; } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_win32_printing_get_image_surface (cairo_surface_t *surface, int page, int width, @@ -331,7 +329,7 @@ _cairo_boilerplate_win32_printing_get_image_surface (cairo_surface_t *surface, return surface; } -void +static void _cairo_boilerplate_win32_printing_cleanup (void *closure) { win32_target_closure_t *ptc = closure; @@ -342,3 +340,32 @@ _cairo_boilerplate_win32_printing_cleanup (void *closure) free (ptc); DeleteDC (ptc->dc); } + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE + { + "win32-printing", "win32", ".ps", NULL, + CAIRO_SURFACE_TYPE_WIN32_PRINTING, + CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, + "cairo_win32_printing_surface_create", + _cairo_boilerplate_win32_printing_create_surface, + NULL, NULL, + _cairo_boilerplate_win32_printing_get_image_surface, + _cairo_boilerplate_win32_printing_surface_write_to_png, + _cairo_boilerplate_win32_printing_cleanup, + NULL, TRUE, TRUE + }, + { + "win32-printing", "win32", ".ps", NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, + "cairo_win32_printing_surface_create", + _cairo_boilerplate_win32_printing_create_surface, + NULL, NULL, + _cairo_boilerplate_win32_printing_get_image_surface, + _cairo_boilerplate_win32_printing_surface_write_to_png, + _cairo_boilerplate_win32_printing_cleanup, + NULL, TRUE, TRUE + }, +#endif +}; +CAIRO_BOILERPLATE (win32_printing, targets) diff --git a/boilerplate/cairo-boilerplate-win32-private.h b/boilerplate/cairo-boilerplate-win32-private.h deleted file mode 100644 index fc039ae..0000000 --- a/boilerplate/cairo-boilerplate-win32-private.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_WIN32_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_WIN32_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_win32_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -cairo_surface_t * -_cairo_boilerplate_win32_printing_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_win32_printing_cleanup (void *closure); - -cairo_status_t -_cairo_boilerplate_win32_printing_surface_write_to_png (cairo_surface_t *surface, - const char *filename); - -cairo_surface_t * -_cairo_boilerplate_win32_printing_get_image_surface (cairo_surface_t *surface, - int page, - int width, - int height); - -#endif diff --git a/boilerplate/cairo-boilerplate-win32.c b/boilerplate/cairo-boilerplate-win32.c index 4b54a54..2b3abb1 100644 --- a/boilerplate/cairo-boilerplate-win32.c +++ b/boilerplate/cairo-boilerplate-win32.c @@ -24,18 +24,17 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-win32-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-win32.h> -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_win32_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -48,3 +47,28 @@ _cairo_boilerplate_win32_create_surface (const char *name, return cairo_win32_surface_create_with_dib (format, width, height); } + +static const cairo_boilerplate_target_t targets[] = { + { + "win32", "win32", NULL, NULL, + CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR, 0, + "cairo_win32_surface_create_with_dib", + _cairo_boilerplate_win32_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png + }, + /* Testing the win32 surface isn't interesting, since for + * ARGB images it just chains to the image backend + */ + { + "win32", "win32", NULL, NULL, + CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_win32_surface_create_with_dib", + _cairo_boilerplate_win32_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png + }, +}; +CAIRO_BOILERPLATE (win32, targets) diff --git a/boilerplate/cairo-boilerplate-xcb-private.h b/boilerplate/cairo-boilerplate-xcb-private.h deleted file mode 100644 index 998e6b9..0000000 --- a/boilerplate/cairo-boilerplate-xcb-private.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_XCB_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_XCB_PRIVATE_H_ - -cairo_surface_t * -_cairo_boilerplate_xcb_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_xcb_cleanup (void *closure); - -void -_cairo_boilerplate_xcb_synchronize (void *closure); - -#endif diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c index 306f874..0ab2026 100644 --- a/boilerplate/cairo-boilerplate-xcb.c +++ b/boilerplate/cairo-boilerplate-xcb.c @@ -24,20 +24,30 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" -#include "cairo-boilerplate-xcb-private.h" +#include "cairo-boilerplate-private.h" #include <cairo-xcb-xrender.h> #include <xcb/xcb_renderutil.h> -typedef struct _xcb_target_closure -{ +static const cairo_user_data_key_t xcb_closure_key; + +typedef struct _xcb_target_closure { xcb_connection_t *c; xcb_pixmap_t pixmap; } xcb_target_closure_t; -void +static void +_cairo_boilerplate_xcb_cleanup (void *closure) +{ + xcb_target_closure_t *xtc = closure; + + xcb_free_pixmap (xtc->c, xtc->pixmap); + xcb_disconnect (xtc->c); + free (xtc); +} + +static void _cairo_boilerplate_xcb_synchronize (void *closure) { xcb_target_closure_t *xtc = closure; @@ -47,13 +57,13 @@ _cairo_boilerplate_xcb_synchronize (void *closure) 0)); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_xcb_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -63,6 +73,9 @@ _cairo_boilerplate_xcb_create_surface (const char *name, xcb_connection_t *c; xcb_render_pictforminfo_t *render_format; xcb_pict_standard_t format; + xcb_void_cookie_t cookie; + cairo_surface_t *surface; + cairo_status_t status; *closure = xtc = xmalloc (sizeof (xcb_target_closure_t)); @@ -80,37 +93,109 @@ _cairo_boilerplate_xcb_create_surface (const char *name, root = xcb_setup_roots_iterator(xcb_get_setup(c)).data; xtc->pixmap = xcb_generate_id (c); - xcb_create_pixmap (c, 32, xtc->pixmap, root->root, - width, height); - switch (content) { case CAIRO_CONTENT_COLOR: + cookie = xcb_create_pixmap_checked (c, 24, + xtc->pixmap, root->root, + width, height); format = XCB_PICT_STANDARD_RGB_24; break; + case CAIRO_CONTENT_COLOR_ALPHA: + cookie = xcb_create_pixmap_checked (c, 32, + xtc->pixmap, root->root, + width, height); format = XCB_PICT_STANDARD_ARGB_32; break; + case CAIRO_CONTENT_ALPHA: /* would be XCB_PICT_STANDARD_A_8 */ default: fprintf (stderr, "Invalid content for XCB test: %d\n", content); return NULL; } + /* slow, but sure */ + if (xcb_request_check (c, cookie) != NULL) { + xcb_disconnect (c); + free (xtc); + return NULL; + } + render_format = xcb_render_util_find_standard_format (xcb_render_util_query_formats (c), format); if (render_format->id == 0) return NULL; - return cairo_xcb_surface_create_with_xrender_format (c, xtc->pixmap, root, - render_format, - width, height); + surface = cairo_xcb_surface_create_with_xrender_format (c, xtc->pixmap, root, + render_format, + width, height); + + status = cairo_surface_set_user_data (surface, &xcb_closure_key, xtc, NULL); + if (status == CAIRO_STATUS_SUCCESS) + return surface; + + cairo_surface_destroy (surface); + surface = cairo_boilerplate_surface_create_in_error (status); + + _cairo_boilerplate_xcb_cleanup (xtc); + + return surface; } -void -_cairo_boilerplate_xcb_cleanup (void *closure) +static cairo_status_t +_cairo_boilerplate_xcb_finish_surface (cairo_surface_t *surface) { - xcb_target_closure_t *xtc = closure; + xcb_target_closure_t *xtc = cairo_surface_get_user_data (surface, + &xcb_closure_key); + xcb_generic_event_t *ev; - xcb_free_pixmap (xtc->c, xtc->pixmap); - xcb_disconnect (xtc->c); - free (xtc); + cairo_surface_flush (surface); + + if (cairo_surface_status (surface)) + return cairo_surface_status (surface); + + while ((ev = xcb_poll_for_event (xtc->c)) != NULL) { + if (ev->response_type == 0 /* trust me! */) { + xcb_generic_error_t *error = (xcb_generic_error_t *) ev; + + fprintf (stderr, "Detected error during xcb run: %d major=%d, minor=%d\n", + error->error_code, error->major_code, error->minor_code); + + return CAIRO_STATUS_WRITE_ERROR; + } + } + + if (xcb_connection_has_error (xtc->c)) + return CAIRO_STATUS_WRITE_ERROR; + + return CAIRO_STATUS_SUCCESS; } + +static const cairo_boilerplate_target_t targets[] = { + /* Acceleration architectures may make the results differ by a + * bit, so we set the error tolerance to 1. */ + { + "xcb", "xlib", NULL, NULL, + CAIRO_SURFACE_TYPE_XCB, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_xcb_surface_create_with_xrender_format", + _cairo_boilerplate_xcb_create_surface, + NULL, + _cairo_boilerplate_xcb_finish_surface, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_xcb_cleanup, + _cairo_boilerplate_xcb_synchronize + }, + { + "xcb", "xlib", NULL, NULL, + CAIRO_SURFACE_TYPE_XCB, CAIRO_CONTENT_COLOR, 1, + "cairo_xcb_surface_create_with_xrender_format", + _cairo_boilerplate_xcb_create_surface, + NULL, + _cairo_boilerplate_xcb_finish_surface, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_xcb_cleanup, + _cairo_boilerplate_xcb_synchronize + }, +}; +CAIRO_BOILERPLATE (xcb, targets) diff --git a/boilerplate/cairo-boilerplate-xlib-private.h b/boilerplate/cairo-boilerplate-xlib-private.h deleted file mode 100644 index 0bd911d..0000000 --- a/boilerplate/cairo-boilerplate-xlib-private.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ -/* - * Copyright © 2004,2006 Red Hat, Inc. - * - * 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 - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. 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: Carl D. Worth <cworth@cworth.org> - */ - -#ifndef _CAIRO_BOILERPLATE_XLIB_PRIVATE_H_ -#define _CAIRO_BOILERPLATE_XLIB_PRIVATE_H_ - -#if CAIRO_HAS_XLIB_XRENDER_SURFACE -cairo_surface_t * -_cairo_boilerplate_xlib_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); -#endif - -cairo_surface_t * -_cairo_boilerplate_xlib_fallback_create_surface (const char *name, - cairo_content_t content, - int width, - int height, - int max_width, - int max_height, - cairo_boilerplate_mode_t mode, - int id, - void **closure); - -void -_cairo_boilerplate_xlib_cleanup (void *closure); - -void -_cairo_boilerplate_xlib_synchronize (void *closure); - -#endif diff --git a/boilerplate/cairo-boilerplate-xlib.c b/boilerplate/cairo-boilerplate-xlib.c index a4deeb7..fe54d98 100644 --- a/boilerplate/cairo-boilerplate-xlib.c +++ b/boilerplate/cairo-boilerplate-xlib.c @@ -24,9 +24,8 @@ * Author: Carl D. Worth <cworth@cworth.org> */ -#include "cairo-boilerplate.h" +#include "cairo-boilerplate-private.h" #include "cairo-boilerplate-xlib.h" -#include "cairo-boilerplate-xlib-private.h" #include <cairo-xlib.h> #if CAIRO_HAS_XLIB_XRENDER_SURFACE @@ -36,14 +35,28 @@ #include <X11/Xutil.h> /* for XDestroyImage */ -typedef struct _xlib_target_closure -{ +typedef struct _xlib_target_closure { Display *dpy; Drawable drawable; cairo_bool_t drawable_is_pixmap; } xlib_target_closure_t; -void +static void +_cairo_boilerplate_xlib_cleanup (void *closure) +{ + xlib_target_closure_t *xtc = closure; + + if (xtc->drawable) { + if (xtc->drawable_is_pixmap) + XFreePixmap (xtc->dpy, xtc->drawable); + else + XDestroyWindow (xtc->dpy, xtc->drawable); + } + XCloseDisplay (xtc->dpy); + free (xtc); +} + +static void _cairo_boilerplate_xlib_synchronize (void *closure) { xlib_target_closure_t *xtc = closure; @@ -185,13 +198,13 @@ _cairo_boilerplate_xlib_perf_create_surface (Display *dpy, width, height); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_xlib_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -202,9 +215,12 @@ _cairo_boilerplate_xlib_create_surface (const char *name, *closure = xtc = xcalloc (1, sizeof (xlib_target_closure_t)); - if (width == 0) + width = ceil (width); + if (width < 1) width = 1; - if (height == 0) + + height = ceil (height); + if (height < 1) height = 1; xtc->dpy = dpy = XOpenDisplay (NULL); @@ -224,7 +240,36 @@ _cairo_boilerplate_xlib_create_surface (const char *name, return surface; } + +cairo_status_t +cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface) +{ + cairo_xlib_surface_t *surface = (cairo_xlib_surface_t*) abstract_surface; + + if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_XLIB) + return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; + + surface->render_major = surface->render_minor = -1; + surface->xrender_format = NULL; + + /* The content type is forced by _xrender_format_to_content() during + * non-Render surface creation, so repeat the procedure here. */ + surface->base.content = CAIRO_CONTENT_COLOR; + + /* These flags are set based on known bugs and lack of RENDER support */ +#if CAIRO_XLIB_SURFACE_HAS_BUGGY_GRADIENTS + surface->buggy_gradients = TRUE; +#endif +#if CAIRO_XLIB_SURFACE_HAS_BUGGY_PAD_REFLECT + surface->buggy_pad_reflect = TRUE; #endif +#if CAIRO_XLIB_SURFACE_HAS_BUGGY_REPEAT + surface->buggy_repeat = TRUE; +#endif + + return CAIRO_STATUS_SUCCESS; +} + /* The xlib-fallback target differs from the xlib target in two ways: * @@ -235,13 +280,13 @@ _cairo_boilerplate_xlib_create_surface (const char *name, * This provides testing of the non-Render fallback paths we have in * cairo-xlib-surface.c */ -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_xlib_fallback_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -265,9 +310,12 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name, *closure = xtc = xmalloc (sizeof (xlib_target_closure_t)); - if (width == 0) + width = ceil (width); + if (width < 1) width = 1; - if (height == 0) + + height = ceil (height); + if (height < 1) height = 1; xtc->dpy = dpy = XOpenDisplay (NULL); @@ -329,35 +377,113 @@ _cairo_boilerplate_xlib_fallback_create_surface (const char *name, return surface; } -void -_cairo_boilerplate_xlib_cleanup (void *closure) +static cairo_surface_t * +_cairo_boilerplate_xlib_reference_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) { - xlib_target_closure_t *xtc = closure; - - if (xtc->drawable) { - if (xtc->drawable_is_pixmap) - XFreePixmap (xtc->dpy, xtc->drawable); - else - XDestroyWindow (xtc->dpy, xtc->drawable); + xlib_target_closure_t *xtc; + Display *dpy; + cairo_surface_t *surface; + const char *display; + + display = getenv ("CAIRO_REFERENCE_DISPLAY"); + if (display == NULL) { + return _cairo_boilerplate_xlib_fallback_create_surface (name, content, + width, height, + max_width, + max_height, + mode, id, + closure); } - XCloseDisplay (xtc->dpy); - free (xtc); -} -cairo_status_t -cairo_boilerplate_xlib_surface_disable_render (cairo_surface_t *abstract_surface) -{ - cairo_xlib_surface_t *surface = (cairo_xlib_surface_t*) abstract_surface; + *closure = xtc = xcalloc (1, sizeof (xlib_target_closure_t)); - if (cairo_surface_get_type (abstract_surface) != CAIRO_SURFACE_TYPE_XLIB) - return CAIRO_STATUS_SURFACE_TYPE_MISMATCH; + width = ceil (width); + if (width < 1) + width = 1; - surface->render_major = surface->render_minor = -1; - surface->xrender_format = NULL; + height = ceil (height); + if (height < 1) + height = 1; - /* The content type is forced by _xrender_format_to_content() during - * non-Render surface creation, so repeat the procedure here. */ - surface->base.content = CAIRO_CONTENT_COLOR; + xtc->dpy = dpy = XOpenDisplay (display); + if (xtc->dpy == NULL) { + free (xtc); + CAIRO_BOILERPLATE_DEBUG (("Failed to open display: %s\n", display)); + return NULL; + } - return CAIRO_STATUS_SUCCESS; + if (mode == CAIRO_BOILERPLATE_MODE_TEST) + surface = _cairo_boilerplate_xlib_test_create_surface (dpy, content, width, height, xtc); + else /* mode == CAIRO_BOILERPLATE_MODE_PERF */ + surface = _cairo_boilerplate_xlib_perf_create_surface (dpy, content, width, height, xtc); + + if (surface == NULL || cairo_surface_status (surface)) + _cairo_boilerplate_xlib_cleanup (xtc); + + return surface; } +#endif + +static const cairo_boilerplate_target_t targets[] = { +#if CAIRO_HAS_XLIB_XRENDER_SURFACE + /* Acceleration architectures may make the results differ by a + * bit, so we set the error tolerance to 1. */ + { + "xlib", "xlib", NULL, "xlib-reference", + CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR_ALPHA, 1, + "cairo_xlib_surface_create_with_xrender_format", + _cairo_boilerplate_xlib_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_xlib_cleanup, + _cairo_boilerplate_xlib_synchronize + }, + { + "xlib", "xlib", NULL, "xlib-reference", + CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1, + "cairo_xlib_surface_create_with_xrender_format", + _cairo_boilerplate_xlib_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_xlib_cleanup, + _cairo_boilerplate_xlib_synchronize + }, + { + "xlib-reference", "xlib", NULL, NULL, + CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1, + "cairo_xlib_surface_create", + _cairo_boilerplate_xlib_reference_create_surface, + NULL, NULL, + NULL, /* get_image */ + cairo_surface_write_to_png, + _cairo_boilerplate_xlib_cleanup, + _cairo_boilerplate_xlib_synchronize + }, +#endif +#if CAIRO_HAS_XLIB_SURFACE + /* This is a fallback surface which uses xlib fallbacks instead of + * the Render extension. */ + { + "xlib-fallback", "xlib", NULL, NULL, + CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1, + "cairo_xlib_surface_create", + _cairo_boilerplate_xlib_fallback_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_xlib_cleanup, + _cairo_boilerplate_xlib_synchronize + }, +#endif +}; +CAIRO_BOILERPLATE (xlib, targets) diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index 31df704..1414699 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -26,49 +26,16 @@ #define CAIRO_VERSION_H 1 -#include "cairo-boilerplate.h" +#include "cairo-boilerplate-private.h" #include "cairo-boilerplate-scaled-font.h" -#if CAIRO_HAS_BEOS_SURFACE -#include "cairo-boilerplate-beos-private.h" -#endif -#if CAIRO_HAS_DIRECTFB_SURFACE -#include "cairo-boilerplate-directfb-private.h" -#endif -#if CAIRO_HAS_GLITZ_SURFACE -#include "cairo-boilerplate-glitz-private.h" -#endif -#if CAIRO_HAS_PDF_SURFACE -#include "cairo-boilerplate-pdf-private.h" -#endif -#if CAIRO_HAS_PS_SURFACE -#include "cairo-boilerplate-ps-private.h" -#endif -#if CAIRO_HAS_QUARTZ_SURFACE -#include "cairo-boilerplate-quartz-private.h" -#endif -#if CAIRO_HAS_SCRIPT_SURFACE -#include "cairo-boilerplate-script-private.h" -#endif -#if CAIRO_HAS_SVG_SURFACE -#include "cairo-boilerplate-svg-private.h" -#endif -#ifdef CAIRO_HAS_TEST_SURFACES -#include "cairo-boilerplate-test-surfaces-private.h" -#endif -#if CAIRO_HAS_WIN32_SURFACE -#include "cairo-boilerplate-win32-private.h" -#endif -#if CAIRO_HAS_XCB_SURFACE -#include "cairo-boilerplate-xcb-private.h" -#endif -#if CAIRO_HAS_XLIB_SURFACE -#include "cairo-boilerplate-xlib-private.h" -#endif - #include <cairo-types-private.h> #include <cairo-scaled-font-private.h> +#if CAIRO_HAS_SCRIPT_SURFACE +#include <cairo-script.h> +#endif + /* get the "real" version info instead of dummy cairo-version.h */ #undef CAIRO_VERSION_H #include "../cairo-version.h" @@ -78,6 +45,10 @@ #include <assert.h> #include <errno.h> +#if HAVE_DLFCN_H +#include <dlfcn.h> +#endif + #if HAVE_UNISTD_H && HAVE_FCNTL_H && HAVE_SIGNAL_H && HAVE_SYS_STAT_H && HAVE_SYS_SOCKET_H && HAVE_SYS_UN_H #include <unistd.h> #include <fcntl.h> @@ -117,6 +88,22 @@ cairo_boilerplate_content_name (cairo_content_t content) } } +static const char * +_cairo_boilerplate_content_visible_name (cairo_content_t content) +{ + switch (cairo_boilerplate_content (content)) { + case CAIRO_CONTENT_COLOR: + return "rgb"; + case CAIRO_CONTENT_COLOR_ALPHA: + return "rgba"; + case CAIRO_CONTENT_ALPHA: + return "a"; + default: + assert (0); /* not reached */ + return "---"; + } +} + cairo_format_t cairo_boilerplate_format_from_content (cairo_content_t content) { @@ -138,10 +125,10 @@ cairo_boilerplate_format_from_content (cairo_content_t content) static cairo_surface_t * _cairo_boilerplate_image_create_surface (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure) @@ -159,47 +146,75 @@ _cairo_boilerplate_image_create_surface (const char *name, return NULL; } - return cairo_image_surface_create (format, width, height); + return cairo_image_surface_create (format, ceil (width), ceil (height)); } +#if CAIRO_HAS_META_SURFACE +static cairo_surface_t * +_cairo_boilerplate_meta_create_surface (const char *name, + cairo_content_t content, + double width, + double height, + double max_width, + double max_height, + cairo_boilerplate_mode_t mode, + int id, + void **closure) +{ + cairo_rectangle_t extents; + + *closure = NULL; + + extents.x = 0; + extents.y = 0; + extents.width = width; + extents.height = height; + return cairo_meta_surface_create (content, &extents); +} +#endif + +const cairo_user_data_key_t cairo_boilerplate_output_basename_key; + cairo_surface_t * _cairo_boilerplate_get_image_surface (cairo_surface_t *src, int page, int width, int height) { - cairo_surface_t *surface; + cairo_surface_t *surface, *image; cairo_t *cr; + cairo_status_t status; if (cairo_surface_status (src)) return cairo_surface_reference (src); -#if 0 - if (cairo_surface_get_type (src) == CAIRO_SURFACE_TYPE_IMAGE) { - int ww = cairo_image_surface_get_width (src); - int hh = cairo_image_surface_get_height (src); - if (width == ww && hh == height) { - return cairo_surface_reference (src); - } else { - cairo_format_t format = cairo_image_surface_get_format (src); - unsigned char *data = cairo_image_surface_get_data (src); - int stride = cairo_image_surface_get_stride (src); - - data += stride * (hh - height) + 4 * (ww - width); - return cairo_image_surface_create_for_data (data, - format, - width, - height, - stride); - } - } -#endif - if (page != 0) return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH); /* extract sub-surface */ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); + image = cairo_surface_reference (surface); + + /* open a logging channel (only interesting for meta surfaces) */ +#if CAIRO_HAS_SCRIPT_SURFACE && CAIRO_HAS_META_SURFACE + if (cairo_surface_get_type (src) == CAIRO_SURFACE_TYPE_META) { + const char *test_name; + + test_name = cairo_surface_get_user_data (src, + &cairo_boilerplate_output_basename_key); + if (test_name != NULL) { + cairo_script_context_t *ctx; + char *filename; + + xasprintf (&filename, "%s.out.trace", test_name); + ctx = cairo_script_context_create (filename); + surface = cairo_script_surface_create_for_target (ctx, image); + cairo_script_context_destroy (ctx); + free (filename); + } + } +#endif + cr = cairo_create (surface); cairo_surface_destroy (surface); @@ -207,10 +222,14 @@ _cairo_boilerplate_get_image_surface (cairo_surface_t *src, cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); cairo_paint (cr); - surface = cairo_surface_reference (cairo_get_target (cr)); + status = cairo_status (cr); + if (status) { + cairo_surface_destroy (image); + image = cairo_surface_reference (cairo_get_target (cr)); + } cairo_destroy (cr); - return surface; + return image; } cairo_surface_t * @@ -222,6 +241,8 @@ cairo_boilerplate_get_image_surface_from_png (const char *filename, cairo_surface_t *surface; surface = cairo_image_surface_create_from_png (filename); + if (cairo_surface_status (surface)) + return surface; if (flatten) { cairo_t *cr; @@ -270,487 +291,140 @@ cairo_boilerplate_get_image_surface_from_png (const char *filename, return surface; } -static cairo_boilerplate_target_t targets[] = -{ +static const cairo_boilerplate_target_t builtin_targets[] = { /* I'm uncompromising about leaving the image backend as 0 * for tolerance. There shouldn't ever be anything that is out of * our control here. */ { - "image", "image", NULL, + "image", "image", NULL, NULL, CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_image_create_surface, NULL, - NULL, + NULL, _cairo_boilerplate_image_create_surface, + NULL, NULL, _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png }, { - "image", "image", NULL, + "image", "image", NULL, NULL, CAIRO_SURFACE_TYPE_IMAGE, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_image_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png - }, -#ifdef CAIRO_HAS_TEST_SURFACES - { - "test-fallback", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, - CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_test_fallback_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png - }, - { - "test-fallback", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, - CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_test_fallback_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png - }, - { - "test-fallback16", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, - CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_test_fallback16_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png - }, - { - "test-fallback16", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, - CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_test_fallback16_create_surface, NULL, - NULL, + NULL, _cairo_boilerplate_image_create_surface, + NULL, NULL, _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png }, +#if CAIRO_HAS_META_SURFACE { - "test-meta", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_META, - CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_test_meta_create_surface, NULL, - NULL, + "meta", "image", NULL, NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR_ALPHA, 0, + "cairo_meta_surface_create", + _cairo_boilerplate_meta_create_surface, + NULL, NULL, _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png, NULL, NULL, FALSE, TRUE }, { - "test-meta", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_META, - CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_test_meta_create_surface, NULL, - NULL, + "meta", "image", NULL, NULL, + CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, + "cairo_meta_surface_create", + _cairo_boilerplate_meta_create_surface, + NULL, NULL, _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png, NULL, NULL, FALSE, TRUE }, - { - "test-paginated", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED, - CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_test_paginated_create_surface, NULL, - NULL, - _cairo_boilerplate_test_paginated_get_image_surface, - _cairo_boilerplate_test_paginated_surface_write_to_png, - _cairo_boilerplate_test_paginated_cleanup, - NULL, - FALSE, TRUE, - }, - { - "test-paginated", "image", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED, - CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_test_paginated_create_surface, NULL, - NULL, - _cairo_boilerplate_test_paginated_get_image_surface, - _cairo_boilerplate_test_paginated_surface_write_to_png, - _cairo_boilerplate_test_paginated_cleanup, - NULL, - FALSE, TRUE - }, -#endif -#ifdef CAIRO_HAS_GLITZ_SURFACE -#if CAIRO_CAN_TEST_GLITZ_GLX_SURFACE - { - "glitz-glx", "glitz", NULL, - CAIRO_SURFACE_TYPE_GLITZ,CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_glitz_glx_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_glitz_glx_cleanup - }, - { - "glitz-glx", "glitz", NULL, - CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_glitz_glx_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_glitz_glx_cleanup - }, -#endif -#if CAIRO_CAN_TEST_GLITZ_AGL_SURFACE - { - "glitz-agl", "glitz", NULL, - CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_glitz_agl_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_glitz_agl_cleanup - }, - { - "glitz-agl", "glitz", NULL, - CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_glitz_agl_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_glitz_agl_cleanup - }, -#endif -#if CAIRO_CAN_TEST_GLITZ_WGL_SURFACE - { - "glitz-wgl", "glitz", NULL, - CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_glitz_wgl_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_glitz_wgl_cleanup - }, - { - "glitz-wgl", "glitz", NULL, - CAIRO_SURFACE_TYPE_GLITZ, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_glitz_wgl_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_glitz_wgl_cleanup - }, -#endif -#endif /* CAIRO_HAS_GLITZ_SURFACE */ -#if CAIRO_HAS_QUARTZ_SURFACE - { - "quartz", "quartz", NULL, - CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_quartz_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_quartz_cleanup - }, - { - "quartz", "quartz", NULL, - CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_quartz_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_quartz_cleanup - }, -#endif -#if CAIRO_HAS_WIN32_SURFACE - { - "win32", "win32", NULL, - CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_win32_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png - }, - /* Testing the win32 surface isn't interesting, since for - * ARGB images it just chains to the image backend - */ - { - "win32", "win32", NULL, - CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_win32_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png - }, -#if CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE - { - "win32-printing", "win32", ".ps", - CAIRO_SURFACE_TYPE_WIN32_PRINTING, - CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, - _cairo_boilerplate_win32_printing_create_surface, NULL, - NULL, - _cairo_boilerplate_win32_printing_get_image_surface, - _cairo_boilerplate_win32_printing_surface_write_to_png, - _cairo_boilerplate_win32_printing_cleanup, - NULL, TRUE, TRUE - }, - { - "win32-printing", "win32", ".ps", - CAIRO_INTERNAL_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_win32_printing_create_surface, NULL, - NULL, - _cairo_boilerplate_win32_printing_get_image_surface, - _cairo_boilerplate_win32_printing_surface_write_to_png, - _cairo_boilerplate_win32_printing_cleanup, - NULL, TRUE, TRUE - }, -#endif -#endif -#if CAIRO_HAS_XCB_SURFACE - /* Acceleration architectures may make the results differ by a - * bit, so we set the error tolerance to 1. */ - { - "xcb", "xcb", NULL, - CAIRO_SURFACE_TYPE_XCB, CAIRO_CONTENT_COLOR_ALPHA, 1, - _cairo_boilerplate_xcb_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_xcb_cleanup, - _cairo_boilerplate_xcb_synchronize - }, -#endif -#if CAIRO_HAS_XLIB_XRENDER_SURFACE - /* Acceleration architectures may make the results differ by a - * bit, so we set the error tolerance to 1. */ - { - "xlib", "xlib", NULL, - CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR_ALPHA, 1, - _cairo_boilerplate_xlib_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_xlib_cleanup, - _cairo_boilerplate_xlib_synchronize - }, - { - "xlib", "xlib", NULL, CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1, - _cairo_boilerplate_xlib_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_xlib_cleanup, - _cairo_boilerplate_xlib_synchronize - }, -#endif -#if CAIRO_HAS_XLIB_SURFACE - /* This is a fallback surface which uses xlib fallbacks instead of - * the Render extension. */ - { - "xlib-fallback", "image", NULL, - CAIRO_SURFACE_TYPE_XLIB, CAIRO_CONTENT_COLOR, 1, - _cairo_boilerplate_xlib_fallback_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_xlib_cleanup, - _cairo_boilerplate_xlib_synchronize - }, -#endif -#if CAIRO_HAS_PS_SURFACE && CAIRO_CAN_TEST_PS_SURFACE - { - "ps2", "ps", ".ps", - CAIRO_SURFACE_TYPE_PS, - CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, - _cairo_boilerplate_ps2_create_surface, - _cairo_boilerplate_ps_force_fallbacks, - _cairo_boilerplate_ps_finish_surface, - _cairo_boilerplate_ps_get_image_surface, - _cairo_boilerplate_ps_surface_write_to_png, - _cairo_boilerplate_ps_cleanup, - NULL, TRUE, TRUE - }, - { - "ps2", "ps", ".ps", - CAIRO_INTERNAL_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_ps2_create_surface, - _cairo_boilerplate_ps_force_fallbacks, - _cairo_boilerplate_ps_finish_surface, - _cairo_boilerplate_ps_get_image_surface, - _cairo_boilerplate_ps_surface_write_to_png, - _cairo_boilerplate_ps_cleanup, - NULL, TRUE, TRUE - }, - { - "ps3", "ps", ".ps", - CAIRO_SURFACE_TYPE_PS, - CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, - _cairo_boilerplate_ps3_create_surface, - _cairo_boilerplate_ps_force_fallbacks, - _cairo_boilerplate_ps_finish_surface, - _cairo_boilerplate_ps_get_image_surface, - _cairo_boilerplate_ps_surface_write_to_png, - _cairo_boilerplate_ps_cleanup, - NULL, TRUE, TRUE - }, - { - "ps3", "ps", ".ps", - CAIRO_INTERNAL_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_ps3_create_surface, - _cairo_boilerplate_ps_force_fallbacks, - _cairo_boilerplate_ps_finish_surface, - _cairo_boilerplate_ps_get_image_surface, - _cairo_boilerplate_ps_surface_write_to_png, - _cairo_boilerplate_ps_cleanup, - NULL, TRUE, TRUE - }, -#endif -#if CAIRO_HAS_PDF_SURFACE && CAIRO_CAN_TEST_PDF_SURFACE - { - "pdf", "pdf", ".pdf", - CAIRO_SURFACE_TYPE_PDF, - CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED, 0, - _cairo_boilerplate_pdf_create_surface, - _cairo_boilerplate_pdf_force_fallbacks, - _cairo_boilerplate_pdf_finish_surface, - _cairo_boilerplate_pdf_get_image_surface, - _cairo_boilerplate_pdf_surface_write_to_png, - _cairo_boilerplate_pdf_cleanup, - NULL, TRUE, TRUE - }, - { - "pdf", "pdf", ".pdf", - CAIRO_INTERNAL_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_pdf_create_surface, - _cairo_boilerplate_pdf_force_fallbacks, - _cairo_boilerplate_pdf_finish_surface, - _cairo_boilerplate_pdf_get_image_surface, - _cairo_boilerplate_pdf_surface_write_to_png, - _cairo_boilerplate_pdf_cleanup, - NULL, TRUE, TRUE - }, -#endif -#if CAIRO_HAS_SCRIPT_SURFACE - { - "script", "script", ".cs", - CAIRO_SURFACE_TYPE_SCRIPT, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_script_create_surface, - NULL, - _cairo_boilerplate_script_finish_surface, - _cairo_boilerplate_script_get_image_surface, - _cairo_boilerplate_script_surface_write_to_png, - _cairo_boilerplate_script_cleanup, - NULL, FALSE - }, -#endif -#if CAIRO_HAS_SVG_SURFACE && CAIRO_CAN_TEST_SVG_SURFACE - /* It seems we should be able to round-trip SVG content perfectly - * through librsvg and cairo, but for some mysterious reason, some - * systems get an error of 1 for some pixels on some of the text - * tests. XXX: I'd still like to chase these down at some point. - * For now just set the svg error tolerance to 1. */ - { - "svg11", "svg", NULL, - CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA, 1, - _cairo_boilerplate_svg11_create_surface, - _cairo_boilerplate_svg_force_fallbacks, - _cairo_boilerplate_svg_finish_surface, - _cairo_boilerplate_svg_get_image_surface, - _cairo_boilerplate_svg_surface_write_to_png, - _cairo_boilerplate_svg_cleanup, - NULL, TRUE, TRUE - }, - { - "svg11", "svg", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1, - _cairo_boilerplate_svg11_create_surface, - _cairo_boilerplate_svg_force_fallbacks, - _cairo_boilerplate_svg_finish_surface, - _cairo_boilerplate_svg_get_image_surface, - _cairo_boilerplate_svg_surface_write_to_png, - _cairo_boilerplate_svg_cleanup, - NULL, TRUE, TRUE - }, - { - "svg12", "svg", NULL, - CAIRO_SURFACE_TYPE_SVG, CAIRO_CONTENT_COLOR_ALPHA, 1, - _cairo_boilerplate_svg12_create_surface, - _cairo_boilerplate_svg_force_fallbacks, - _cairo_boilerplate_svg_finish_surface, - _cairo_boilerplate_svg_get_image_surface, - _cairo_boilerplate_svg_surface_write_to_png, - _cairo_boilerplate_svg_cleanup, - NULL, TRUE, TRUE - }, - { - "svg12", "svg", NULL, - CAIRO_INTERNAL_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR, 1, - _cairo_boilerplate_svg12_create_surface, - _cairo_boilerplate_svg_force_fallbacks, - _cairo_boilerplate_svg_finish_surface, - _cairo_boilerplate_svg_get_image_surface, - _cairo_boilerplate_svg_surface_write_to_png, - _cairo_boilerplate_svg_cleanup, - NULL, TRUE, TRUE - }, -#endif -#if CAIRO_HAS_BEOS_SURFACE - /* BeOS sometimes produces a slightly different image. Perhaps this - * is related to the fact that it doesn't use premultiplied alpha... - * Just ignore the small difference. */ - { - "beos", "beos", NULL, - CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR, 1, - _cairo_boilerplate_beos_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_beos_cleanup - }, - { - "beos-bitmap", "beos", NULL, - CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR, 1, - _cairo_boilerplate_beos_create_surface_for_bitmap, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_beos_cleanup_bitmap - }, - { - "beos-bitmap", "beos", NULL, - CAIRO_SURFACE_TYPE_BEOS, CAIRO_CONTENT_COLOR_ALPHA, 1, - _cairo_boilerplate_beos_create_surface_for_bitmap, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_beos_cleanup_bitmap - }, #endif +}; +CAIRO_BOILERPLATE (builtin, builtin_targets) -#if CAIRO_HAS_DIRECTFB_SURFACE - { - "directfb", "directfb", NULL, - CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR, 0, - _cairo_boilerplate_directfb_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_directfb_cleanup - }, - { - "directfb-bitmap", "directfb", NULL, - CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_CONTENT_COLOR_ALPHA, 0, - _cairo_boilerplate_directfb_create_surface, NULL, - NULL, - _cairo_boilerplate_get_image_surface, - cairo_surface_write_to_png, - _cairo_boilerplate_directfb_cleanup - }, +static struct cairo_boilerplate_target_list { + struct cairo_boilerplate_target_list *next; + const cairo_boilerplate_target_t *target; +} *cairo_boilerplate_targets; + +static cairo_bool_t +probe_target (const cairo_boilerplate_target_t *target) +{ + if (target->probe == NULL) + return TRUE; + +#if HAVE_DLSYM + return dlsym (NULL, target->probe) != NULL; +#else + return TRUE; #endif -}; +} + +void +_cairo_boilerplate_register_backend (const cairo_boilerplate_target_t *targets, + unsigned int count) +{ + targets += count; + while (count--) { + struct cairo_boilerplate_target_list *list; + + --targets; + if (! probe_target (targets)) + continue; + + list = xmalloc (sizeof (*list)); + list->next = cairo_boilerplate_targets; + list->target = targets; + cairo_boilerplate_targets = list; + } +} + +static cairo_bool_t +_cairo_boilerplate_target_matches_name (const cairo_boilerplate_target_t *target, + const char *tname, + const char *end) +{ + char const *content_name; + const char *content_start = strpbrk (tname, "."); + const char *content_end = end; + size_t name_len; + size_t content_len; + + if (content_start != NULL) + end = content_start++; + + name_len = end - tname; + + /* Check name. */ + if (! (name_len == 1 && 0 == strncmp (tname, "?", 1))) { /* wildcard? */ + if (0 != strncmp (target->name, tname, name_len)) /* exact match? */ + return FALSE; + if (isalnum (target->name[name_len])) + return FALSE; + } + + /* Check optional content. */ + if (content_start == NULL) /* none given? */ + return TRUE; -cairo_boilerplate_target_t ** + /* Exact content match? */ + content_name = _cairo_boilerplate_content_visible_name (target->content); + content_len = content_end - content_start; + if (strlen(content_name) != content_len) + return FALSE; + if (0 == strncmp (content_name, content_start, content_len)) + return TRUE; + + return FALSE; +} + +const cairo_boilerplate_target_t ** cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets) { size_t i, num_targets; cairo_bool_t limited_targets = FALSE; const char *tname; - cairo_boilerplate_target_t **targets_to_test; + const cairo_boilerplate_target_t **targets_to_test; + struct cairo_boilerplate_target_list *list; + + if (cairo_boilerplate_targets == NULL) + _cairo_boilerplate_register_all (); if ((tname = getenv ("CAIRO_TEST_TARGET")) != NULL && *tname) { /* check the list of targets specified by the user */ @@ -770,29 +444,39 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets continue; } - for (i = 0; i < sizeof (targets) / sizeof (targets[0]); i++) { - if (0 == strncmp (targets[i].name, tname, end - tname) && - !isalnum (targets[i].name[end - tname])) { + for (list = cairo_boilerplate_targets; + list != NULL; + list = list->next) + { + const cairo_boilerplate_target_t *target = list->target; + if (_cairo_boilerplate_target_matches_name (target, tname, end)) { /* realloc isn't exactly the best thing here, but meh. */ targets_to_test = xrealloc (targets_to_test, sizeof(cairo_boilerplate_target_t *) * (num_targets+1)); - targets_to_test[num_targets++] = &targets[i]; + targets_to_test[num_targets++] = target; found = 1; } } if (!found) { + const char *last_name = NULL; + fprintf (stderr, "Cannot find target '%.*s'.\n", (int)(end - tname), tname); fprintf (stderr, "Known targets:"); - for (i = 0; i < sizeof (targets) / sizeof (targets[0]); i++) { - if (i != 0) { - if (strcmp (targets[i].name, targets[i-1].name) == 0) { + for (list = cairo_boilerplate_targets; + list != NULL; + list = list->next) + { + const cairo_boilerplate_target_t *target = list->target; + if (last_name != NULL) { + if (strcmp (target->name, last_name) == 0) { /* filter out repeats that differ in content */ continue; } fprintf (stderr, ","); } - fprintf (stderr, " %s", targets[i].name); + fprintf (stderr, " %s", target->name); + last_name = target->name; } fprintf (stderr, "\n"); exit(-1); @@ -804,10 +488,18 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets } } else { /* check all compiled in targets */ - num_targets = sizeof (targets) / sizeof (targets[0]); + num_targets = 0; + for (list = cairo_boilerplate_targets; list != NULL; list = list->next) + num_targets++; + targets_to_test = xmalloc (sizeof(cairo_boilerplate_target_t*) * num_targets); - for (i = 0; i < num_targets; i++) { - targets_to_test[i] = &targets[i]; + num_targets = 0; + for (list = cairo_boilerplate_targets; + list != NULL; + list = list->next) + { + const cairo_boilerplate_target_t *target = list->target; + targets_to_test[num_targets++] = target; } } @@ -827,8 +519,9 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets } for (i = j = 0; i < num_targets; i++) { - if (strncmp (targets_to_test[i]->name, tname, end - tname) || - isalnum (targets_to_test[i]->name[end - tname])) + const cairo_boilerplate_target_t *target = targets_to_test[i]; + if (! _cairo_boilerplate_target_matches_name (target, + tname, end)) { targets_to_test[j++] = targets_to_test[i]; } @@ -850,8 +543,57 @@ cairo_boilerplate_get_targets (int *pnum_targets, cairo_bool_t *plimited_targets return targets_to_test; } +const cairo_boilerplate_target_t * +cairo_boilerplate_get_image_target (cairo_content_t content) +{ + struct cairo_boilerplate_target_list *list; + + if (cairo_boilerplate_targets == NULL) + _cairo_boilerplate_register_all (); + + for (list = cairo_boilerplate_targets; list != NULL; list = list->next) { + const cairo_boilerplate_target_t *target = list->target; + if (target->expected_type == CAIRO_SURFACE_TYPE_IMAGE && + target->content == content) + { + return target; + } + } + + return NULL; +} + +const cairo_boilerplate_target_t * +cairo_boilerplate_get_target_by_name (const char *name, + cairo_content_t content) +{ + struct cairo_boilerplate_target_list *list; + + if (cairo_boilerplate_targets == NULL) + _cairo_boilerplate_register_all (); + + /* first return an exact match */ + for (list = cairo_boilerplate_targets; list != NULL; list = list->next) { + const cairo_boilerplate_target_t *target = list->target; + if (strcmp (target->name, name) == 0 && + target->content == content) + { + return target; + } + } + + /* otherwise just return a match that may differ in content */ + for (list = cairo_boilerplate_targets; list != NULL; list = list->next) { + const cairo_boilerplate_target_t *target = list->target; + if (strcmp (target->name, name) == 0) + return target; + } + + return NULL; +} + void -cairo_boilerplate_free_targets (cairo_boilerplate_target_t **targets) +cairo_boilerplate_free_targets (const cairo_boilerplate_target_t **targets) { free (targets); } @@ -1013,19 +755,20 @@ cairo_boilerplate_image_surface_create_from_ppm_stream (FILE *file) data = cairo_image_surface_get_data (image); stride = cairo_image_surface_get_stride (image); for (y = 0; y < height; y++) { - unsigned char *buf = data + y *stride; + unsigned char *buf = data + y*stride; switch (format) { case '7': if (! freadn (buf, 4 * width, file)) goto FAIL; break; case '6': - for (x = 0; x < width; x++) { - if (! freadn (buf, 3, file)) - goto FAIL; - *(uint32_t *) buf = + if (! freadn (buf, 3*width, file)) + goto FAIL; + buf += 3*width; + for (x = width; x--; ) { + buf -= 3; + ((uint32_t *) (data + y*stride))[x] = (buf[0] << 16) | (buf[1] << 8) | (buf[2] << 0); - buf += 4; } break; case '5': @@ -1063,8 +806,13 @@ cairo_boilerplate_convert_to_image (const char *filename, int page) image = cairo_boilerplate_image_surface_create_from_ppm_stream (file); ret = pclose (file); + /* check for fatal errors from the interpreter */ + if (ret) { /* any2pmm should never die... */ + cairo_surface_destroy (image); + return cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_INVALID_STATUS); + } - if (cairo_surface_status (image) == CAIRO_STATUS_READ_ERROR) { + if (ret == 0 && cairo_surface_status (image) == CAIRO_STATUS_READ_ERROR) { if (flags == 0) { /* Try again in a standalone process. */ cairo_surface_destroy (image); @@ -1073,12 +821,6 @@ cairo_boilerplate_convert_to_image (const char *filename, int page) } } - if (cairo_surface_status (image) == CAIRO_STATUS_SUCCESS && ret != 0) { - cairo_surface_destroy (image); - image = - cairo_boilerplate_surface_create_in_error (CAIRO_STATUS_READ_ERROR); - }; - return image; } diff --git a/boilerplate/cairo-boilerplate.h b/boilerplate/cairo-boilerplate.h index d3b86d1..82d42e8 100644 --- a/boilerplate/cairo-boilerplate.h +++ b/boilerplate/cairo-boilerplate.h @@ -93,11 +93,14 @@ #define M_PI 3.14159265358979323846 #endif +CAIRO_BEGIN_DECLS /* A fake format we use for the flattened ARGB output of the PS and * PDF surfaces. */ #define CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED ((unsigned int) -1) +extern const cairo_user_data_key_t cairo_boilerplate_output_basename_key; + cairo_content_t cairo_boilerplate_content (cairo_content_t content); @@ -115,10 +118,10 @@ typedef enum { typedef cairo_surface_t * (*cairo_boilerplate_create_surface_t) (const char *name, cairo_content_t content, - int width, - int height, - int max_width, - int max_height, + double width, + double height, + double max_width, + double max_height, cairo_boilerplate_mode_t mode, int id, void **closure); @@ -146,14 +149,15 @@ typedef void typedef void (*cairo_boilerplate_wait_t) (void *closure); -typedef struct _cairo_boilerplate_target -{ +typedef struct _cairo_boilerplate_target { const char *name; const char *basename; const char *file_extension; + const char *reference_target; cairo_surface_type_t expected_type; cairo_content_t content; unsigned int error_tolerance; + const char *probe; /* runtime dl check */ cairo_boilerplate_create_surface_t create_surface; cairo_boilerplate_force_fallbacks_t force_fallbacks; cairo_boilerplate_finish_surface_t finish_surface; @@ -165,11 +169,18 @@ typedef struct _cairo_boilerplate_target cairo_bool_t is_meta; } cairo_boilerplate_target_t; -cairo_boilerplate_target_t ** +const cairo_boilerplate_target_t * +cairo_boilerplate_get_image_target (cairo_content_t content); + +const cairo_boilerplate_target_t * +cairo_boilerplate_get_target_by_name (const char *name, + cairo_content_t content); + +const cairo_boilerplate_target_t ** cairo_boilerplate_get_targets (int *num_targets, cairo_bool_t *limited_targets); void -cairo_boilerplate_free_targets (cairo_boilerplate_target_t **targets); +cairo_boilerplate_free_targets (const cairo_boilerplate_target_t **targets); cairo_surface_t * _cairo_boilerplate_get_image_surface (cairo_surface_t *src, @@ -207,4 +218,6 @@ cairo_boilerplate_version_string (void); #include "cairo-boilerplate-system.h" +CAIRO_END_DECLS + #endif diff --git a/boilerplate/make-cairo-boilerplate-constructors.sh b/boilerplate/make-cairo-boilerplate-constructors.sh new file mode 100644 index 0000000..09716ca --- /dev/null +++ b/boilerplate/make-cairo-boilerplate-constructors.sh @@ -0,0 +1,29 @@ +#! /bin/sh + +if test $# -eq 0; then + echo "$0: no input files." >&2 + exit 0 +fi + +cat <<HERE +/* WARNING: Autogenerated file - see $0! */ + +#include "cairo-boilerplate-private.h" + +void _cairo_boilerplate_register_all (void); + +HERE + +cat "$@" | sed '/^CAIRO_BOILERPLATE/!d; s/CAIRO_BOILERPLATE.*(\(.*\),.*/extern void _register_\1 (void);/' + +cat <<HERE + +void +_cairo_boilerplate_register_all (void) +{ +HERE + +cat "$@" | sed '/^CAIRO_BOILERPLATE/!d; s/CAIRO_BOILERPLATE.*(\(.*\),.*/ _register_\1 ();/' + +echo "}" + |