summaryrefslogtreecommitdiff
path: root/boilerplate/cairo-boilerplate-ps.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-07-04 21:43:27 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-07-04 21:43:27 +0100
commit88cb69b10c66751f687c3745c8e9861b105de3a2 (patch)
tree3887fc1f4f4cf61b9111b62f6e85af0b72534782 /boilerplate/cairo-boilerplate-ps.c
parent8a10ab1c04298d6c22ae8aabec5d762141a8e98f (diff)
downloadcairo-88cb69b10c66751f687c3745c8e9861b105de3a2.tar.gz
[boilerpate] Move target definition to backends.
By moving the backend target definition out of the massive amlagamated block in cairo-boilerplate.c and into each of the cairo-boilerplate-backend.c, we make it much easier to add new targets as the information need only be entered in a single file and not scattered across three. However, updating the target interface means trawling across all the files -- except given that I found it difficult maintaining the single massive array I do not see this as an increase in the maintenance burden.
Diffstat (limited to 'boilerplate/cairo-boilerplate-ps.c')
-rw-r--r--boilerplate/cairo-boilerplate-ps.c73
1 files changed, 59 insertions, 14 deletions
diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c
index 2fb03e893..0fdd0cfab 100644
--- a/boilerplate/cairo-boilerplate-ps.c
+++ b/boilerplate/cairo-boilerplate-ps.c
@@ -24,18 +24,13 @@
* 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>
-#endif
-
static const cairo_user_data_key_t ps_closure_key;
typedef struct _ps_target_closure {
@@ -127,7 +122,7 @@ _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,
double width,
@@ -146,7 +141,7 @@ _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,
double width,
@@ -165,7 +160,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,
@@ -209,7 +204,7 @@ _cairo_boilerplate_ps_finish_surface (cairo_surface_t *surface)
return CAIRO_STATUS_SUCCESS;
}
-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,53 @@ _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[] = {
+ {
+ "ps2", "ps", ".ps", NULL,
+ 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", NULL,
+ CAIRO_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", NULL,
+ 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", NULL,
+ CAIRO_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
+ },
+};
+CAIRO_BOILERPLATE (ps, targets)