xr_allocate (const char *name, int device_type,
enum xr_output_type output_type, struct string_map *o)
{
- struct xr_driver *xr = xzalloc (sizeof *xr);
+ struct xr_driver *xr = XZALLOC (struct xr_driver);
struct output_driver *d = &xr->driver;
output_driver_init (d, &cairo_driver_class, name, device_type);
{
struct xr_driver *xr = xr_driver_cast (driver);
- if (item->type == OUTPUT_ITEM_PAGE_SETUP)
- {
- if (!xr->pager)
- xr_update_page_setup (driver, item->page_setup);
- return;
- }
-
if (!xr->pager)
{
xr->pager = xr_pager_create (xr->page_style, xr->fsm_style);
xr_pager_add_page (xr->pager, cairo_create (xr->drawing_surface));
}
}
+
+static void
+xr_setup (struct output_driver *driver, const struct page_setup *ps)
+{
+ struct xr_driver *xr = xr_driver_cast (driver);
+
+ if (!xr->pager)
+ xr_update_page_setup (driver, ps);
+}
\f
struct output_driver_factory pdf_driver_factory =
{ "pdf", "pspp.pdf", xr_pdf_create };
static const struct output_driver_class cairo_driver_class =
{
- "cairo",
- xr_destroy,
- xr_submit,
- NULL,
+ .name = "cairo",
+ .destroy = xr_destroy,
+ .submit = xr_submit,
+ .setup = xr_setup,
+ .handles_groups = true,
};