Browse Source

* Factor code from renderers to main render.c functions.

pull/1/head
Sam Hocevar sam 18 years ago
parent
commit
711021abc7
5 changed files with 7 additions and 16 deletions
  1. +0
    -5
      src/figlet.c
  2. +0
    -5
      src/mono9.c
  3. +6
    -0
      src/render.c
  4. +0
    -5
      src/term.c
  5. +1
    -1
      src/toilet.h

+ 0
- 5
src/figlet.c View File

@@ -43,10 +43,6 @@ int init_figlet(context_t *cx)
if(open_font(cx))
return -1;

cx->x = cx->y = 0;
cx->w = cx->h = 0;
cx->cv = cucul_create_canvas(1, 1);

cx->feed = feed_figlet;
cx->flush = flush_figlet;
cx->end = end_figlet;
@@ -125,7 +121,6 @@ static int flush_figlet(context_t *cx)
static int end_figlet(context_t *cx)
{
cucul_free_canvas(cx->image);
cucul_free_canvas(cx->cv);
free(cx->lookup);

return 0;


+ 0
- 5
src/mono9.c View File

@@ -41,10 +41,6 @@ int init_big(context_t *cx)
cx->onechar = cucul_create_canvas(1, 1);
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->flush = flush_big;
cx->end = end_big;
@@ -127,7 +123,6 @@ static int flush_big(context_t *cx)
static int end_big(context_t *cx)
{
cucul_free_canvas(cx->onechar);
cucul_free_canvas(cx->cv);
free(cx->buf);
cucul_free_font(cx->f);



+ 6
- 0
src/render.c View File

@@ -31,6 +31,11 @@

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"))
return init_big(cx);

@@ -114,6 +119,7 @@ int render_line(context_t *cx)
int render_end(context_t *cx)
{
cx->end(cx);
cucul_free_canvas(cx->cv);

return 0;
}


+ 0
- 5
src/term.c View File

@@ -34,9 +34,6 @@ int init_tiny(context_t *cx)
{
cx->ew = 16;
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->flush = flush_tiny;
@@ -106,8 +103,6 @@ static int flush_tiny(context_t *cx)

static int end_tiny(context_t *cx)
{
cucul_free_canvas(cx->cv);

return 0;
}


+ 1
- 1
src/toilet.h View File

@@ -25,7 +25,7 @@ struct toilet_context

cucul_canvas_t *cv;
cucul_canvas_t *torender;
unsigned int w, h, ew, eh, x, y;
unsigned int w, h, ew, eh, x, y, lines;

/* Render methods */
int (*feed)(struct toilet_context *, uint32_t);


Loading…
Cancel
Save