summaryrefslogtreecommitdiff
path: root/boilerplate/cairo-boilerplate-xcb.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-xcb.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-xcb.c')
-rw-r--r--boilerplate/cairo-boilerplate-xcb.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/boilerplate/cairo-boilerplate-xcb.c b/boilerplate/cairo-boilerplate-xcb.c
index 23e1b5ad9..63c20e8a0 100644
--- a/boilerplate/cairo-boilerplate-xcb.c
+++ b/boilerplate/cairo-boilerplate-xcb.c
@@ -24,20 +24,18 @@
* Author: Carl D. Worth <cworth@cworth.org>
*/
-#include "cairo-boilerplate.h"
-#include "cairo-boilerplate-xcb-private.h"
+#include "cairo-boilerplate-private.h"
#include <cairo-xcb-xrender.h>
#include <xcb/xcb_renderutil.h>
-typedef struct _xcb_target_closure
-{
+typedef struct _xcb_target_closure {
xcb_connection_t *c;
xcb_pixmap_t pixmap;
} xcb_target_closure_t;
-void
+static void
_cairo_boilerplate_xcb_synchronize (void *closure)
{
xcb_target_closure_t *xtc = closure;
@@ -47,7 +45,7 @@ _cairo_boilerplate_xcb_synchronize (void *closure)
0));
}
-cairo_surface_t *
+static cairo_surface_t *
_cairo_boilerplate_xcb_create_surface (const char *name,
cairo_content_t content,
double width,
@@ -105,7 +103,7 @@ _cairo_boilerplate_xcb_create_surface (const char *name,
width, height);
}
-void
+static void
_cairo_boilerplate_xcb_cleanup (void *closure)
{
xcb_target_closure_t *xtc = closure;
@@ -114,3 +112,19 @@ _cairo_boilerplate_xcb_cleanup (void *closure)
xcb_disconnect (xtc->c);
free (xtc);
}
+
+static const cairo_boilerplate_target_t targets[] = {
+ /* Acceleration architectures may make the results differ by a
+ * bit, so we set the error tolerance to 1. */
+ {
+ "xcb", "xcb", NULL, NULL,
+ CAIRO_SURFACE_TYPE_XCB, CAIRO_CONTENT_COLOR_ALPHA, 1,
+ _cairo_boilerplate_xcb_create_surface,
+ NULL, NULL,
+ _cairo_boilerplate_get_image_surface,
+ cairo_surface_write_to_png,
+ _cairo_boilerplate_xcb_cleanup,
+ _cairo_boilerplate_xcb_synchronize
+ },
+};
+CAIRO_BOILERPLATE (xcb, targets)