render: fix tricky bug for widestomping

This commit is contained in:
nick black 2020-08-21 13:12:34 -04:00
parent 7560b1b2da
commit 3b00b0c847
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -267,6 +267,9 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
} }
struct crender* crender = &rvec[fbcellidx(absy, dstlenx, absx)]; struct crender* crender = &rvec[fbcellidx(absy, dstlenx, absx)];
cell* targc = &crender->c; cell* targc = &crender->c;
if(cell_wide_right_p(targc)){
continue;
}
const cell* vis = &p->fb[nfbcellidx(p, y, x)]; const cell* vis = &p->fb[nfbcellidx(p, y, x)];
// if we never loaded any content into the cell (or obliterated it by // if we never loaded any content into the cell (or obliterated it by
// writing in a zero), use the plane's base cell. // writing in a zero), use the plane's base cell.
@ -280,7 +283,7 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
// from cells underneath us. // from cells underneath us.
if(!crender->p){ if(!crender->p){
// if the following is true, we're a real glyph, and not the right-hand // if the following is true, we're a real glyph, and not the right-hand
// side of a wide glyph (or the null codepoint). // side of a wide glyph (nor the null codepoint).
if( (targc->gcluster = vis->gcluster) ){ // index copy only if( (targc->gcluster = vis->gcluster) ){ // index copy only
// we can't plop down a wide glyph if the next cell is beyond the // we can't plop down a wide glyph if the next cell is beyond the
// screen, nor if we're bisected by a higher plane. // screen, nor if we're bisected by a higher plane.
@ -289,15 +292,20 @@ paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
if(absx >= dstlenx - 1){ if(absx >= dstlenx - 1){
targc->gcluster = ' '; targc->gcluster = ' ';
// is the next cell occupied? if so, 0x20 us // is the next cell occupied? if so, 0x20 us
}else if(targc[1].gcluster){ }else if(crender[1].c.gcluster){
//fprintf(stderr, "NULLING out %d/%d (%d/%d) due to %u\n", y, x, absy, absx, targc[1].gcluster); //fprintf(stderr, "NULLING out %d/%d (%d/%d) due to %u\n", y, x, absy, absx, targc[1].gcluster);
targc->gcluster = ' '; targc->gcluster = ' ';
}else{ }else{
cell_set_wide(targc); cell_set_wide(targc);
}
}
crender->p = p; crender->p = p;
targc->stylemask = vis->stylemask; targc->stylemask = vis->stylemask;
targc[1].gcluster = 0;
cell_set_wide(&crender[1].c);
}
}else{
crender->p = p;
targc->stylemask = vis->stylemask;
}
}else if(cell_wide_left_p(vis)){ }else if(cell_wide_left_p(vis)){
cell_set_wide(targc); cell_set_wide(targc);
} }
@ -385,8 +393,8 @@ fprintf(stderr, "WROTE %u [%s] to %d/%d (%d/%d)\n", targc->gcluster, extended_gc
++prevcell; ++prevcell;
++targc; ++targc;
targc->gcluster = 0; targc->gcluster = 0;
targc->channels = targc[-1].channels; targc->channels = crender[-1].c.channels;
targc->stylemask = targc[-1].stylemask; targc->stylemask = crender[-1].c.stylemask;
if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc)){ if(cellcmp_and_dupfar(pool, prevcell, crender->p, targc)){
crender->damaged = true; crender->damaged = true;
} }
@ -491,7 +499,7 @@ int term_setstyle(FILE* out, unsigned cur, unsigned targ, unsigned stylebit,
} }
// write any escape sequences necessary to set the desired style // write any escape sequences necessary to set the desired style
static inline int static int
term_setstyles(FILE* out, uint32_t* curattr, const cell* c, bool* normalized, term_setstyles(FILE* out, uint32_t* curattr, const cell* c, bool* normalized,
const char* sgr0, const char* sgr, const char* italics, const char* sgr0, const char* sgr, const char* italics,
const char* italoff){ const char* italoff){