summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-05-28 16:19:12 +0200
committerBenjamin Otte <otte@redhat.com>2010-06-07 13:37:48 +0200
commit92d7b1eee96e6b1448aaf3c95a44238fa0eeff48 (patch)
tree99f974ed84e0927cefeb1b88331eb66eab734930
parent63e3cf3888d5b55295a04c4af28e876c04245b85 (diff)
device: Make flush vfunc return a cairo_status_t
Mirror the behavior of the surface flush vfunc: Make it return a status and if it's an error set it on the device.
-rw-r--r--src/cairo-device-private.h2
-rw-r--r--src/cairo-device.c9
-rw-r--r--src/cairo-xml-surface.c4
3 files changed, 11 insertions, 4 deletions
diff --git a/src/cairo-device-private.h b/src/cairo-device-private.h
index 0c977e8d..6eb44f3b 100644
--- a/src/cairo-device-private.h
+++ b/src/cairo-device-private.h
@@ -60,7 +60,7 @@ struct _cairo_device_backend {
void (*lock) (void *device);
void (*unlock) (void *device);
- void (*flush) (void *device);
+ cairo_warn cairo_status_t (*flush) (void *device);
void (*finish) (void *device);
void (*destroy) (void *device);
};
diff --git a/src/cairo-device.c b/src/cairo-device.c
index f8a499e3..a090f5b5 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -150,11 +150,16 @@ cairo_device_status (cairo_device_t *device)
void
cairo_device_flush (cairo_device_t *device)
{
+ cairo_status_t status;
+
if (device == NULL || device->status)
return;
- if (device->backend->flush != NULL)
- device->backend->flush (device);
+ if (device->backend->flush != NULL) {
+ status = device->backend->flush (device);
+ if (unlikely (status))
+ status = _cairo_device_set_error (device, status);
+ }
}
slim_hidden_def (cairo_device_flush);
diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c
index 1b52a7dd..55b5b8e5 100644
--- a/src/cairo-xml-surface.c
+++ b/src/cairo-xml-surface.c
@@ -215,13 +215,15 @@ _format_to_string (cairo_format_t format)
return "INVALID";
}
-static void
+static cairo_status_t
_device_flush (void *abstract_device)
{
cairo_xml_t *xml = abstract_device;
cairo_status_t status;
status = _cairo_output_stream_flush (xml->stream);
+
+ return status;
}
static void