mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Define SCREEN_COLOR_SIZE to hold the number of bytes in screen_char->color
This commit is contained in:
parent
2d898272c1
commit
0ae69652dd
@ -21,12 +21,13 @@
|
|||||||
int_bounds(&(x), 0, (term)->width - 1); \
|
int_bounds(&(x), 0, (term)->width - 1); \
|
||||||
int_bounds(&(y), 0, (term)->height - 1); \
|
int_bounds(&(y), 0, (term)->height - 1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#if defined(CONFIG_TRUE_COLOR)
|
|
||||||
#define clear_screen_char_color(schar) do { memset((schar)->color, 0, 6); } while (0)
|
#if SCREEN_COLOR_SIZE > 1
|
||||||
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
|
#define clear_screen_char_color(schar) \
|
||||||
#define clear_screen_char_color(schar) do { memset((schar)->color, 0, 2); } while (0)
|
do { memset((schar)->color, 0, SCREEN_COLOR_SIZE); } while (0)
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,16 @@ struct color_pair;
|
|||||||
struct box;
|
struct box;
|
||||||
struct terminal;
|
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. */
|
/* All attributes should fit inside an unsigned char. */
|
||||||
/* XXX: The bold mask is used as part of the color encoding. */
|
/* XXX: The bold mask is used as part of the color encoding. */
|
||||||
enum screen_char_attr {
|
enum screen_char_attr {
|
||||||
@ -30,16 +40,8 @@ struct screen_char {
|
|||||||
/* Attributes are screen_char_attr bits. */
|
/* Attributes are screen_char_attr bits. */
|
||||||
unsigned char attr;
|
unsigned char attr;
|
||||||
|
|
||||||
#if defined(CONFIG_TRUE_COLOR)
|
/* The fore- and background color. */
|
||||||
/* 0, 1, 2 - rgb foreground,
|
unsigned char color[SCREEN_COLOR_SIZE];
|
||||||
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
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define copy_screen_chars(to, from, amount) \
|
#define copy_screen_chars(to, from, amount) \
|
||||||
|
@ -422,13 +422,7 @@ struct screen_state {
|
|||||||
unsigned char bold;
|
unsigned char bold;
|
||||||
unsigned char attr;
|
unsigned char attr;
|
||||||
/* Following should match struct screen_char color field. */
|
/* Following should match struct screen_char color field. */
|
||||||
#if defined(CONFIG_TRUE_COLOR)
|
unsigned char color[SCREEN_COLOR_SIZE];
|
||||||
unsigned char color[6];
|
|
||||||
#elif defined(CONFIG_88_COLORS) || defined(CONFIG_256_COLORS)
|
|
||||||
unsigned char color[2];
|
|
||||||
#else
|
|
||||||
unsigned char color[1];
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CONFIG_TRUE_COLOR)
|
#if defined(CONFIG_TRUE_COLOR)
|
||||||
|
Loading…
Reference in New Issue
Block a user