init banner: punch up RGB signifier

dankamongmen/sixel-speedup
nick black 3 years ago committed by Nick Black
parent 7b28c68cd5
commit 43b3724f07

@ -1206,6 +1206,9 @@ int sixel_blit(ncplane* nc, int placey, int placex, int linesize,
const void* data, int begy, int begx, const void* data, int begy, int begx,
int leny, int lenx, unsigned cellpixx); int leny, int lenx, unsigned cellpixx);
int term_fg_rgb8(bool RGBflag, const char* setaf, int colors, FILE* out,
unsigned r, unsigned g, unsigned b);
typedef struct ncvisual_implementation { typedef struct ncvisual_implementation {
int (*visual_init)(int loglevel); int (*visual_init)(int loglevel);
void (*visual_printbanner)(const struct notcurses* nc); void (*visual_printbanner)(const struct notcurses* nc);

@ -825,18 +825,28 @@ init_banner(const notcurses* nc){
printf("\n notcurses %s by nick black et al", notcurses_version()); printf("\n notcurses %s by nick black et al", notcurses_version());
term_fg_palindex(nc, stdout, nc->tcache.colors <= 256 ? 12 % nc->tcache.colors : 0x2080e0); term_fg_palindex(nc, stdout, nc->tcache.colors <= 256 ? 12 % nc->tcache.colors : 0x2080e0);
if(nc->tcache.cellpixy && nc->tcache.cellpixx){ if(nc->tcache.cellpixy && nc->tcache.cellpixx){
printf("\n %d rows (%dpx) %d cols (%dpx) (%sB) %zuB cells %d colors%s\n", printf("\n %d rows (%dpx) %d cols (%dpx) (%sB) %zuB cells %d colors",
nc->stdplane->leny, nc->tcache.cellpixy, nc->stdplane->leny, nc->tcache.cellpixy,
nc->stdplane->lenx, nc->tcache.cellpixx, nc->stdplane->lenx, nc->tcache.cellpixx,
bprefix(nc->stats.fbbytes, 1, prefixbuf, 0), sizeof(nccell), bprefix(nc->stats.fbbytes, 1, prefixbuf, 0), sizeof(nccell),
nc->tcache.colors, nc->tcache.RGBflag ? "+RGB" : ""); nc->tcache.colors);
}else{ }else{
printf("\n %d rows %d cols (%sB) %zuB cells %d colors%s\n", printf("\n %d rows %d cols (%sB) %zuB cells %d colors",
nc->stdplane->leny, nc->stdplane->lenx, nc->stdplane->leny, nc->stdplane->lenx,
bprefix(nc->stats.fbbytes, 1, prefixbuf, 0), sizeof(nccell), bprefix(nc->stats.fbbytes, 1, prefixbuf, 0), sizeof(nccell),
nc->tcache.colors, nc->tcache.RGBflag ? "+RGB" : ""); nc->tcache.colors);
} }
printf(" compiled with gcc-%s, %s-endian\n" if(nc->tcache.RGBflag){
putc('+', stdout);
term_fg_rgb8(true, nc->tcache.setaf, nc->tcache.colors, stdout, 0xc0, 0x80, 0x80);
putc('R', stdout);
term_fg_rgb8(true, nc->tcache.setaf, nc->tcache.colors, stdout, 0x80, 0xc0, 0x80);
putc('G', stdout);
term_fg_rgb8(true, nc->tcache.setaf, nc->tcache.colors, stdout, 0x80, 0x80, 0xc0);
putc('B', stdout);
term_fg_palindex(nc, stdout, nc->tcache.colors <= 256 ? 12 % nc->tcache.colors : 0x2080e0);
}
printf("\n compiled with gcc-%s, %s-endian\n"
" terminfo from %s\n", " terminfo from %s\n",
__VERSION__, __VERSION__,
#ifdef __BYTE_ORDER__ #ifdef __BYTE_ORDER__

@ -774,9 +774,8 @@ term_bg_rgb8(bool RGBflag, const char* setab, int colors, FILE* out,
return 0; return 0;
} }
static inline int int term_fg_rgb8(bool RGBflag, const char* setaf, int colors, FILE* out,
term_fg_rgb8(bool RGBflag, const char* setaf, int colors, FILE* out, unsigned r, unsigned g, unsigned b){
unsigned r, unsigned g, unsigned b){
// We typically want to use tputs() and tiperm() to acquire and write the // We typically want to use tputs() and tiperm() to acquire and write the
// escapes, as these take into account terminal-specific delays, padding, // escapes, as these take into account terminal-specific delays, padding,
// etc. For the case of DirectColor, there is no suitable terminfo entry, but // etc. For the case of DirectColor, there is no suitable terminfo entry, but

Loading…
Cancel
Save