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:
Julien Danjou 2008-07-10 17:09:57 +02:00
parent 5fc500a861
commit 88e69ba44f
2 changed files with 12 additions and 5 deletions

View File

@ -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)
{ {
if(pdata)
{
buffer_wipe(&pdata->text); buffer_wipe(&pdata->text);
draw_image_delete(&pdata->bg_image); 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)
{ {

View File

@ -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,