diff --git a/src/Makefile.am b/src/Makefile.am index 5dc8ade..132063f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,5 +24,5 @@ if NEED_PIC libcaca_pic_a = libcaca_pic.a endif libcaca_pic_a_SOURCES = $(libcaca_a_SOURCES) -libcaca_pic_a_CPPFLAGS = -fPIC +libcaca_pic_a_CPPFLAGS = -fPIC -DPIC diff --git a/src/bitmap.c b/src/bitmap.c index 403130d..248097e 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -160,13 +160,14 @@ static void mask2shift(unsigned int mask, int *right, int *left) *left = 12 - lshift; } -struct caca_bitmap *caca_create_bitmap(int bpp, int w, int h, int pitch, - int rmask, int gmask, int bmask, - int amask) +struct caca_bitmap *caca_create_bitmap(unsigned int bpp, unsigned int w, + unsigned int h, unsigned int pitch, + unsigned int rmask, unsigned int gmask, + unsigned int bmask, unsigned int amask) { struct caca_bitmap *bitmap; - /* Currently only this format is supported. Will improve later. */ + /* Minor sanity test */ if(!w || !h || !pitch || bpp > 32 || bpp < 8) return NULL; @@ -331,7 +332,7 @@ static void rgb2hsv_default(int r, int g, int b, int *hue, int *sat, int *val) } void caca_draw_bitmap(int x1, int y1, int x2, int y2, - const struct caca_bitmap *bitmap, char *pixels) + const struct caca_bitmap *bitmap, void *pixels) { #if !NEW_RENDERER static const int white_colors[] = diff --git a/src/caca.c b/src/caca.c index 2a5d078..56f2630 100644 --- a/src/caca.c +++ b/src/caca.c @@ -50,16 +50,8 @@ static void caca_init_terminal(void); -char *_caca_empty_line; -char *_caca_scratch_line; - #if defined(USE_NCURSES) static mmask_t oldmask; -int _caca_attr[16*16]; -#endif - -#if defined(USE_CONIO) -char *_caca_screen; #endif int caca_init(void) diff --git a/src/caca.h b/src/caca.h index 0b22928..f78dff7 100644 --- a/src/caca.h +++ b/src/caca.h @@ -212,10 +212,13 @@ void caca_free_sprite(struct caca_sprite *); * Bitmap handling */ struct caca_bitmap; -struct caca_bitmap *caca_create_bitmap(int, int, int, int, int, int, int, int); +struct caca_bitmap *caca_create_bitmap(unsigned int, unsigned int, + unsigned int, unsigned int, + unsigned int, unsigned int, + unsigned int, unsigned int); void caca_set_bitmap_palette(struct caca_bitmap *, unsigned int[], unsigned int[], unsigned int[], unsigned int[]); -void caca_draw_bitmap(int, int, int, int, const struct caca_bitmap *, char *); +void caca_draw_bitmap(int, int, int, int, const struct caca_bitmap *, void *); void caca_free_bitmap(struct caca_bitmap *); #ifdef __cplusplus diff --git a/src/caca_internals.h b/src/caca_internals.h index ab0b8be..36113ef 100644 --- a/src/caca_internals.h +++ b/src/caca_internals.h @@ -32,19 +32,7 @@ extern int _caca_init_graphics(void); -#if defined(USE_NCURSES) -extern int _caca_attr[]; -#endif - -#if defined(USE_CONIO) -extern struct text_info _ti; -extern char *_caca_screen; -#endif - extern unsigned int _caca_width; extern unsigned int _caca_height; -extern char *_caca_empty_line; -extern char *_caca_scratch_line; - #endif /* __CACA_INTERNALS_H__ */ diff --git a/src/graphics.c b/src/graphics.c index 6de3d3d..e5ebe4c 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -57,12 +57,26 @@ #include "caca.h" #include "caca_internals.h" -#ifdef USE_CONIO +/* + * Global variables + */ +unsigned int _caca_width; +unsigned int _caca_height; + +/* + * Local variables + */ +#if defined(USE_NCURSES) +static int _caca_attr[16*16]; +#endif + +#if defined(USE_CONIO) static struct text_info ti; +static char *_caca_screen; #endif -unsigned int _caca_width; -unsigned int _caca_height; +static char *_caca_empty_line; +static char *_caca_scratch_line; static unsigned int _caca_delay; static unsigned int _caca_rendertime;