[pixel] bypass sprixel planes in paint() #1401

pull/1418/head
nick black 4 years ago committed by Nick Black
parent 486374a6b0
commit ccb02c61b3

@ -256,10 +256,16 @@ cell_extended_p(const nccell* c){
return (htole(c->gcluster) & htole(0xff000000ul)) == htole(0x01000000ul);
}
// Is the cell part of a sprixel?
static inline bool
cell_sprixel_p(const nccell* c){
return (htole(c->gcluster) & htole(0xff000000ul)) == htole(0x02000000ul);
}
// Is the cell simple (a UTF8-encoded EGC of four bytes or fewer)?
static inline bool
cell_simple_p(const nccell* c){
return !cell_extended_p(c);
return !cell_extended_p(c) && !cell_sprixel_p(c);
}
// only applies to complex cells, do not use on simple cells

@ -690,7 +690,7 @@ sprixel* sprixel_create(ncplane* n, const char* s, int bytes);
static inline void
pool_release(egcpool* pool, nccell* c){
if(!cell_simple_p(c)){
if(cell_extended_p(c)){
egcpool_release(pool, cell_egc_idx(c));
}
c->gcluster = 0; // don't subject ourselves to double-release problems
@ -709,7 +709,7 @@ cell_duplicate_far(egcpool* tpool, nccell* targ, const ncplane* splane, const nc
targ->stylemask = c->stylemask;
targ->channels = c->channels;
targ->width = c->width;
if(cell_simple_p(c)){
if(!cell_extended_p(c)){
targ->gcluster = c->gcluster;
return 0;
}
@ -1089,7 +1089,7 @@ plane_blit_sixel(ncplane* n, const char* s, int bytes, int leny, int lenx){
gcluster[0] = 2;
gcluster[1] = spx->id;
gcluster[2] = 0; // FIXME
gcluster[3] = 0; // FIXME
gcluster[3] = 2; // FIXME
for(int y = 0 ; y < leny ; ++y){
for(int x = 0 ; x < lenx ; ++x){
nccell* c = ncplane_cell_ref_yx(n, y, x);

@ -1267,7 +1267,7 @@ int ncplane_base(ncplane* ncp, nccell* c){
}
const char* cell_extended_gcluster(const ncplane* n, const nccell* c){
if(cell_simple_p(c)){
if(!cell_extended_p(c)){
return (const char*)&c->gcluster;
}
return egcpool_extended_gcluster(&n->pool, c);

@ -245,6 +245,9 @@ highcontrast(uint32_t bchannel){
static void
paint(const ncplane* p, struct crender* rvec, int dstleny, int dstlenx,
int dstabsy, int dstabsx){
if(p->sprite){
return;
}
int y, x, dimy, dimx, offy, offx;
ncplane_dim_yx(p, &dimy, &dimx);
offy = p->absy - dstabsy;

Loading…
Cancel
Save