[plots] kill bogon duplicate plot plane #2133

pull/2148/head
nick black 3 years ago
parent 953243971d
commit 4dc6b7e826
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1377,8 +1377,8 @@ egc_rtl(const char* egc, int* bytes){
// new, purpose-specific plane. |leny| and |lenx| are output geometry in pixels.
static inline int
plane_blit_sixel(sprixel* spx, fbuf* f, int leny, int lenx,
int parse_start, tament* tam, sprixel_e state){
if(sprixel_load(spx, f, leny, lenx, parse_start, state)){
int parse_start, tament* tam){
if(sprixel_load(spx, f, leny, lenx, parse_start)){
return -1;
}
ncplane* n = spx->n;

@ -36,6 +36,20 @@ typedef struct ncplot {
bool printsample; /* print the most recent sample */
} ncplot;
static inline int
create_pixelp(ncplot *p, ncplane* n){
if(((p->pixelp = ncplane_dup(n, NULL)) == NULL)){
return -1;
}
ncplane_reparent(p->pixelp, n);
ncplane_move_below(p->pixelp, n);
uint64_t basechan = 0;
ncchannels_set_bg_alpha(&basechan, NCALPHA_TRANSPARENT);
ncchannels_set_fg_alpha(&basechan, NCALPHA_TRANSPARENT);
ncplane_set_base(n, "", 0, basechan);
return 0;
}
#define MAXWIDTH 2
#define CREATE(T, X) \
typedef struct nc##X##plot { \
@ -477,6 +491,12 @@ create_##T(nc##X##plot* ncpp, ncplane* n, const ncplot_options* opts, const T mi
} \
ncpp->plot.slotstart = 0; \
ncpp->plot.slotx = 0; \
if(bset->geom == NCBLIT_PIXEL){ \
if(create_pixelp(&ncpp->plot, n)){ \
nc##X##plot_destroy(ncpp); \
return NULL; \
} \
} \
redraw_plot_##T(ncpp); \
return bset; \
} \
@ -618,20 +638,6 @@ update_sample_double(ncdplot* ncp, int64_t x, double y, bool reset){
}
}
static inline int
create_pixelp(ncplot *p, ncplane* n){
if(((p->pixelp = ncplane_dup(n, NULL)) == NULL)){
return -1;
}
ncplane_reparent(p->pixelp, n);
ncplane_move_below(p->pixelp, n);
uint64_t basechan = 0;
ncchannels_set_bg_alpha(&basechan, NCALPHA_TRANSPARENT);
ncchannels_set_fg_alpha(&basechan, NCALPHA_TRANSPARENT);
ncplane_set_base(n, "", 0, basechan);
return 0;
}
// takes ownership of n on all paths
ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy){
ncuplot* ret = malloc(sizeof(*ret));
@ -645,12 +651,6 @@ ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, u
free(ret);
return NULL;
}
if(bset->geom == NCBLIT_PIXEL){
if(create_pixelp(&ret->plot, n)){
ncuplot_destroy(ret);
return NULL;
}
}
return ret;
}
@ -694,12 +694,6 @@ ncdplot* ncdplot_create(ncplane* n, const ncplot_options* opts, double miny, dou
free(ret);
return NULL;
}
if(bset->geom == NCBLIT_PIXEL){
if(create_pixelp(&ret->plot, n)){
ncdplot_destroy(ret);
return NULL;
}
}
return ret;
}

@ -201,6 +201,8 @@ int fbcon_blit(struct ncplane* nc, int linesize, const void* data,
int leny, int lenx, const struct blitterargs* bargs);
int fbcon_draw(const tinfo* ti, sprixel* s, int y, int x);
void fbcon_scroll(const struct ncpile* p, tinfo* ti, int rows);
int sprixel_load(sprixel* spx, fbuf* f, int pixy, int pixx,
int parse_start);
typedef enum {
// C=1 (disabling scrolling) was only introduced in 0.20.0, at the same

Loading…
Cancel
Save