view-demo: do both a jpeg and png test

This commit is contained in:
nick black 2019-12-01 21:03:03 -05:00
parent 999f33a2ee
commit 78e1a06661
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -6,24 +6,48 @@ int view_demo(struct notcurses* nc){
int dimy, dimx;
ncplane_dim_yx(ncp, &dimy, &dimx);
int averr;
struct ncvisual* ncv = ncplane_visual_open(ncp, "../tests/dsscaw-purp.png", &averr);
struct ncvisual* ncv = ncplane_visual_open(ncp, "../tests/PurpleDrank.jpg", &averr);
if(ncv == NULL){
return -1;
}
struct AVFrame* frame = ncvisual_decode(ncv, &averr);
if(frame == NULL){
struct ncvisual* ncv2 = ncplane_visual_open(ncp, "../tests/dsscaw-purp.png", &averr);
if(ncv2 == NULL){
ncvisual_destroy(ncv);
return -1;
}
if(ncvisual_decode(ncv, &averr) == NULL){
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
return -1;
}
if(ncvisual_decode(ncv2, &averr) == NULL){
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
return -1;;
}
if(ncvisual_render(ncv)){
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
return -1;
}
if(notcurses_render(nc)){
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
return -1;
}
nanosleep(&demodelay, NULL);
if(ncvisual_render(ncv2)){
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
return -1;
}
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
if(notcurses_render(nc)){
ncvisual_destroy(ncv);
ncvisual_destroy(ncv2);
return -1;
}
nanosleep(&demodelay, NULL);
return 0;
}