summaryrefslogtreecommitdiffstatsci
path: root/src/cairo-util.cpp
blob: 4cd7745cd420bbec7db4a668cd91d21b19d295aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * Copyright 2014 © Samsung Research America, Silicon Valley
 *
 * Use of this source code is governed by the 3-Clause BSD license
 * specified in the COPYING file included with this source code.
 */
#include <config.h>

#include <err.h>
#include <assert.h>
#include <cairo.h>

#include "forward.h"
#include "caskbench.h"
#include "caskbench_context.h"

void
context_clear_cairo(caskbench_context_t *context)
{
    cairo_set_source_rgb (context->cairo_cr, 0, 0, 0);
    cairo_paint (context->cairo_cr);
}

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);
}

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :