Changeset 832


Ignore:
Timestamp:
Apr 21, 2006, 10:49:17 PM (14 years ago)
Author:
Sam Hocevar
Message:
  • Changed cucul_clear_canvas() again. It now uses the current foreground and background colours to clear the screen.
Location:
libcaca/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/configure.ac

    r830 r832  
    77AC_CANONICAL_SYSTEM
    88
    9 AM_INIT_AUTOMAKE(libcaca, 0.10)
     9AM_INIT_AUTOMAKE(libcaca, 0.10.beta1)
    1010LT_VERSION="10:0:10"
    1111AC_SUBST(LT_VERSION)
  • libcaca/trunk/cpp/cucul++.cpp

    r827 r832  
    101101}
    102102
    103 void Cucul::clear(unsigned char bg )
    104 {
    105     cucul_clear_canvas(cv, bg);
     103void Cucul::clear(void)
     104{
     105    cucul_clear_canvas(cv);
    106106}
    107107
  • libcaca/trunk/cpp/cucul++.h

    r827 r832  
    7171    void putchar(int x, int y, char ch);
    7272    void putstr(int x, int y, char *str);
    73     void clear(unsigned char bg);
     73    void clear(void);
    7474    void blit(int, int, Cucul* c1, Cucul* c2);
    7575    void invert();
  • libcaca/trunk/cucul/canvas.c

    r814 r832  
    155155/** \brief Clear the canvas.
    156156 *
    157  *  This function clears the canvas using the given background colour.
     157 *  This function clears the canvas using the current background colour.
    158158 *
    159159 *  \param cv The canvas to clear.
    160  *  \param bg The background colour to use.
    161  */
    162 void cucul_clear_canvas(cucul_canvas_t *cv, unsigned char bg)
    163 {
    164     uint16_t oldfg = cv->fgcolor;
    165     uint16_t oldbg = cv->bgcolor;
    166     int y = cv->height;
    167 
    168     cucul_set_color(cv, CUCUL_COLOR_DEFAULT, bg);
     160 */
     161void cucul_clear_canvas(cucul_canvas_t *cv)
     162{
     163    uint32_t color = (cv->bgcolor << 16) | cv->fgcolor;
     164    unsigned int n;
    169165
    170166    /* We could use SLsmg_cls() etc., but drawing empty lines is much faster */
    171     while(y--)
    172         cucul_putstr(cv, 0, y, cv->empty_line);
    173 
    174     cv->fgcolor = oldfg;
    175     cv->bgcolor = oldbg;
     167    for(n = cv->width * cv->height; n--; )
     168    {
     169        cv->chars[n] = (uint32_t)' ';
     170        cv->attr[n] = color;
     171    }
    176172}
    177173
  • libcaca/trunk/cucul/cucul.h

    r826 r832  
    104104void cucul_putstr(cucul_canvas_t *, int, int, char const *);
    105105void cucul_printf(cucul_canvas_t *, int, int, char const *, ...);
    106 void cucul_clear_canvas(cucul_canvas_t *, unsigned char);
     106void cucul_clear_canvas(cucul_canvas_t *);
    107107void cucul_blit(cucul_canvas_t *, int, int, cucul_canvas_t const *, cucul_canvas_t const *);
    108108/*  @} */
  • libcaca/trunk/src/cacaview.c

    r819 r832  
    322322        }
    323323
    324         cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     324        cucul_set_color(cv, CUCUL_COLOR_WHITE, CUCUL_COLOR_BLACK);
     325        cucul_clear_canvas(cv);
    325326
    326327        if(!items)
  • libcaca/trunk/src/img2irc.c

    r826 r832  
    5454
    5555    cucul_set_canvas_size(cv, cols, lines);
    56     cucul_clear_canvas(cv, CUCUL_COLOR_TRANSPARENT);
     56    cucul_set_color(cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_TRANSPARENT);
     57    cucul_clear_canvas(cv);
    5758    cucul_dither_bitmap(cv, 0, 0, cols, lines, i->dither, i->pixels);
    5859
  • libcaca/trunk/test/colors.c

    r819 r832  
    3636        return 1;
    3737
    38     cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     38    cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     39    cucul_clear_canvas(cv);
    3940    for(i = 0; i < 16; i++)
    4041    {
  • libcaca/trunk/test/demo.c

    r819 r832  
    143143
    144144                if(demo)
    145                     cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     145                {
     146                    cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     147                    cucul_clear_canvas(cv);
     148                }
    146149            }
    147150            else if(ev.type & CACA_EVENT_MOUSE_MOTION)
     
    197200    int yo = cucul_get_canvas_height(cv) - 2;
    198201
    199     cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
    200202    cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     203    cucul_clear_canvas(cv);
    201204    cucul_draw_thin_box(cv, 1, 1, xo, yo);
    202205
     
    237240    i++;
    238241
    239     cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     242    cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     243    cucul_clear_canvas(cv);
    240244
    241245    /* Draw the sun */
     
    350354    char buf[BUFSIZ];
    351355
    352     cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     356    cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     357    cucul_clear_canvas(cv);
    353358    for(i = 0; i < 16; i++)
    354359    {
  • libcaca/trunk/test/event.c

    r819 r832  
    8282        while(ret);
    8383
    84         cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     84        cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     85        cucul_clear_canvas(cv);
    8586
    8687        /* Print current event */
  • libcaca/trunk/test/gamma.c

    r819 r832  
    9191
    9292        /* Draw something on the mask */
    93         cucul_clear_canvas(mask, CUCUL_COLOR_BLACK);
     93        cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     94        cucul_clear_canvas(mask);
    9495        cucul_set_color(mask, CUCUL_COLOR_WHITE, CUCUL_COLOR_WHITE);
    9596        cucul_fill_ellipse(mask, (1.0 + sin(0.05 * (float)x))
  • libcaca/trunk/test/spritedit.c

    r819 r832  
    101101
    102102
    103         cucul_clear_canvas(cv, CUCUL_COLOR_BLACK);
     103        cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
     104        cucul_clear_canvas(cv);
    104105
    105         cucul_set_color(cv, CUCUL_COLOR_LIGHTGRAY, CUCUL_COLOR_BLACK);
    106106        cucul_draw_thin_box(cv, 0, 0, cucul_get_canvas_width(cv) - 1,
    107107                            cucul_get_canvas_height(cv) - 1);
Note: See TracChangeset for help on using the changeset viewer.