From d80df651b36ed2dfdeabb716e4088691d6ff1110 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 10 May 2021 01:20:59 -0400 Subject: [PATCH] textplay: expose more of the source material --- src/lib/visual.c | 4 ++-- src/poc/textplay.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/visual.c b/src/lib/visual.c index b600db3d8..8b4bf338d 100644 --- a/src/lib/visual.c +++ b/src/lib/visual.c @@ -570,7 +570,7 @@ ncvisual* ncvisual_from_bgra(const void* bgra, int rows, int rowstride, int cols // by the end, disprows/dispcols refer to the number of source rows/cols (in // pixels), which will be mapped to a region of cells scaled by the encodings). // the blit will begin at placey/placex (in terms of cells). begy/begx define -// the origin of the source region to draw (in pixels). leny/lenx defined the +// the origin of the source region to draw (in pixels). leny/lenx define the // geometry of the source region to draw, again in pixels. ncv->pixy and // ncv->pixx define the source geometry in pixels. ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitset* bset, @@ -749,7 +749,7 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits //fprintf(stderr, "INPUT N: %p rows: %d cols: %d 0x%016lx\n", n ? n : NULL, disppixy, disppixx, flags); if(n == NULL || (flags & NCVISUAL_OPTION_CHILDPLANE)){ // create plane if(n == NULL){ - n = notcurses_stdplane(nc); // FIXME ought allow arbitrary plane + n = notcurses_stdplane(nc); } if((createdn = make_sprixel_plane(nc, n, ncv, scaling, &disppixy, &disppixx, flags, &outy, &placey, &placex)) == NULL){ diff --git a/src/poc/textplay.c b/src/poc/textplay.c index ebcf9460f..d2bd134be 100644 --- a/src/poc/textplay.c +++ b/src/poc/textplay.c @@ -4,15 +4,15 @@ static const uint32_t LOWCOLOR = 0x004080; static const uint32_t HICOLOR = 0xddffdd; static const uint32_t NANOSEC = 1000000000ull / 60; // 60 cps -#define MARGIN 4 +#define MARGIN 2 static struct notcurses* init(void){ struct notcurses_options opts = { //.loglevel = NCLOGLEVEL_DEBUG, - .margin_t = MARGIN, + .margin_t = MARGIN / 2, .margin_r = MARGIN, - .margin_b = MARGIN, + .margin_b = MARGIN / 2, .margin_l = MARGIN, }; struct notcurses* nc = notcurses_init(&opts, stdout); @@ -108,7 +108,7 @@ textplay(struct notcurses* nc, struct ncplane* tplane, struct ncvisual* ncv){ if(!ncv){ clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL); }else{ - for(int i = 0 ; i < 3 ; ++i){ + for(int i = 0 ; i < 2 ; ++i){ ncvisual_decode(ncv); } } @@ -127,10 +127,10 @@ textplane(struct notcurses* nc){ int dimy, dimx; struct ncplane* stdn = notcurses_stddim_yx(nc, &dimy, &dimx); struct ncplane_options nopts = { - .y = MARGIN, - .x = MARGIN * 2, - .rows = dimy - MARGIN * 2, - .cols = dimx - MARGIN * 4, + .y = MARGIN * 2 + 2, + .x = MARGIN * 4 + 2, + .rows = dimy - MARGIN * 4, + .cols = dimx - MARGIN * 8, .name = "text", }; struct ncplane* n = ncplane_create(stdn, &nopts);