| @@ -43,10 +43,6 @@ int init_figlet(context_t *cx) | |||||
| if(open_font(cx)) | if(open_font(cx)) | ||||
| return -1; | return -1; | ||||
| cx->x = cx->y = 0; | |||||
| cx->w = cx->h = 0; | |||||
| cx->cv = cucul_create_canvas(1, 1); | |||||
| cx->feed = feed_figlet; | cx->feed = feed_figlet; | ||||
| cx->flush = flush_figlet; | cx->flush = flush_figlet; | ||||
| cx->end = end_figlet; | cx->end = end_figlet; | ||||
| @@ -125,7 +121,6 @@ static int flush_figlet(context_t *cx) | |||||
| static int end_figlet(context_t *cx) | static int end_figlet(context_t *cx) | ||||
| { | { | ||||
| cucul_free_canvas(cx->image); | cucul_free_canvas(cx->image); | ||||
| cucul_free_canvas(cx->cv); | |||||
| free(cx->lookup); | free(cx->lookup); | ||||
| return 0; | return 0; | ||||
| @@ -41,10 +41,6 @@ int init_big(context_t *cx) | |||||
| cx->onechar = cucul_create_canvas(1, 1); | cx->onechar = cucul_create_canvas(1, 1); | ||||
| cucul_set_color(cx->onechar, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | cucul_set_color(cx->onechar, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK); | ||||
| cx->x = cx->y = 0; | |||||
| cx->w = cx->h = 0; | |||||
| cx->cv = cucul_create_canvas(1, 1); | |||||
| cx->feed = feed_big; | cx->feed = feed_big; | ||||
| cx->flush = flush_big; | cx->flush = flush_big; | ||||
| cx->end = end_big; | cx->end = end_big; | ||||
| @@ -127,7 +123,6 @@ static int flush_big(context_t *cx) | |||||
| static int end_big(context_t *cx) | static int end_big(context_t *cx) | ||||
| { | { | ||||
| cucul_free_canvas(cx->onechar); | cucul_free_canvas(cx->onechar); | ||||
| cucul_free_canvas(cx->cv); | |||||
| free(cx->buf); | free(cx->buf); | ||||
| cucul_free_font(cx->f); | cucul_free_font(cx->f); | ||||
| @@ -31,6 +31,11 @@ | |||||
| int render_init(context_t *cx) | int render_init(context_t *cx) | ||||
| { | { | ||||
| cx->x = cx->y = 0; | |||||
| cx->w = cx->h = 0; | |||||
| cx->lines = 0; | |||||
| cx->cv = cucul_create_canvas(0, 0); | |||||
| if(!strcasecmp(cx->font, "mono9")) | if(!strcasecmp(cx->font, "mono9")) | ||||
| return init_big(cx); | return init_big(cx); | ||||
| @@ -114,6 +119,7 @@ int render_line(context_t *cx) | |||||
| int render_end(context_t *cx) | int render_end(context_t *cx) | ||||
| { | { | ||||
| cx->end(cx); | cx->end(cx); | ||||
| cucul_free_canvas(cx->cv); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -34,9 +34,6 @@ int init_tiny(context_t *cx) | |||||
| { | { | ||||
| cx->ew = 16; | cx->ew = 16; | ||||
| cx->eh = 2; | cx->eh = 2; | ||||
| cx->x = cx->y = 0; | |||||
| cx->w = cx->h = 0; | |||||
| cx->cv = cucul_create_canvas(cx->ew, cx->eh); | |||||
| cx->feed = feed_tiny; | cx->feed = feed_tiny; | ||||
| cx->flush = flush_tiny; | cx->flush = flush_tiny; | ||||
| @@ -106,8 +103,6 @@ static int flush_tiny(context_t *cx) | |||||
| static int end_tiny(context_t *cx) | static int end_tiny(context_t *cx) | ||||
| { | { | ||||
| cucul_free_canvas(cx->cv); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -25,7 +25,7 @@ struct toilet_context | |||||
| cucul_canvas_t *cv; | cucul_canvas_t *cv; | ||||
| cucul_canvas_t *torender; | cucul_canvas_t *torender; | ||||
| unsigned int w, h, ew, eh, x, y; | |||||
| unsigned int w, h, ew, eh, x, y, lines; | |||||
| /* Render methods */ | /* Render methods */ | ||||
| int (*feed)(struct toilet_context *, uint32_t); | int (*feed)(struct toilet_context *, uint32_t); | ||||