draw: export draw_text_markup_expand() and check for data before wipe
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
5fc500a861
commit
88e69ba44f
|
@ -44,16 +44,21 @@
|
||||||
#include "common/markup.h"
|
#include "common/markup.h"
|
||||||
#include "common/xutil.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);
|
p_clear(pdata, 1);
|
||||||
buffer_init(&pdata->text);
|
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);
|
if(pdata)
|
||||||
draw_image_delete(&pdata->bg_image);
|
{
|
||||||
|
buffer_wipe(&pdata->text);
|
||||||
|
draw_image_delete(&pdata->bg_image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static iconv_t iso2utf8 = (iconv_t) -1;
|
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,
|
draw_text_markup_expand(draw_parser_data_t *data,
|
||||||
const char *str, ssize_t slen)
|
const char *str, ssize_t slen)
|
||||||
{
|
{
|
||||||
|
|
|
@ -199,6 +199,8 @@ typedef struct
|
||||||
void draw_parser_data_init(draw_parser_data_t *);
|
void draw_parser_data_init(draw_parser_data_t *);
|
||||||
void draw_parser_data_wipe(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_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(draw_context_t *, area_t, float, bool, const xcolor_t *);
|
||||||
void draw_rectangle_gradient(draw_context_t *, area_t, float, bool, vector_t,
|
void draw_rectangle_gradient(draw_context_t *, area_t, float, bool, vector_t,
|
||||||
|
|
Loading…
Reference in New Issue