Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (11 years ago)
Author:
Sam Hocevar
Message:

Starting refactoring to get rid of libcucul. The initial reason for the
split is rendered moot by the plugin system: when enabled, binaries do
not link directly with libX11 or libGL. I hope this is a step towards
more consisteny and clarity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/caca0.c

    r2299 r2821  
    2828
    2929/* These variables are needed to emulate old non-thread safe behaviour */
    30 cucul_canvas_t *__caca0_cv = NULL;
     30caca_canvas_t *__caca0_cv = NULL;
    3131caca_display_t *__caca0_dp = NULL;
    32 unsigned char __caca0_fg = CUCUL_LIGHTGRAY;
    33 unsigned char __caca0_bg = CUCUL_BLACK;
     32unsigned char __caca0_fg = CACA_LIGHTGRAY;
     33unsigned char __caca0_bg = CACA_BLACK;
    3434char __caca0_utf8[2] = " ";
    3535
     
    4242void __caca0_set_feature(int);
    4343char const *__caca0_get_feature_name(int);
    44 cucul_canvas_t *__caca0_load_sprite(char const *);
    45 cucul_dither_t *__caca0_create_bitmap(unsigned int, unsigned int,
     44caca_canvas_t *__caca0_load_sprite(char const *);
     45caca_dither_t *__caca0_create_bitmap(unsigned int, unsigned int,
    4646          unsigned int, unsigned int, unsigned long int, unsigned long int,
    4747          unsigned long int, unsigned long int);
    48 void __caca0_free_bitmap(cucul_dither_t *);
     48void __caca0_free_bitmap(caca_dither_t *);
    4949extern char const *__caca0_get_color_name(unsigned char);
    5050
     
    5252int __caca0_init(void)
    5353{
    54     __caca0_cv = cucul_create_canvas(0, 0);
     54    __caca0_cv = caca_create_canvas(0, 0);
    5555    if(!__caca0_cv)
    5656        return -1;
     
    5858    if(!__caca0_dp)
    5959    {
    60         cucul_free_canvas(__caca0_cv);
     60        caca_free_canvas(__caca0_cv);
    6161        __caca0_cv = NULL;
    6262        return -1;
    6363    }
    64     __caca0_fg = CUCUL_LIGHTGRAY;
    65     __caca0_bg = CUCUL_BLACK;
     64    __caca0_fg = CACA_LIGHTGRAY;
     65    __caca0_bg = CACA_BLACK;
    6666    return 0;
    6767}
     
    7171    caca_free_display(__caca0_dp);
    7272    __caca0_dp = NULL;
    73     cucul_free_canvas(__caca0_cv);
     73    caca_free_canvas(__caca0_cv);
    7474    __caca0_cv = NULL;
    7575}
     
    145145};
    146146
    147 static cucul_dither_t **bitmaps = NULL;
     147static caca_dither_t **bitmaps = NULL;
    148148static unsigned int nbitmaps = 0;
    149149
     
    173173            background = feature;
    174174            for(i = 0; i < nbitmaps; i++)
    175                 cucul_set_dither_color(bitmaps[i], features[feature]);
     175                caca_set_dither_color(bitmaps[i], features[feature]);
    176176            break;
    177177
     
    180180            antialiasing = feature;
    181181            for(i = 0; i < nbitmaps; i++)
    182                 cucul_set_dither_antialias(bitmaps[i], features[feature]);
     182                caca_set_dither_antialias(bitmaps[i], features[feature]);
    183183            break;
    184184
     
    187187            dithering = feature;
    188188            for(i = 0; i < nbitmaps; i++)
    189                 cucul_set_dither_algorithm(bitmaps[i], features[feature]);
     189                caca_set_dither_algorithm(bitmaps[i], features[feature]);
    190190            break;
    191191    }
     
    212212}
    213213
    214 cucul_canvas_t *__caca0_load_sprite(char const *file)
    215 {
    216     cucul_canvas_t *cv;
    217 
    218     cv = cucul_create_canvas(0, 0);;
    219     if(cucul_import_file(cv, file, "") < 0)
    220     {
    221         cucul_free_canvas(cv);
     214caca_canvas_t *__caca0_load_sprite(char const *file)
     215{
     216    caca_canvas_t *cv;
     217
     218    cv = caca_create_canvas(0, 0);;
     219    if(caca_import_file(cv, file, "") < 0)
     220    {
     221        caca_free_canvas(cv);
    222222        return NULL;
    223223    }
     
    226226}
    227227
    228 cucul_dither_t *__caca0_create_bitmap(unsigned int bpp, unsigned int w,
     228caca_dither_t *__caca0_create_bitmap(unsigned int bpp, unsigned int w,
    229229                                      unsigned int h, unsigned int pitch,
    230230                                      unsigned long int r, unsigned long int g,
    231231                                      unsigned long int b, unsigned long int a)
    232232{
    233     cucul_dither_t *d;
    234 
    235     d = cucul_create_dither(bpp, w, h, pitch, r, g, b, a);
     233    caca_dither_t *d;
     234
     235    d = caca_create_dither(bpp, w, h, pitch, r, g, b, a);
    236236    if(!d)
    237237        return NULL;
    238238
    239     cucul_set_dither_color(d, features[background]);
    240     cucul_set_dither_antialias(d, features[antialiasing]);
    241     cucul_set_dither_algorithm(d, features[dithering]);
     239    caca_set_dither_color(d, features[background]);
     240    caca_set_dither_antialias(d, features[antialiasing]);
     241    caca_set_dither_algorithm(d, features[dithering]);
    242242
    243243    /* Store bitmap in our list */
    244244    nbitmaps++;
    245     bitmaps = realloc(bitmaps, nbitmaps * (sizeof(cucul_dither_t *)));
     245    bitmaps = realloc(bitmaps, nbitmaps * (sizeof(caca_dither_t *)));
    246246    bitmaps[nbitmaps - 1] = d;
    247247
     
    249249}
    250250
    251 void __caca0_free_bitmap(cucul_dither_t *d)
     251void __caca0_free_bitmap(caca_dither_t *d)
    252252{
    253253    unsigned int i, found = 0;
    254254
    255     cucul_free_dither(d);
     255    caca_free_dither(d);
    256256
    257257    /* Remove bitmap from our list */
Note: See TracChangeset for help on using the changeset viewer.