mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
general foreground elision #131
This commit is contained in:
parent
5b322add56
commit
e9890eefc0
@ -1339,7 +1339,7 @@ API const char* cell_extended_gcluster(const struct ncplane* n, const cell* c);
|
|||||||
// FIXME do this at cell prep time and set a bit in the channels
|
// FIXME do this at cell prep time and set a bit in the channels
|
||||||
static inline bool
|
static inline bool
|
||||||
cell_noforeground_p(const cell* c){
|
cell_noforeground_p(const cell* c){
|
||||||
return cell_simple_p(c) || isspace(c->gcluster);
|
return cell_simple_p(c) && isspace(c->gcluster);
|
||||||
}
|
}
|
||||||
|
|
||||||
// True if the cell does not generate background pixels. Only the FULL BLOCK
|
// True if the cell does not generate background pixels. Only the FULL BLOCK
|
||||||
|
@ -540,7 +540,6 @@ notcurses_render_internal(notcurses* nc){
|
|||||||
// * we are a no-foreground glyph, and the previous was default background, or
|
// * we are a no-foreground glyph, and the previous was default background, or
|
||||||
// * we are a no-background glyph, and the previous was default foreground
|
// * we are a no-background glyph, and the previous was default foreground
|
||||||
|
|
||||||
// FIXME move these into the cell bits
|
|
||||||
bool noforeground = cell_noforeground_p(&c);
|
bool noforeground = cell_noforeground_p(&c);
|
||||||
bool nobackground = cell_nobackground_p(p, &c);
|
bool nobackground = cell_nobackground_p(p, &c);
|
||||||
if((!noforeground && cell_fg_default_p(&c)) || (!nobackground && cell_bg_default_p(&c))){
|
if((!noforeground && cell_fg_default_p(&c)) || (!nobackground && cell_bg_default_p(&c))){
|
||||||
@ -560,7 +559,8 @@ notcurses_render_internal(notcurses* nc){
|
|||||||
// foreground set iff either:
|
// foreground set iff either:
|
||||||
// * the previous was non-default, and matches what we have now, or
|
// * the previous was non-default, and matches what we have now, or
|
||||||
// * we are a no-foreground glyph (iswspace() is true)
|
// * we are a no-foreground glyph (iswspace() is true)
|
||||||
if(/*!noforeground &&*/ !cell_fg_default_p(&c)){
|
if(!cell_fg_default_p(&c)){
|
||||||
|
if(!noforeground){
|
||||||
cell_get_fg_rgb(&c, &r, &g, &b);
|
cell_get_fg_rgb(&c, &r, &g, &b);
|
||||||
if(nc->rstate.fgelidable && nc->rstate.lastr == r && nc->rstate.lastg == g && nc->rstate.lastb == b){
|
if(nc->rstate.fgelidable && nc->rstate.lastr == r && nc->rstate.lastg == g && nc->rstate.lastb == b){
|
||||||
++nc->stats.fgelisions;
|
++nc->stats.fgelisions;
|
||||||
@ -571,8 +571,12 @@ notcurses_render_internal(notcurses* nc){
|
|||||||
}
|
}
|
||||||
nc->rstate.lastr = r; nc->rstate.lastg = g; nc->rstate.lastb = b;
|
nc->rstate.lastr = r; nc->rstate.lastg = g; nc->rstate.lastb = b;
|
||||||
nc->rstate.defaultelidable = false;
|
nc->rstate.defaultelidable = false;
|
||||||
|
}else{
|
||||||
|
++nc->stats.fgelisions;
|
||||||
}
|
}
|
||||||
if(!nobackground && !cell_bg_default_p(&c)){
|
}
|
||||||
|
if(!cell_bg_default_p(&c)){
|
||||||
|
if(!nobackground){
|
||||||
cell_get_bg_rgb(&c, &br, &bg, &bb);
|
cell_get_bg_rgb(&c, &br, &bg, &bb);
|
||||||
if(nc->rstate.bgelidable && nc->rstate.lastbr == br && nc->rstate.lastbg == bg && nc->rstate.lastbb == bb){
|
if(nc->rstate.bgelidable && nc->rstate.lastbr == br && nc->rstate.lastbg == bg && nc->rstate.lastbb == bb){
|
||||||
++nc->stats.bgelisions;
|
++nc->stats.bgelisions;
|
||||||
@ -583,6 +587,9 @@ notcurses_render_internal(notcurses* nc){
|
|||||||
}
|
}
|
||||||
nc->rstate.lastbr = br; nc->rstate.lastbg = bg; nc->rstate.lastbb = bb;
|
nc->rstate.lastbr = br; nc->rstate.lastbg = bg; nc->rstate.lastbb = bb;
|
||||||
nc->rstate.defaultelidable = false;
|
nc->rstate.defaultelidable = false;
|
||||||
|
}else{
|
||||||
|
++nc->stats.bgelisions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// fprintf(stderr, "[%02d/%02d] 0x%02x 0x%02x 0x%02x %p\n", y, x, r, g, b, p);
|
// fprintf(stderr, "[%02d/%02d] 0x%02x 0x%02x 0x%02x %p\n", y, x, r, g, b, p);
|
||||||
term_putc(out, p, &c);
|
term_putc(out, p, &c);
|
||||||
|
Loading…
Reference in New Issue
Block a user