Ignore:
Timestamp:
Sep 27, 2008, 3:12:46 PM (12 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/src/common-image.c

    r2436 r2821  
    2424#endif
    2525
    26 #include "cucul.h"
     26#include "caca.h"
    2727
    2828#include "common-image.h"
    2929
    3030#if !defined(USE_IMLIB2)
    31 static unsigned int u32fread(cucul_file_t *);
    32 static unsigned int u16fread(cucul_file_t *);
    33 static unsigned int u8fread(cucul_file_t *);
     31static unsigned int u32fread(caca_file_t *);
     32static unsigned int u16fread(caca_file_t *);
     33static unsigned int u8fread(caca_file_t *);
    3434#endif
    3535
     
    6262    depth = 4;
    6363
    64     /* Create the libcucul dither */
    65     im->dither = cucul_create_dither(bpp, im->w, im->h, depth * im->w,
     64    /* Create the libcaca dither */
     65    im->dither = caca_create_dither(bpp, im->w, im->h, depth * im->w,
    6666                                     rmask, gmask, bmask, amask);
    6767    if(!im->dither)
     
    7878    unsigned int red[256], green[256], blue[256], alpha[256];
    7979    unsigned int i, colors, offset, tmp, planes;
    80     cucul_file_t *f;
    81 
    82     f = cucul_file_open(name, "rb");
     80    caca_file_t *f;
     81
     82    f = caca_file_open(name, "rb");
    8383    if(!f)
    8484    {
     
    8989    if(u16fread(f) != 0x4d42)
    9090    {
    91         cucul_file_close(f);
     91        caca_file_close(f);
    9292        free(im);
    9393        return NULL;
     
    111111        if(tmp != 0)
    112112        {
    113             cucul_file_close(f);
     113            caca_file_close(f);
    114114            free(im);
    115115            return NULL;
     
    150150    else
    151151    {
    152         cucul_file_close(f);
     152        caca_file_close(f);
    153153        free(im);
    154154        return NULL;
     
    164164    if(!im->w || im->w > 0x10000 || !im->h || im->h > 0x10000 || planes != 1)
    165165    {
    166         cucul_file_close(f);
     166        caca_file_close(f);
    167167        free(im);
    168168        return NULL;
     
    173173    if(!im->pixels)
    174174    {
    175         cucul_file_close(f);
     175        caca_file_close(f);
    176176        free(im);
    177177        return NULL;
     
    209209            default:
    210210                /* Works for 8bpp, but also for 16, 24 etc. */
    211                 cucul_file_read(f, im->pixels + im->w * i * depth,
     211                caca_file_read(f, im->pixels + im->w * i * depth,
    212212                                im->w * depth);
    213213                /* Pad reads to 4 bytes */
     
    241241    }
    242242
    243     cucul_file_close(f);
    244 
    245     /* Create the libcucul dither */
    246     im->dither = cucul_create_dither(bpp, im->w, im->h, depth * im->w,
     243    caca_file_close(f);
     244
     245    /* Create the libcaca dither */
     246    im->dither = caca_create_dither(bpp, im->w, im->h, depth * im->w,
    247247                                     rmask, gmask, bmask, amask);
    248248    if(!im->dither)
     
    254254
    255255    if(bpp == 8)
    256         cucul_set_dither_palette(im->dither, red, green, blue, alpha);
     256        caca_set_dither_palette(im->dither, red, green, blue, alpha);
    257257#endif
    258258
     
    268268    free(im->pixels);
    269269#endif
    270     cucul_free_dither(im->dither);
     270    caca_free_dither(im->dither);
    271271}
    272272
    273273#if !defined(USE_IMLIB2)
    274 static unsigned int u32fread(cucul_file_t * f)
     274static unsigned int u32fread(caca_file_t * f)
    275275{
    276276    uint8_t buffer[4];
    277     cucul_file_read(f, buffer, 4);
     277    caca_file_read(f, buffer, 4);
    278278    return ((unsigned int)buffer[3] << 24) | ((unsigned int)buffer[2] << 16)
    279279             | ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]);
    280280}
    281281
    282 static unsigned int u16fread(cucul_file_t * f)
     282static unsigned int u16fread(caca_file_t * f)
    283283{
    284284    uint8_t buffer[2];
    285     cucul_file_read(f, buffer, 2);
     285    caca_file_read(f, buffer, 2);
    286286    return ((unsigned int)buffer[1] << 8) | ((unsigned int)buffer[0]);
    287287}
    288288
    289 static unsigned int u8fread(cucul_file_t * f)
     289static unsigned int u8fread(caca_file_t * f)
    290290{
    291291    uint8_t buffer;
    292     cucul_file_read(f, &buffer, 1);
     292    caca_file_read(f, &buffer, 1);
    293293    return (unsigned int)buffer;
    294294}
Note: See TracChangeset for help on using the changeset viewer.