From 398770f6d07eb5916e12545b8d223b34fa69fd6e Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Mon, 5 May 2014 16:19:54 -0700 Subject: util: Move skia and cairo image export functionality to utils modules This cleans up some of the cairo/skia-specific code in caskbench.cpp, moving it out to *-util.cpp files that can be conditionally compiled. --- src/cairo-util.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/cairo-util.cpp (limited to 'src/cairo-util.cpp') 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 + +#include +#include +#include + +#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); +} -- cgit v1.3.1-4-g156e