mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 01:29:05 -04:00
[plots] kill bogon duplicate plot plane #2133
This commit is contained in:
parent
953243971d
commit
4dc6b7e826
@ -1377,8 +1377,8 @@ egc_rtl(const char* egc, int* bytes){
|
|||||||
// new, purpose-specific plane. |leny| and |lenx| are output geometry in pixels.
|
// new, purpose-specific plane. |leny| and |lenx| are output geometry in pixels.
|
||||||
static inline int
|
static inline int
|
||||||
plane_blit_sixel(sprixel* spx, fbuf* f, int leny, int lenx,
|
plane_blit_sixel(sprixel* spx, fbuf* f, int leny, int lenx,
|
||||||
int parse_start, tament* tam, sprixel_e state){
|
int parse_start, tament* tam){
|
||||||
if(sprixel_load(spx, f, leny, lenx, parse_start, state)){
|
if(sprixel_load(spx, f, leny, lenx, parse_start)){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ncplane* n = spx->n;
|
ncplane* n = spx->n;
|
||||||
|
@ -36,6 +36,20 @@ typedef struct ncplot {
|
|||||||
bool printsample; /* print the most recent sample */
|
bool printsample; /* print the most recent sample */
|
||||||
} ncplot;
|
} 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 MAXWIDTH 2
|
||||||
#define CREATE(T, X) \
|
#define CREATE(T, X) \
|
||||||
typedef struct nc##X##plot { \
|
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.slotstart = 0; \
|
||||||
ncpp->plot.slotx = 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); \
|
redraw_plot_##T(ncpp); \
|
||||||
return bset; \
|
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
|
// takes ownership of n on all paths
|
||||||
ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy){
|
ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, uint64_t maxy){
|
||||||
ncuplot* ret = malloc(sizeof(*ret));
|
ncuplot* ret = malloc(sizeof(*ret));
|
||||||
@ -645,12 +651,6 @@ ncuplot* ncuplot_create(ncplane* n, const ncplot_options* opts, uint64_t miny, u
|
|||||||
free(ret);
|
free(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(bset->geom == NCBLIT_PIXEL){
|
|
||||||
if(create_pixelp(&ret->plot, n)){
|
|
||||||
ncuplot_destroy(ret);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -694,12 +694,6 @@ ncdplot* ncdplot_create(ncplane* n, const ncplot_options* opts, double miny, dou
|
|||||||
free(ret);
|
free(ret);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(bset->geom == NCBLIT_PIXEL){
|
|
||||||
if(create_pixelp(&ret->plot, n)){
|
|
||||||
ncdplot_destroy(ret);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
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 leny, int lenx, const struct blitterargs* bargs);
|
||||||
int fbcon_draw(const tinfo* ti, sprixel* s, int y, int x);
|
int fbcon_draw(const tinfo* ti, sprixel* s, int y, int x);
|
||||||
void fbcon_scroll(const struct ncpile* p, tinfo* ti, int rows);
|
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 {
|
typedef enum {
|
||||||
// C=1 (disabling scrolling) was only introduced in 0.20.0, at the same
|
// C=1 (disabling scrolling) was only introduced in 0.20.0, at the same
|
||||||
|
Loading…
x
Reference in New Issue
Block a user