[draw] Inline draw_context_delete() and check that it's != NULL
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e5ed2f2f1c
commit
61d552a860
|
@ -135,18 +135,6 @@ draw_context_new(xcb_connection_t *conn, int phys_screen, int width, int height,
|
||||||
return d;
|
return d;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Delete a draw context
|
|
||||||
* \param ctx draw_context_t to delete
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
draw_context_delete(draw_context_t **ctx)
|
|
||||||
{
|
|
||||||
g_object_unref((*ctx)->layout);
|
|
||||||
cairo_surface_destroy((*ctx)->surface);
|
|
||||||
cairo_destroy((*ctx)->cr);
|
|
||||||
p_delete(ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create a new Pango font
|
/** Create a new Pango font
|
||||||
* \param conn Connection ref
|
* \param conn Connection ref
|
||||||
* \param fontname Pango fontname (e.g. [FAMILY-LIST] [STYLE-OPTIONS] [SIZE])
|
* \param fontname Pango fontname (e.g. [FAMILY-LIST] [STYLE-OPTIONS] [SIZE])
|
||||||
|
|
|
@ -124,7 +124,20 @@ typedef struct
|
||||||
} draw_context_t;
|
} draw_context_t;
|
||||||
|
|
||||||
draw_context_t *draw_context_new(xcb_connection_t *, int, int, int, xcb_drawable_t);
|
draw_context_t *draw_context_new(xcb_connection_t *, int, int, int, xcb_drawable_t);
|
||||||
void draw_context_delete(draw_context_t **);
|
/** Delete a draw context
|
||||||
|
* \param ctx draw_context_t to delete
|
||||||
|
*/
|
||||||
|
static inline void
|
||||||
|
draw_context_delete(draw_context_t **ctx)
|
||||||
|
{
|
||||||
|
if(*ctx)
|
||||||
|
{
|
||||||
|
g_object_unref((*ctx)->layout);
|
||||||
|
cairo_surface_destroy((*ctx)->surface);
|
||||||
|
cairo_destroy((*ctx)->cr);
|
||||||
|
p_delete(ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
font_t *draw_font_new(xcb_connection_t *, int, char *);
|
font_t *draw_font_new(xcb_connection_t *, int, char *);
|
||||||
void draw_font_delete(font_t **);
|
void draw_font_delete(font_t **);
|
||||||
|
|
Loading…
Reference in New Issue