diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-04 21:43:27 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2009-07-04 21:43:27 +0100 |
commit | 88cb69b10c66751f687c3745c8e9861b105de3a2 (patch) | |
tree | 3887fc1f4f4cf61b9111b62f6e85af0b72534782 /boilerplate/cairo-boilerplate-qt.cpp | |
parent | 8a10ab1c04298d6c22ae8aabec5d762141a8e98f (diff) |
[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-qt.cpp')
-rw-r--r-- | boilerplate/cairo-boilerplate-qt.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/boilerplate/cairo-boilerplate-qt.cpp b/boilerplate/cairo-boilerplate-qt.cpp index addcb12e..5d8d3f93 100644 --- a/boilerplate/cairo-boilerplate-qt.cpp +++ b/boilerplate/cairo-boilerplate-qt.cpp @@ -31,7 +31,6 @@ */ #include "cairo-boilerplate.h" -#include "cairo-boilerplate-qt-private.h" #include <cairo-qt.h> @@ -43,7 +42,7 @@ typedef struct _qt_closure { QApplication *app; } qt_closure_t; -void +static void _cairo_boilerplate_qt_cleanup (void *closure) { qt_closure_t *qtc = (qt_closure_t *) closure; @@ -53,7 +52,7 @@ _cairo_boilerplate_qt_cleanup (void *closure) free (qtc); } -cairo_surface_t * +static cairo_surface_t * _cairo_boilerplate_qt_create_surface (const char *name, cairo_content_t content, double width, @@ -81,10 +80,32 @@ _cairo_boilerplate_qt_create_surface (const char *name, return cairo_qt_surface_create_with_qpixmap (content, width, height); } -void +static void _cairo_boilerplate_qt_synchronize (void *closure) { qt_closure_t *qtc = (qt_closure_t *) closure; qtc->app->flush (); /* not sure if this is sufficient */ } + +static const cairo_boilerplate_target_t targets[] = { + { + "qt", "qt", NULL, NULL, + CAIRO_SURFACE_TYPE_QT, CAIRO_CONTENT_COLOR_ALPHA, 0, + _cairo_boilerplate_qt_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_qt_cleanup + }, + { + "qt", "qt", NULL, NULL, + CAIRO_SURFACE_TYPE_QT, CAIRO_CONTENT_COLOR, 0, + _cairo_boilerplate_qt_create_surface, + NULL, NULL, + _cairo_boilerplate_get_image_surface, + cairo_surface_write_to_png, + _cairo_boilerplate_qt_cleanup + }, +}; +CAIRO_BOILERPLATE (qt, targets) |