mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 14:08:29 +02:00
[boilerplate] Fix compilation against old revisions (as old as 1.9.2!)
This commit is contained in:
parent
0466053099
commit
e577096dff
8 changed files with 50 additions and 17 deletions
|
|
@ -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)) > $@'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue