summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cairo-util.cpp')
-rw-r--r--src/cairo-util.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cairo-util.cpp b/src/cairo-util.cpp
new file mode 100644
index 0000000..694ff92
--- /dev/null
+++ b/src/cairo-util.cpp
@@ -0,0 +1,19 @@
+#include <config.h>
+
+#include <err.h>
+#include <assert.h>
+#include <cairo.h>
+
+#include "caskbench.h"
+
+void
+write_image_file_cairo (const char *fname, caskbench_context_t *context)
+{
+ assert (context->cairo_surface);
+ cairo_status_t status = cairo_surface_status (context->cairo_surface);
+ if (status != CAIRO_STATUS_SUCCESS) {
+ warnx("Error writing cairo surface to file: %s\n", cairo_status_to_string(status));
+ return;
+ }
+ cairo_surface_write_to_png (context->cairo_surface, fname);
+}