From d37a3934d1deee8955b5db3ebc9b9bb0b532f2b7 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 17 May 2020 06:08:59 -0400 Subject: [PATCH] normal-demo: get a nice scroll-opening --- src/demo/normal.c | 10 +++++++--- src/lib/fill.c | 2 -- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/demo/normal.c b/src/demo/normal.c index 3048d3b5a..f8492ffce 100644 --- a/src/demo/normal.c +++ b/src/demo/normal.c @@ -44,7 +44,9 @@ int normal_demo(struct notcurses* nc){ if(!rgba){ goto err; } - memset(rgba, 0, sizeof(*rgba) * dy * dx); + for(int off = 0 ; off < dy * dx ; ++off){ + rgba[off] = 0xff000000; + } int y; if(dy / VSCALE % 2){ y = dy / VSCALE + 1; @@ -54,6 +56,8 @@ int normal_demo(struct notcurses* nc){ } } } + struct timespec scaled; + timespec_div(&demodelay, dy, &scaled); for(y = 0 ; y < dy / 2 ; ++y){ for(int x = 0 ; x < dx ; ++x){ if(mcell(offset(rgba, dy / 2 - y, x, dx), dy / 2 - y, x, dy, dx)){ @@ -67,11 +71,11 @@ int normal_demo(struct notcurses* nc){ goto err; } DEMO_RENDER(nc); + demo_nanosleep(nc, &scaled); } free(rgba); rgba = NULL; - struct timespec scaled; - timespec_div(&demodelay, 4, &scaled); + timespec_div(&demodelay, 8, &scaled); // we can't resize (and thus can't rotate) the standard plane, so dup it n = ncplane_dup(nstd, NULL); if(n == NULL){ diff --git a/src/lib/fill.c b/src/lib/fill.c index 23a7ead0a..1a4f0209c 100644 --- a/src/lib/fill.c +++ b/src/lib/fill.c @@ -504,9 +504,7 @@ static int rotate_merge(ncplane* n, ncplane* newp){ int dimy, dimx; ncplane_dim_yx(newp, &dimy, &dimx); -fprintf(stderr, "NEWPlen: %d/%d\n", dimy, dimx); int ret = ncplane_resize(n, 0, 0, 0, 0, 0, 0, dimy, dimx); -fprintf(stderr, "nlen: %d/%d\n", ncplane_dim_y(n), ncplane_dim_x(n)); if(ret == 0){ for(int y = 0 ; y < dimy ; ++y){ for(int x = 0 ; x < dimx ; ++x){