1 /*
2 * Copyright (C) 2006 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
3 * 2012 Henry Gebhardt <hsggebhardt@gmail.com>
4 * 2014 Andriy Grytsenko <andrej@rep.kiev.ua>
5 *
6 * This file is a part of LXPanel project.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 #include "dbg.h"
24
25 #include <glib.h>
26
_check_cairo_status(cairo_t * cr,char const * file,char const * func,int line)27 void _check_cairo_status(cairo_t* cr, char const* file, char const* func, int line)
28 {
29 cairo_status_t status = cairo_status(cr);
30 if (status != CAIRO_STATUS_SUCCESS)
31 g_critical("%s:%s:%-5d: cairo had error %d: %s", file, func, line, status,
32 cairo_status_to_string(status));
33 }
34
_check_cairo_surface_status(cairo_surface_t ** surf,char const * file,char const * func,int line)35 void _check_cairo_surface_status(cairo_surface_t** surf, char const* file, char const* func, int line)
36 {
37 cairo_status_t status = cairo_surface_status(*surf);
38 if (status != CAIRO_STATUS_SUCCESS) {
39 g_critical("%s:%s:%-5d: cairo had error %d: %s", file, func, line, status,
40 cairo_status_to_string(status));
41 cairo_surface_destroy(*surf);
42 *surf = NULL;
43 }
44 }
45
46 /* vim: set sw=4 et sts=4 : */
47