Ignore:
Timestamp:
Oct 26, 2006, 3:30:14 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • Make filters line-feed aware.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • toilet/trunk/src/render.c

    r1242 r1243  
    2929#include "render.h"
    3030#include "filter.h"
     31
     32static int render_flush(context_t *);
    3133
    3234int render_init(context_t *cx)
     
    6769
    6870        if(ch == '\n')
    69             render_line(cx);
     71            render_flush(cx);
    7072    }
    7173
     
    9294    }
    9395
    94     render_line(cx);
    95 
    96     return 0;
    97 }
    98 
    99 int render_line(context_t *cx)
    100 {
    101     cucul_buffer_t *buffer;
    102 
    103     /* Flush current line */
    104     cx->flush(cx);
    105 
    106     /* Apply optional effects to our string */
    107     filter_do(cx);
    108 
    109     /* Output line */
    110     buffer = cucul_export_canvas(cx->torender, cx->export);
    111     fwrite(cucul_get_buffer_data(buffer),
    112            cucul_get_buffer_size(buffer), 1, stdout);
    113     cucul_free_buffer(buffer);
    114     cucul_free_canvas(cx->torender);
     96    render_flush(cx);
    11597
    11698    return 0;
     
    125107}
    126108
     109/* XXX: Following functions are local */
     110
     111static int render_flush(context_t *cx)
     112{
     113    cucul_buffer_t *buffer;
     114
     115    /* Flush current line */
     116    cx->flush(cx);
     117
     118    /* Apply optional effects to our string */
     119    filter_do(cx);
     120
     121    cx->lines += cucul_get_canvas_height(cx->torender);
     122
     123    /* Output line */
     124    buffer = cucul_export_canvas(cx->torender, cx->export);
     125    fwrite(cucul_get_buffer_data(buffer),
     126           cucul_get_buffer_size(buffer), 1, stdout);
     127    cucul_free_buffer(buffer);
     128    cucul_free_canvas(cx->torender);
     129
     130    return 0;
     131}
     132
Note: See TracChangeset for help on using the changeset viewer.