diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-20 23:17:07 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-24 10:57:26 +0100 |
commit | e577096dff714266101ba86ac275864b854096a4 (patch) | |
tree | f7fbae2b30693c70f1d8b21f5d47707987d16032 | |
parent | 0466053099b7f27065267d49c84e9e24bff6c7a1 (diff) |
[boilerplate] Fix compilation against old revisions (as old as 1.9.2!)
-rw-r--r-- | boilerplate/Makefile.am | 7 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-pdf.c | 4 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-ps.c | 4 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-svg.c | 4 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate-test-surfaces.c | 31 | ||||
-rw-r--r-- | boilerplate/cairo-boilerplate.c | 10 | ||||
-rw-r--r-- | src/cairo-types-private.h | 5 | ||||
-rw-r--r-- | util/cairo-script/cairo-script-operators.c | 2 |
8 files changed, 50 insertions, 17 deletions
diff --git a/boilerplate/Makefile.am b/boilerplate/Makefile.am index 3d8339fb..c8b5d41b 100644 --- a/boilerplate/Makefile.am +++ b/boilerplate/Makefile.am @@ -48,8 +48,13 @@ endif libcairoboilerplate_la_LIBADD += $(CAIROBOILERPLATE_LIBS) +# we need to workaround the introduction of CC_FOR_BUILD with older builds make-cairo-boilerplate-constructors$(EXEEXT): make-cairo-boilerplate-constructors.c - $(CC_FOR_BUILD) $^ -o $@ + if test -n "$(CC_FOR_BUILD)"; then \ + $(CC_FOR_BUILD) $^ -o $@; \ + else \ + $(CC) $^ -o $@; \ + fi cairo-boilerplate-constructors.c: Makefile $(enabled_cairo_boilerplate_sources) make-cairo-boilerplate-constructors$(EXEEXT) echo '(cd $(srcdir) && $(top_builddir)/boilerplate/make-cairo-boilerplate-constructors$(EXEEXT) $(enabled_cairo_boilerplate_sources)) > $@' diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c index e941d46f..838038af 100644 --- a/boilerplate/cairo-boilerplate-pdf.c +++ b/boilerplate/cairo-boilerplate-pdf.c @@ -30,6 +30,10 @@ #include <cairo-pdf-surface-private.h> #include <cairo-paginated-surface-private.h> +#if ! CAIRO_HAS_META_SURFACE +#define CAIRO_SURFACE_TYPE_META CAIRO_INTERNAL_SURFACE_TYPE_META +#endif + static const cairo_user_data_key_t pdf_closure_key; typedef struct _pdf_target_closure diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c index 40148dde..8619e47f 100644 --- a/boilerplate/cairo-boilerplate-ps.c +++ b/boilerplate/cairo-boilerplate-ps.c @@ -31,6 +31,10 @@ #include <cairo-ps-surface-private.h> #include <cairo-paginated-surface-private.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; typedef struct _ps_target_closure { diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c index 45e085ce..56296f46 100644 --- a/boilerplate/cairo-boilerplate-svg.c +++ b/boilerplate/cairo-boilerplate-svg.c @@ -35,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 { diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c index 501866ba..3e7490ec 100644 --- a/boilerplate/cairo-boilerplate-test-surfaces.c +++ b/boilerplate/cairo-boilerplate-test-surfaces.c @@ -28,16 +28,20 @@ #include "cairo-boilerplate-private.h" +#include <cairo-types-private.h> + #include <test-fallback-surface.h> #include <test-fallback16-surface.h> +#if CAIRO_HAS_TEST_PAGINATED_SURFACE #include <test-paginated-surface.h> -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,3) +#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 -#include <cairo-types-private.h> - static cairo_surface_t * _cairo_boilerplate_test_fallback_create_surface (const char *name, cairo_content_t content, @@ -70,6 +74,7 @@ _cairo_boilerplate_test_fallback16_create_surface (const char *name, ceil (width), ceil (height)); } +#if CAIRO_HAS_TEST_NULL_SURFACE static cairo_surface_t * _cairo_boilerplate_test_null_create_surface (const char *name, cairo_content_t content, @@ -82,13 +87,11 @@ _cairo_boilerplate_test_null_create_surface (const char *name, void **closure) { *closure = NULL; -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,3) return _cairo_test_null_surface_create (content); -#else - return NULL; -#endif } +#endif +#if CAIRO_HAS_TEST_PAGINATED_SURFACE static const cairo_user_data_key_t test_paginated_closure_key; typedef struct { @@ -196,7 +199,9 @@ _cairo_boilerplate_test_paginated_cleanup (void *closure) 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, @@ -208,7 +213,6 @@ _cairo_boilerplate_test_wrapping_create_surface (const char *name, int id, void **closure) { -#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,3) cairo_surface_t *target; cairo_surface_t *surface; cairo_format_t format; @@ -221,11 +225,8 @@ _cairo_boilerplate_test_wrapping_create_surface (const char *name, cairo_surface_destroy (target); return surface; -#else - *closure = NULL; - return NULL; -#endif } +#endif static const cairo_boilerplate_target_t targets[] = { { @@ -264,6 +265,7 @@ static const cairo_boilerplate_target_t targets[] = { 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, @@ -288,6 +290,8 @@ static const cairo_boilerplate_target_t targets[] = { NULL, FALSE, TRUE }, +#endif +#if CAIRO_HAS_TEST_WRAPPING_SURFACE { "test-wrapping", "image", NULL, NULL, CAIRO_INTERNAL_SURFACE_TYPE_TEST_WRAPPING, @@ -297,6 +301,8 @@ static const cairo_boilerplate_target_t targets[] = { _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, @@ -307,5 +313,6 @@ static const cairo_boilerplate_target_t targets[] = { NULL, TRUE, FALSE }, +#endif }; CAIRO_BOILERPLATE (test, targets) diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index a0810457..f15f7393 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -129,6 +129,7 @@ _cairo_boilerplate_image_create_surface (const char *name, 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, @@ -151,8 +152,6 @@ _cairo_boilerplate_meta_create_surface (const char *name, return cairo_meta_surface_create (content, &extents); } -const cairo_user_data_key_t cairo_boilerplate_output_basename_key; - #if CAIRO_HAS_SCRIPT_SURFACE static cairo_status_t stdio_write (void *closure, const unsigned char *data, unsigned int len) @@ -163,6 +162,9 @@ stdio_write (void *closure, const unsigned char *data, unsigned int len) return CAIRO_STATUS_SUCCESS; } #endif +#endif + +const cairo_user_data_key_t cairo_boilerplate_output_basename_key; cairo_surface_t * _cairo_boilerplate_get_image_surface (cairo_surface_t *src, @@ -186,7 +188,7 @@ _cairo_boilerplate_get_image_surface (cairo_surface_t *src, image = cairo_surface_reference (surface); /* open a logging channel (only interesting for meta surfaces) */ -#if CAIRO_HAS_SCRIPT_SURFACE +#if CAIRO_HAS_SCRIPT_SURFACE && CAIRO_HAS_META_SURFACE if (cairo_surface_get_type (src) == CAIRO_SURFACE_TYPE_META) { const char *test_name; @@ -307,6 +309,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = { _cairo_boilerplate_get_image_surface, cairo_surface_write_to_png }, +#if CAIRO_HAS_META_SURFACE { "meta", "image", NULL, NULL, CAIRO_SURFACE_TYPE_META, CAIRO_CONTENT_COLOR_ALPHA, 0, @@ -327,6 +330,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = { NULL, NULL, FALSE, TRUE }, +#endif }; CAIRO_BOILERPLATE (builtin, builtin_targets) diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h index a68fe500..b5536209 100644 --- a/src/cairo-types-private.h +++ b/src/cairo-types-private.h @@ -166,7 +166,6 @@ typedef enum _cairo_int_status { typedef enum _cairo_internal_surface_type { CAIRO_INTERNAL_SURFACE_TYPE_PAGINATED = 0x1000, CAIRO_INTERNAL_SURFACE_TYPE_ANALYSIS, - CAIRO_INTERNAL_SURFACE_TYPE_TEST_META, CAIRO_INTERNAL_SURFACE_TYPE_TEST_FALLBACK, CAIRO_INTERNAL_SURFACE_TYPE_TEST_PAGINATED, CAIRO_INTERNAL_SURFACE_TYPE_TEST_WRAPPING, @@ -174,6 +173,10 @@ typedef enum _cairo_internal_surface_type { CAIRO_INTERNAL_SURFACE_TYPE_TYPE3_GLYPH } cairo_internal_surface_type_t; +#define CAIRO_HAS_TEST_PAGINATED_SURFACE 1 +#define CAIRO_HAS_TEST_NULL_SURFACE 1 +#define CAIRO_HAS_TEST_WRAPPING_SURFACE 1 + typedef struct _cairo_point { cairo_fixed_t x; cairo_fixed_t y; diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c index 04028374..b7699949 100644 --- a/util/cairo-script/cairo-script-operators.c +++ b/util/cairo-script/cairo-script-operators.c @@ -5714,6 +5714,7 @@ _integer_constants[] = { { "XOR", CAIRO_OPERATOR_XOR }, { "ADD", CAIRO_OPERATOR_ADD }, { "SATURATE", CAIRO_OPERATOR_SATURATE }, +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4) { "MULTIPLY", CAIRO_OPERATOR_MULTIPLY }, { "SCREEN", CAIRO_OPERATOR_SCREEN }, { "OVERLAY", CAIRO_OPERATOR_OVERLAY }, @@ -5729,6 +5730,7 @@ _integer_constants[] = { { "HSL_SATURATION", CAIRO_OPERATOR_HSL_SATURATION }, { "HSL_COLOR", CAIRO_OPERATOR_HSL_COLOR }, { "HSL_LUMINOSITY", CAIRO_OPERATOR_HSL_LUMINOSITY }, +#endif { "WINDING", CAIRO_FILL_RULE_WINDING }, { "EVEN_ODD", CAIRO_FILL_RULE_EVEN_ODD }, |