diff options
| author | Bryce Harrington <b.harrington@samsung.com> | 2014-05-05 16:19:54 -0700 |
|---|---|---|
| committer | Bryce Harrington <b.harrington@samsung.com> | 2014-05-05 16:19:54 -0700 |
| commit | 398770f6d07eb5916e12545b8d223b34fa69fd6e (patch) | |
| tree | 4b311c89b0f8aeb72b1082107ea73c72dc9f4502 /src/cairo-util.cpp | |
| parent | 4b40cca3f563d90db02949f38a6b4c3e313b686f (diff) | |
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.
Diffstat (limited to 'src/cairo-util.cpp')
| -rw-r--r-- | src/cairo-util.cpp | 19 |
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); +} |