[bitmap] proper parameters for tacache TAM2 #1495

pull/1499/head
nick black 3 years ago
parent ad3322e4db
commit 89734a2dc7
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1220,7 +1220,7 @@ egc_rtl(const char* egc, int* bytes){
// a reference to the context-wide sprixel cache. this ought be an entirely
// new, purpose-specific plane.
static inline int
plane_blit_sixel(sprixel* spx, char* s, int bytes,
plane_blit_sixel(sprixel* spx, char* s, int bytes, int rows, int cols,
int placey, int placex, int leny, int lenx,
int parse_start, sprixcell_e* tacache){
if(sprixel_load(spx, s, bytes, placey, placex, leny, lenx, parse_start)){
@ -1228,17 +1228,18 @@ plane_blit_sixel(sprixel* spx, char* s, int bytes,
}
ncplane* n = spx->n;
uint32_t gcluster = htole(0x02000000ul) + htole(spx->id);
for(int y = placey ; y < placey + leny && y < ncplane_dim_y(n) ; ++y){
for(int x = placex ; x < placex + lenx && x < ncplane_dim_x(n) ; ++x){
for(int y = placey ; y < placey + rows && y < ncplane_dim_y(n) ; ++y){
for(int x = placex ; x < placex + cols && x < ncplane_dim_x(n) ; ++x){
nccell* c = ncplane_cell_ref_yx(n, y, x);
memcpy(&c->gcluster, &gcluster, sizeof(gcluster));
c->width = lenx;
c->width = cols;
}
}
if(n){
//fprintf(stderr, "TACACHE WAS: %p NOW: %p size: %d/%d\n", n->tacache, tacache, rows, cols);
n->tacache = tacache;
n->tacachey = leny;
n->tacachex = lenx;
n->tacachey = rows;
n->tacachex = cols;
n->sprite = spx;
}
return 0;

@ -334,7 +334,7 @@ int kitty_blit(ncplane* n, int linesize, const void* data,
return -1;
}
// take ownership of |buf| and |tacache| on success
if(plane_blit_sixel(bargs->u.pixel.spx, buf, size,
if(plane_blit_sixel(bargs->u.pixel.spx, buf, size, rows, cols,
bargs->placey, bargs->placex,
leny, lenx, parse_start, tacache) < 0){
if(!reuse){

@ -386,7 +386,7 @@ write_sixel_data(FILE* fp, int lenx, sixeltable* stab, int* parse_start){
// stacks. There is also a RLE component, handled in rasterization.
// A pixel block is indicated by setting cell_pixels_p().
static inline int
sixel_blit_inner(int leny, int lenx, sixeltable* stab,
sixel_blit_inner(int leny, int lenx, sixeltable* stab, int rows, int cols,
const blitterargs* bargs, sprixcell_e* tacache){
char* buf = NULL;
size_t size = 0;
@ -401,7 +401,7 @@ sixel_blit_inner(int leny, int lenx, sixeltable* stab,
return -1;
}
// take ownership of buf on success
if(plane_blit_sixel(bargs->u.pixel.spx, buf, size,
if(plane_blit_sixel(bargs->u.pixel.spx, buf, size, rows, cols,
bargs->placey, bargs->placex,
leny, lenx, parse_start, tacache) < 0){
free(buf);
@ -444,7 +444,7 @@ int sixel_blit(ncplane* n, int linesize, const void* data,
// if we have a sprixel attached to this plane, see if we can reuse it
// (we need the same dimensions) and thus immediately apply its T-A table.
if(n->tacache){
//fprintf(stderr, "OUGHT BE A REUSE %d %d %d %d\n", n->tacachey, rows, n->tacachex, cols);
//fprintf(stderr, "IT'S A REUSE %d %d %d %d\n", n->tacachey, rows, n->tacachex, cols);
if(n->tacachey == rows && n->tacachex == cols){
tacache = n->tacache;
reuse = true;
@ -469,7 +469,7 @@ int sixel_blit(ncplane* n, int linesize, const void* data,
return -1;
}
refine_color_table(data, linesize, bargs->begy, bargs->begx, leny, lenx, &stable);
int r = sixel_blit_inner(leny, lenx, &stable, bargs, tacache);
int r = sixel_blit_inner(leny, lenx, &stable, rows, cols, bargs, tacache);
free(stable.data);
free(stable.deets);
free(stable.table);

@ -124,6 +124,7 @@ int sprite_wipe_cell(const notcurses* nc, sprixel* s, int ycell, int xcell){
// mark the cell as annihilated whether we actually scrubbed it or not,
// so that we use this fact should we move to another frame
s->n->tacache[s->dimx * ycell + xcell] = SPRIXCELL_ANNIHILATED;
//fprintf(stderr, "ANNIHILATED %p %d\n", s->n->tacache, s->dimx * ycell + xcell);
if(!nc->tcache.pixel_cell_wipe){ // sixel has no cell wiping
return -1;
}

@ -678,6 +678,7 @@ ncplane* ncvisual_render(notcurses* nc, ncvisual* ncv, const struct ncvisual_opt
int placex = vopts ? vopts->x : 0;
//fprintf(stderr, "beg/len: %d %d %d %d place: %d/%d scale: %d/%d\n", begy, leny, begx, lenx, placey, placex, encoding_y_scale(&nc->tcache, bset), encoding_x_scale(&nc->tcache, bset));
ncplane* n = (vopts ? vopts->n : NULL);
//fprintf(stderr, "%p tacache: %p\n", n, n->tacache);
ncscale_e scaling = vopts ? vopts->scaling : NCSCALE_NONE;
if(bset->geom != NCBLIT_PIXEL){
n = ncvisual_render_cells(nc, ncv, bset, placey, placex, begy, begx, leny, lenx,

Loading…
Cancel
Save