implement superplane (NCSCALE_NONE) #168

pull/193/head
nick black 5 years ago committed by Nick Black
parent 3cfe88ee0c
commit f3f43528f7

@ -112,12 +112,17 @@ AVFrame* ncvisual_decode(struct ncvisual* nc, int* averr){
#define IMGALLOCALIGN 32 #define IMGALLOCALIGN 32
if(nc->ncp == NULL){ // create plane if(nc->ncp == NULL){ // create plane
int rows, cols; int rows, cols;
notcurses_term_dim_yx(nc->ncobj, &rows, &cols); if(nc->style == NCSCALE_NONE){
if(nc->placey >= rows || nc->placex >= cols){ rows = nc->frame->height / 2;
return NULL; cols = nc->frame->width;
}else{ // FIXME differentiate between scale/stretch
notcurses_term_dim_yx(nc->ncobj, &rows, &cols);
if(nc->placey >= rows || nc->placex >= cols){
return NULL;
}
rows -= nc->placey;
cols -= nc->placex;
} }
rows -= nc->placey;
cols -= nc->placex;
nc->dstwidth = cols; nc->dstwidth = cols;
nc->dstheight = rows * 2; nc->dstheight = rows * 2;
nc->ncp = notcurses_newplane(nc->ncobj, rows, cols, nc->placey, nc->placex, nc); nc->ncp = notcurses_newplane(nc->ncobj, rows, cols, nc->placey, nc->placex, nc);
@ -265,5 +270,6 @@ ncvisual* ncvisual_open_plane(notcurses* nc, const char* filename,
ncv->placex = x; ncv->placex = x;
ncv->style = style; ncv->style = style;
ncv->ncobj = nc; ncv->ncobj = nc;
ncv->ncp = NULL;
return ncv; return ncv;
} }

Loading…
Cancel
Save