diff --git a/common/draw.c b/common/draw.c index c5378b97e..13c6609b4 100644 --- a/common/draw.c +++ b/common/draw.c @@ -44,16 +44,21 @@ #include "common/markup.h" #include "common/xutil.h" -void draw_parser_data_init(draw_parser_data_t *pdata) +void +draw_parser_data_init(draw_parser_data_t *pdata) { p_clear(pdata, 1); buffer_init(&pdata->text); } -void draw_parser_data_wipe(draw_parser_data_t *pdata) +void +draw_parser_data_wipe(draw_parser_data_t *pdata) { - buffer_wipe(&pdata->text); - draw_image_delete(&pdata->bg_image); + if(pdata) + { + buffer_wipe(&pdata->text); + draw_image_delete(&pdata->bg_image); + } } static iconv_t iso2utf8 = (iconv_t) -1; @@ -291,7 +296,7 @@ draw_markup_on_element(markup_parser_data_t *p, const char *elem, } } -static bool +bool draw_text_markup_expand(draw_parser_data_t *data, const char *str, ssize_t slen) { diff --git a/common/draw.h b/common/draw.h index 478339fa9..ad32ff13c 100644 --- a/common/draw.h +++ b/common/draw.h @@ -199,6 +199,8 @@ typedef struct void draw_parser_data_init(draw_parser_data_t *); void draw_parser_data_wipe(draw_parser_data_t *); +bool draw_text_markup_expand(draw_parser_data_t *, const char *, ssize_t); + void draw_text(draw_context_t *, font_t *, area_t, const char *, ssize_t len, draw_parser_data_t *); void draw_rectangle(draw_context_t *, area_t, float, bool, const xcolor_t *); void draw_rectangle_gradient(draw_context_t *, area_t, float, bool, vector_t,