From bd27e056e726c88b362596a8b871fe78f8ef6e2c Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 3 Jan 2020 05:48:59 -0500 Subject: [PATCH] don't ncvisual_decode+stream #246 --- src/demo/eagle.c | 2 ++ src/demo/outro.c | 4 ---- src/demo/sliding.c | 5 +++-- src/demo/xray.c | 3 --- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/demo/eagle.c b/src/demo/eagle.c index ae6147ada..941b9c3d7 100644 --- a/src/demo/eagle.c +++ b/src/demo/eagle.c @@ -60,6 +60,8 @@ zoom_map(struct notcurses* nc, const char* map){ ncvisual_destroy(ncv); return NULL; } + // don't actually display--we only call this to free up the ncvisual internals + ncvisual_render(ncv, 0, 0, 0, 0); int vheight; int vwidth; ncplane_dim_yx(ncvisual_plane(ncv), &vheight, &vwidth); diff --git a/src/demo/outro.c b/src/demo/outro.c index 62c40a0f5..b960a40b0 100644 --- a/src/demo/outro.c +++ b/src/demo/outro.c @@ -36,10 +36,6 @@ fadethread(void* vnc){ if(ncv == NULL){ return NULL; } - if(ncvisual_decode(ncv, &averr) == NULL){ - ncvisual_destroy(ncv); - return NULL; - } int rows, cols; notcurses_term_dim_yx(nc, &rows, &cols); struct ncplane* apiap = ncplane_new(nc, 1, cols, rows - 1, 0, NULL); diff --git a/src/demo/sliding.c b/src/demo/sliding.c index 33c5df6c3..fe5eac582 100644 --- a/src/demo/sliding.c +++ b/src/demo/sliding.c @@ -178,7 +178,7 @@ int sliding_puzzle_demo(struct notcurses* nc){ const int chunkcount = CHUNKS_VERT * CHUNKS_HORZ; struct ncplane** chunks = malloc(sizeof(*chunks) * chunkcount); if(chunks == NULL){ - return -1; + goto done; } memset(chunks, 0, sizeof(*chunks) * chunkcount); // draw the 72 boxes in a nice color pattern, in order @@ -197,7 +197,7 @@ int sliding_puzzle_demo(struct notcurses* nc){ } // draw a box around the playing area if(draw_bounding_box(n, wastey, wastex, chunky, chunkx)){ - return -1; + goto done; } if(demo_render(nc)){ goto done; @@ -240,6 +240,7 @@ int sliding_puzzle_demo(struct notcurses* nc){ ret = 0; done: + ncvisual_destroy(ncv); for(z = 0 ; z < chunkcount ; ++z){ ncplane_destroy(chunks[z]); } diff --git a/src/demo/xray.c b/src/demo/xray.c index 9b4e6043d..e8cf1d624 100644 --- a/src/demo/xray.c +++ b/src/demo/xray.c @@ -103,9 +103,6 @@ int xray_demo(struct notcurses* nc){ if(ncv == NULL){ return -1; } - if(ncvisual_decode(ncv, &averr) == NULL){ - return -1; - } struct ncplane* newpanel = NULL; ncvisual_stream(nc, ncv, &averr, perframecb, &newpanel); ncvisual_destroy(ncv);