From 4d23b6c15e54192ce9d635bbcf564b4922f9a628 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 13 May 2020 03:04:50 -0400 Subject: [PATCH] normal: reenable ncvisual_from_plane() --- src/demo/normal.c | 5 ++--- src/lib/visual.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/demo/normal.c b/src/demo/normal.c index 668810ddf..ff0d1e8e8 100644 --- a/src/demo/normal.c +++ b/src/demo/normal.c @@ -73,8 +73,7 @@ int normal_demo(struct notcurses* nc){ } free(rgba); rgba = NULL; - // FIXME ncvisual_from_plane is failing - /*ncv = ncvisual_from_plane(n, 0, 0, -1, -1); + ncv = ncvisual_from_plane(n, 0, 0, -1, -1); if(!ncv){ goto err; } @@ -86,7 +85,7 @@ int normal_demo(struct notcurses* nc){ goto err; } DEMO_RENDER(nc); - }*/ + } ncvisual_destroy(ncv); ncplane_destroy(n); return 0; diff --git a/src/lib/visual.cpp b/src/lib/visual.cpp index 5e5426b08..9a1db70fe 100644 --- a/src/lib/visual.cpp +++ b/src/lib/visual.cpp @@ -113,6 +113,12 @@ auto ncvisual_from_plane(const ncplane* n, int begy, int begx, int leny, int len } int dimy, dimx; ncplane_dim_yx(n, &dimy, &dimx); + if(lenx == -1){ + lenx = n->lenx - begx; + } + if(leny == -1){ + leny = n->leny - begy; + } auto* ncv = ncvisual_from_rgba(n->nc, rgba, leny, lenx * 4, lenx); if(ncv == nullptr){ free(rgba);