Raise the maximum number of colors to 768 in SDL and X11. The logic is

that each color pair can have a unique foreground and background color
defined via init_color(), without altering any of the first (preset) 256
colors.
This commit is contained in:
William McBrine
2019-05-12 23:18:32 -04:00
parent 42c280fd8e
commit e34674cb6d
12 changed files with 22 additions and 16 deletions

View File

@@ -20,8 +20,8 @@ SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL,
*pdc_back = NULL, *pdc_tileback = NULL;
int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0;
SDL_Color pdc_color[256];
Uint32 pdc_mapped[256];
SDL_Color pdc_color[MAX_COLORS];
Uint32 pdc_mapped[MAX_COLORS];
int pdc_fheight, pdc_fwidth, pdc_fthick, pdc_flastc;
bool pdc_own_screen;

View File

@@ -14,11 +14,13 @@ PDCEX int pdc_font_size;
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
#define MAX_COLORS 768
extern SDL_Surface *pdc_tileback; /* used to regenerate the background
of "transparent" cells */
extern SDL_Color pdc_color[256]; /* colors for font palette */
extern Uint32 pdc_mapped[256]; /* colors for FillRect(), as
used in _highlight() */
extern SDL_Color pdc_color[MAX_COLORS]; /* colors for font palette */
extern Uint32 pdc_mapped[MAX_COLORS]; /* colors for FillRect(), as
used in _highlight() */
extern int pdc_fheight, pdc_fwidth; /* font height and width */
extern int pdc_fthick; /* thickness for highlights and
rendered ACS glyphs */

View File

@@ -62,7 +62,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = 256;
COLORS = MAX_COLORS;
if (blinkon)
{

View File

@@ -32,8 +32,8 @@ SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL,
*pdc_back = NULL, *pdc_tileback = NULL;
int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0;
SDL_Color pdc_color[256];
Uint32 pdc_mapped[256];
SDL_Color pdc_color[MAX_COLORS];
Uint32 pdc_mapped[MAX_COLORS];
int pdc_fheight, pdc_fwidth, pdc_fthick, pdc_flastc;
bool pdc_own_window;

View File

@@ -15,11 +15,13 @@ PDCEX SDL_Window *pdc_window;
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
#define MAX_COLORS 768
extern SDL_Surface *pdc_tileback; /* used to regenerate the background
of "transparent" cells */
extern SDL_Color pdc_color[256]; /* colors for font palette */
extern Uint32 pdc_mapped[256]; /* colors for FillRect(), as
used in _highlight() */
extern SDL_Color pdc_color[MAX_COLORS]; /* colors for font palette */
extern Uint32 pdc_mapped[MAX_COLORS]; /* colors for FillRect(), as
used in _highlight() */
extern int pdc_fheight, pdc_fwidth; /* font height and width */
extern int pdc_fthick; /* thickness for highlights and
rendered ACS glyphs */

View File

@@ -62,7 +62,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = 256;
COLORS = MAX_COLORS;
if (blinkon)
{

View File

@@ -74,7 +74,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = 256;
COLORS = MAX_COLORS;
XCursesInstruct(blinkon ? CURSES_BLINK_ON : CURSES_BLINK_OFF);

View File

@@ -187,3 +187,5 @@ enum
};
extern short *xc_atrtab;
#define MAX_COLORS 768

View File

@@ -33,7 +33,6 @@ XCursesAppData xc_app_data;
# define PDC_SCROLLBAR_TYPE float
#endif
#define MAX_COLORS 256 /* maximum of "normal" colors */
#define COLOR_CURSOR MAX_COLORS /* color of cursor */
#define COLOR_BORDER MAX_COLORS + 1 /* color of border */

View File

@@ -64,7 +64,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = 256;
COLORS = MAX_COLORS;
XCursesInstruct(blinkon ? CURSES_BLINK_ON : CURSES_BLINK_OFF);

View File

@@ -176,3 +176,5 @@ enum
extern short *xc_atrtab;
extern bool xc_resize_now;
#define MAX_COLORS 768

View File

@@ -33,7 +33,6 @@ XCursesAppData xc_app_data;
# define PDC_SCROLLBAR_TYPE float
#endif
#define MAX_COLORS 256 /* maximum of "normal" colors */
#define COLOR_CURSOR MAX_COLORS /* color of cursor */
#define COLOR_BORDER MAX_COLORS + 1 /* color of border */