mercury_cairo: Fix build in absence of ps/svg support.

extras/graphics/mercury_cairo/cairo.ps.m:
extras/graphics/mercury_cairo/cairo.svg.m:
	Let these modules build when support for their respective
	surfaces is disabled in the cairo installation.
This commit is contained in:
Peter Wang
2015-09-04 11:24:39 +10:00
parent 44eacd93fa
commit 82f8be162f
2 changed files with 29 additions and 6 deletions

View File

@@ -96,6 +96,12 @@
#if defined(CAIRO_HAS_PS_SURFACE)
#include <cairo-ps.h>
#else
/* These are unlikely to change. */
enum {
CAIRO_PS_LEVEL_2,
CAIRO_PS_LEVEL_3
};
#endif
").
@@ -117,7 +123,7 @@
[promise_pure, will_not_call_mercury],
"
#if defined(CAIRO_HAS_PS_SURFACE)
SUCCESS_INDICATOR = MR_TRUE;
SUCCESS_INDICATOR = MR_TRUE;
#else
SUCCESS_INDICATOR = MR_FALSE;
#endif
@@ -203,47 +209,58 @@ create_surface(FileName, Width, Height, Surface, !IO) :-
set_eps(Surface::in, EPS::in, _IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
#if defined(CAIRO_HAS_PS_SURFACE)
cairo_ps_surface_set_eps(Surface->mcairo_raw_surface,
(EPS = MR_YES ? 1 : 0));
#endif
").
:- pragma foreign_proc("C",
get_eps(Surface::in, EPS::out, _IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
if (cairo_ps_surface_get_eps(Surface->mcairo_raw_surface)) {
EPS = MR_YES;
} else {
EPS = MR_NO;
}
#if defined(CAIRO_HAS_PS_SURFACE)
EPS = cairo_ps_surface_get_eps(Surface->mcairo_raw_surface)
? MR_YES : MR_NO;
#else
EPS = MR_NO;
#endif
").
:- pragma foreign_proc("C",
set_size(Surface::in, W::in, H::in, _IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
#if defined(CAIRO_HAS_PS_SURFACE)
cairo_ps_surface_set_size(Surface->mcairo_raw_surface, W, H);
#endif
").
:- pragma foreign_proc("C",
dsc_begin_setup(Surface::in, _IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
#if defined(CAIRO_HAS_PS_SURFACE)
cairo_ps_surface_dsc_begin_setup(Surface->mcairo_raw_surface);
#endif
").
:- pragma foreign_proc("C",
dsc_begin_page_setup(Surface::in, _IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
#if defined(CAIRO_HAS_PS_SURFACE)
cairo_ps_surface_dsc_begin_page_setup(Surface->mcairo_raw_surface);
#endif
").
:- pragma foreign_proc("C",
dsc_comment(Surface::in, Comment::in, _IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
#if defined(CAIRO_HAS_PS_SURFACE)
cairo_ps_surface_dsc_comment(Surface->mcairo_raw_surface, Comment);
#endif
").
%---------------------------------------------------------------------------%

View File

@@ -58,6 +58,12 @@
#if defined(CAIRO_HAS_SVG_SURFACE)
#include <cairo-svg.h>
#else
/* These are unlikely to change. */
enum {
CAIRO_SVG_VERSION_1_1,
CAIRO_SVG_VERSION_1_2
};
#endif
").