From ca8538db3a3ad3acc178d2fa025d1a7290d784a3 Mon Sep 17 00:00:00 2001 From: Nicola Fontana Date: Sun, 8 Feb 2015 21:07:36 +0100 Subject: [PATCH] adg: allow building without GTK+ For some weird reason, compiling without GTK+ enabled generated a bogus error while building adg-canvas.c. It came out the culprit was the include of cairo-ps.h. Moving it outside the function solved the problem Closes issue #160: http://dev.entidi.com/p/adg/issues/160/ --- src/adg/adg-canvas.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/adg/adg-canvas.c b/src/adg/adg-canvas.c index 97b832e0..bb02815d 100644 --- a/src/adg/adg-canvas.c +++ b/src/adg/adg-canvas.c @@ -100,6 +100,16 @@ #include #include "adg-canvas-private.h" +#ifdef CAIRO_HAS_PS_SURFACE +#include +#endif +#ifdef CAIRO_HAS_PDF_SURFACE +#include +#endif +#ifdef CAIRO_HAS_SVG_SURFACE +#include +#endif + #define _ADG_OLD_OBJECT_CLASS ((GObjectClass *) adg_canvas_parent_class) #define _ADG_OLD_ENTITY_CLASS ((AdgEntityClass *) adg_canvas_parent_class) @@ -1491,35 +1501,26 @@ adg_canvas_export(AdgCanvas *canvas, cairo_surface_type_t type, surface = NULL; switch (type) { - case CAIRO_SURFACE_TYPE_IMAGE: #ifdef CAIRO_HAS_PNG_FUNCTIONS + case CAIRO_SURFACE_TYPE_IMAGE: surface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, width, height); -#endif break; - case CAIRO_SURFACE_TYPE_PDF: -#ifdef CAIRO_HAS_PDF_SURFACE - { - #include - surface = cairo_pdf_surface_create(file, width, height); - } #endif +#ifdef CAIRO_HAS_PDF_SURFACE + case CAIRO_SURFACE_TYPE_PDF: + surface = cairo_pdf_surface_create(file, width, height); break; - case CAIRO_SURFACE_TYPE_PS: -#ifdef CAIRO_HAS_PS_SURFACE - { - #include - surface = cairo_ps_surface_create(file, width, height); - } #endif +#ifdef CAIRO_HAS_PS_SURFACE + case CAIRO_SURFACE_TYPE_PS: + surface = cairo_ps_surface_create(file, width, height); break; - case CAIRO_SURFACE_TYPE_SVG: -#ifdef CAIRO_HAS_SVG_SURFACE - { - #include - surface = cairo_svg_surface_create(file, width, height); - } #endif +#ifdef CAIRO_HAS_SVG_SURFACE + case CAIRO_SURFACE_TYPE_SVG: + surface = cairo_svg_surface_create(file, width, height); break; +#endif default: break; } -- 2.11.4.GIT