+ Moved global variables to src/graphics.c.
* src/bitmap.c:
+ Sanitised prototypes.
tags/v0.99.beta14
| @@ -24,5 +24,5 @@ if NEED_PIC | |||||
| libcaca_pic_a = libcaca_pic.a | libcaca_pic_a = libcaca_pic.a | ||||
| endif | endif | ||||
| libcaca_pic_a_SOURCES = $(libcaca_a_SOURCES) | libcaca_pic_a_SOURCES = $(libcaca_a_SOURCES) | ||||
| libcaca_pic_a_CPPFLAGS = -fPIC | |||||
| libcaca_pic_a_CPPFLAGS = -fPIC -DPIC | |||||
| @@ -160,13 +160,14 @@ static void mask2shift(unsigned int mask, int *right, int *left) | |||||
| *left = 12 - lshift; | *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; | struct caca_bitmap *bitmap; | ||||
| /* Currently only this format is supported. Will improve later. */ | |||||
| /* Minor sanity test */ | |||||
| if(!w || !h || !pitch || bpp > 32 || bpp < 8) | if(!w || !h || !pitch || bpp > 32 || bpp < 8) | ||||
| return NULL; | 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, | 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 | #if !NEW_RENDERER | ||||
| static const int white_colors[] = | static const int white_colors[] = | ||||
| @@ -50,16 +50,8 @@ | |||||
| static void caca_init_terminal(void); | static void caca_init_terminal(void); | ||||
| char *_caca_empty_line; | |||||
| char *_caca_scratch_line; | |||||
| #if defined(USE_NCURSES) | #if defined(USE_NCURSES) | ||||
| static mmask_t oldmask; | static mmask_t oldmask; | ||||
| int _caca_attr[16*16]; | |||||
| #endif | |||||
| #if defined(USE_CONIO) | |||||
| char *_caca_screen; | |||||
| #endif | #endif | ||||
| int caca_init(void) | int caca_init(void) | ||||
| @@ -212,10 +212,13 @@ void caca_free_sprite(struct caca_sprite *); | |||||
| * Bitmap handling | * Bitmap handling | ||||
| */ | */ | ||||
| struct caca_bitmap; | 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[], | void caca_set_bitmap_palette(struct caca_bitmap *, unsigned int[], | ||||
| unsigned int[], unsigned int[], 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 *); | void caca_free_bitmap(struct caca_bitmap *); | ||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||
| @@ -32,19 +32,7 @@ | |||||
| extern int _caca_init_graphics(void); | 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_width; | ||||
| extern unsigned int _caca_height; | extern unsigned int _caca_height; | ||||
| extern char *_caca_empty_line; | |||||
| extern char *_caca_scratch_line; | |||||
| #endif /* __CACA_INTERNALS_H__ */ | #endif /* __CACA_INTERNALS_H__ */ | ||||
| @@ -57,12 +57,26 @@ | |||||
| #include "caca.h" | #include "caca.h" | ||||
| #include "caca_internals.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 struct text_info ti; | ||||
| static char *_caca_screen; | |||||
| #endif | #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_delay; | ||||
| static unsigned int _caca_rendertime; | static unsigned int _caca_rendertime; | ||||