1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-28 01:35:32 +00:00

Define SCREEN_COLOR_SIZE to hold the number of bytes in screen_char->color

This commit is contained in:
Jonas Fonseca 2006-08-20 21:24:20 +02:00 committed by Jonas Fonseca
parent 2d898272c1
commit 0ae69652dd
3 changed files with 19 additions and 22 deletions

View File

@ -21,12 +21,13 @@
int_bounds(&(x), 0, (term)->width - 1); \
int_bounds(&(y), 0, (term)->height - 1); \
} while (0)
#if defined(CONFIG_TRUE_COLOR)
#define clear_screen_char_color(schar) do { memset((schar)->color, 0, 6); } while (0)
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
#define clear_screen_char_color(schar) do { memset((schar)->color, 0, 2); } while (0)
#if SCREEN_COLOR_SIZE > 1
#define clear_screen_char_color(schar) \
do { memset((schar)->color, 0, SCREEN_COLOR_SIZE); } while (0)
#else
#define clear_screen_char_color(schar) do { (schar)->color[0] = 0; } while (0)
#define clear_screen_char_color(schar) \
do { (schar)->color[0] = 0; } while (0)
#endif

View File

@ -7,6 +7,16 @@ struct color_pair;
struct box;
struct terminal;
#if defined(CONFIG_TRUE_COLOR)
/* 0, 1, 2 - rgb foreground; 3, 4, 5 - rgb background */
#define SCREEN_COLOR_SIZE 6
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
/* 0 is foreground; 1 is background */
#define SCREEN_COLOR_SIZE 2
#else
#define SCREEN_COLOR_SIZE 1
#endif
/* All attributes should fit inside an unsigned char. */
/* XXX: The bold mask is used as part of the color encoding. */
enum screen_char_attr {
@ -30,16 +40,8 @@ struct screen_char {
/* Attributes are screen_char_attr bits. */
unsigned char attr;
#if defined(CONFIG_TRUE_COLOR)
/* 0, 1, 2 - rgb foreground,
3, 4, 5 - rgb background */
unsigned char color[6];
/* The encoded fore- and background color. */
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
unsigned char color[2];
#else
unsigned char color[1];
#endif
/* The fore- and background color. */
unsigned char color[SCREEN_COLOR_SIZE];
};
#define copy_screen_chars(to, from, amount) \

View File

@ -422,13 +422,7 @@ struct screen_state {
unsigned char bold;
unsigned char attr;
/* Following should match struct screen_char color field. */
#if defined(CONFIG_TRUE_COLOR)
unsigned char color[6];
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
unsigned char color[2];
#else
unsigned char color[1];
#endif
unsigned char color[SCREEN_COLOR_SIZE];
};
#if defined(CONFIG_TRUE_COLOR)