diff --git a/src/lib/direct.c b/src/lib/direct.c index 0951deb31..23a97485a 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -1214,4 +1214,22 @@ ncdirectv* ncdirectf_render(ncdirect* n, ncdirectf* frame, int ncdirectf_geom(ncdirect* n, ncdirectf* frame, ncblitter_e* blitter, ncscale_e scale, int maxy, int maxx, ncvgeom* geom){ + struct ncvisual_options vopts = { + .blitter = blitter ? *blitter : NCBLIT_DEFAULT, + .scaling = scale, + .leny = maxy, + .lenx = maxx, + }; + geom->cdimy = n->tcache.cellpixy; + geom->cdimx = n->tcache.cellpixx; + geom->maxpixely = n->tcache.sixel_maxy; + geom->maxpixelx = n->tcache.sixel_maxx; + const struct blitset* bset; + int r = ncvisual_blitset_geom(NULL, frame, &vopts, &geom->pixy, &geom->pixx, + &geom->scaley, &geom->scalex, + &geom->rpixy, &geom->rpixx, &bset); + if(r == 0 && blitter){ + *blitter = bset->geom; + } + return r; } diff --git a/src/lib/internal.h b/src/lib/internal.h index e6745ce0a..f0b8fbf08 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -661,6 +661,11 @@ struct blitset { #include "blitset.h" +int ncvisual_blitset_geom(const notcurses* nc, const struct ncvisual* n, + const struct ncvisual_options* vopts, + int* y, int* x, int* scaley, int* scalex, + int* leny, int* lenx, const struct blitset** blitter); + static inline int ncfputs(const char* ext, FILE* out){ int r; diff --git a/src/lib/visual.c b/src/lib/visual.c index 8b4bf338d..cfafa59bd 100644 --- a/src/lib/visual.c +++ b/src/lib/visual.c @@ -78,11 +78,10 @@ ncvisual_origin(const struct ncvisual_options* vopts, int* restrict begy, int* r // FIXME we ought also do the output calculations here (how many rows x cols, // given the input plane vopts->n and scaling vopts->scaling)--but do not // perform any actual scaling, nor create any planes! -static int -ncvisual_blitset_geom(const notcurses* nc, const ncvisual* n, - const struct ncvisual_options* vopts, - int* y, int* x, int* scaley, int* scalex, - int* leny, int* lenx, const struct blitset** blitter){ +int ncvisual_blitset_geom(const notcurses* nc, const ncvisual* n, + const struct ncvisual_options* vopts, + int* y, int* x, int* scaley, int* scalex, + int* leny, int* lenx, const struct blitset** blitter){ int fakeleny, fakelenx; if(leny == NULL){ leny = &fakeleny;