ncvisual_render -> ncvisual_blit (core/test) #1462

This commit is contained in:
nick black 2021-10-15 22:58:51 -04:00 committed by nick black
parent eb032cc638
commit be42ff909c
19 changed files with 303 additions and 215 deletions

View File

@ -66,9 +66,9 @@ namespace ncpp
return ncvisual_decode_loop (visual);
}
ncplane* render (const ncvisual_options* vopts) const NOEXCEPT_MAYBE
ncplane* blit (const ncvisual_options* vopts) const NOEXCEPT_MAYBE
{
return error_guard<ncplane*, ncplane*> (ncvisual_render (get_notcurses (), visual, vopts), nullptr);
return error_guard<ncplane*, ncplane*> (ncvisual_blit (get_notcurses (), visual, vopts), nullptr);
}
int stream (const ncvisual_options* vopts, float timescale, ncstreamcb streamer, void *curry = nullptr) const NOEXCEPT_MAYBE

View File

@ -2889,7 +2889,7 @@ API int ncvisual_decode(struct ncvisual* nc)
__attribute__ ((nonnull (1)));
// decode the next frame ala ncvisual_decode(), but if we have reached the end,
// rewind to the first frame of the ncvisual. a subsequent 'ncvisual_render()'
// rewind to the first frame of the ncvisual. a subsequent 'ncvisual_blit()'
// will render the first frame, as if the ncvisual had been closed and reopened.
// the return values remain the same as those of ncvisual_decode().
API int ncvisual_decode_loop(struct ncvisual* nc)
@ -2922,35 +2922,65 @@ API int ncvisual_at_yx(const struct ncvisual* n, int y, int x, uint32_t* pixel)
API int ncvisual_set_yx(const struct ncvisual* n, int y, int x, uint32_t pixel)
__attribute__ ((nonnull (1)));
// Render the decoded frame to the specified ncplane. If one is not provided,
// one will be created, having the exact size necessary to display the visual.
// A subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and
// Render the decoded frame according to the provided options (which may be
// NULL). The plane used for rendering depends on vopts->n and vopts->flags. If
// NCVISUAL_OPTION_CHILDPLANE is set, vopts->n must not be NULL, and the plane
// will always be created as a child of vopts->n. If this flag is not set, and
// vopts->n is NULL, a new plane is created as a child of the standard plane.
// If the flag is not set and vopts->n is not NULL, we render to vopts->n. A
// subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and
// 'leny'. Negative values for 'begy' or 'begx' are an error. It is an error to
// specify any region beyond the boundaries of the frame. Returns the
// (possibly newly-created) plane to which we drew.
// specify any region beyond the boundaries of the frame. Returns the (possibly
// newly-created) plane to which we drew. Pixels may not be blitted to the
// standard plane.
API struct ncplane* ncvisual_render(struct notcurses* nc, struct ncvisual* ncv,
const struct ncvisual_options* vopts)
__attribute__ ((deprecated)) __attribute__ ((nonnull (2)));
// Render the decoded frame according to the provided options (which may be
// NULL). The plane used for rendering depends on vopts->n and vopts->flags.
// If NCVISUAL_OPTION_CHILDPLANE is set, vopts->n must not be NULL, and the
// plane will always be created as a child of vopts->n. If this flag is not
// set, and vopts->n is NULL, a new plane is created as root of a new pile.
// If the flag is not set and vopts->n is not NULL, we render to vopts->n.
// A subregion of the visual can be rendered using 'begx', 'begy', 'lenx', and
// 'leny'. Negative values for 'begy' or 'begx' are an error. It is an error to
// specify any region beyond the boundaries of the frame. Returns the (possibly
// newly-created) plane to which we drew. Pixels may not be blitted to the
// standard plane.
API struct ncplane* ncvisual_blit(struct notcurses* nc, struct ncvisual* ncv,
const struct ncvisual_options* vopts)
__attribute__ ((nonnull (2)));
// Create a new plane as prescribed in opts, either as a child of 'vopts->n',
// or the root of a new pile if 'vopts->n' is NULL (or 'vopts' itself is NULL).
// Blit 'ncv' to the created plane according to 'vopts'. If 'vopts->n' is
// non-NULL, NCVISUAL_OPTION_CHILDPLANE must be supplied.
__attribute__ ((nonnull (1, 2, 3))) static inline struct ncplane*
ncvisualplane_create(struct ncplane* n, const struct ncplane_options* opts,
ncvisualplane_create(struct notcurses* nc, const struct ncplane_options* opts,
struct ncvisual* ncv, struct ncvisual_options* vopts){
if(vopts && vopts->n){ // the whole point is to create a new plane
struct ncplane* newn;
if(vopts && vopts->n){
if(vopts->flags & NCVISUAL_OPTION_CHILDPLANE){
return NULL; // the whole point is to create a new plane
}
newn = ncplane_create(vopts->n, opts);
}else{
newn = ncpile_create(nc, opts);
}
if(newn == NULL){
return NULL;
}
struct ncplane* newn = ncplane_create(n, opts);
if(newn){
struct ncvisual_options v;
if(!vopts){
vopts = &v;
memset(vopts, 0, sizeof(*vopts));
}
vopts->n = newn;
if(ncvisual_render(ncplane_notcurses(n), ncv, vopts) == NULL){
ncplane_destroy(newn);
vopts->n = NULL;
return NULL;
}
struct ncvisual_options v;
if(!vopts){
vopts = &v;
memset(vopts, 0, sizeof(*vopts));
}
vopts->n = newn;
if(ncvisual_blit(nc, ncv, vopts) == NULL){
ncplane_destroy(newn);
vopts->n = NULL;
return NULL;
}
return newn;
}
@ -3022,7 +3052,7 @@ API int ncblit_rgb_loose(const void* data, int linesize,
// The ncpixel API facilitates direct management of the pixels within an
// ncvisual (ncvisuals keep a backing store of 32-bit RGBA pixels, and render
// them down to terminal graphics in ncvisual_render()).
// them down to terminal graphics in ncvisual_blit()).
//
// Per libav, we "store as BGRA on little-endian, and ARGB on big-endian".
// This is an RGBA *byte-order* scheme. libav emits bytes, not words. Those

View File

@ -129,7 +129,7 @@ get_ships(struct notcurses* nc, struct ship* ships, unsigned shipcount){
return -1;
}
int cdimy, cdimx;
ncplane_pixelgeom(notcurses_stdplane(nc), NULL, NULL, &cdimy, &cdimx, NULL, NULL);
ncplane_pixel_geom(notcurses_stdplane(nc), NULL, NULL, &cdimy, &cdimx, NULL, NULL);
if(ncvisual_resize(wmv, cdimy * SHIPHEIGHT, cdimx * SHIPWIDTH)){
ncvisual_destroy(wmv);
return -1;

View File

@ -101,7 +101,7 @@ int dragon_demo(struct notcurses* nc){
.y = 1,
.scaling = NCSCALE_STRETCH,
};
if(ncvisual_render(nc, ncv, &vopts) == NULL){
if(ncvisual_blt(nc, ncv, &vopts) == NULL){
ncvisual_destroy(ncv);
return -1;
}

View File

@ -29,6 +29,8 @@ static int plot_grab_y = -1;
// position of the plot *when grab started*
static int plot_pos_y;
#define FPSHZ 2
#define FPSGRAPH_MAX_COLS 72 // give it some room on each side of an 80-column term
// how many columns for runtime?
@ -585,7 +587,7 @@ int demo_render(struct notcurses* nc){
if(!plot_hidden){
ncplane_move_family_top(ncuplot_plane(plot));
}
uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / NANOSECS_IN_SEC;
uint64_t ns = (timespec_to_ns(&ts) - plottimestart) / (NANOSECS_IN_SEC / FPSHZ);
ncuplot_add_sample(plot, ns, 1);
}
if(menu){
@ -664,7 +666,7 @@ int fpsgraph_init(struct notcurses* nc){
NCPLOT_OPTION_PRINTSAMPLE;
opts.gridtype = NCBLIT_BRAILLE;
opts.legendstyle = NCSTYLE_ITALIC | NCSTYLE_BOLD;
opts.title = "frames per second";
opts.title = "frames per semisecond";
ncchannels_set_fg_rgb8(&opts.minchannels, 0x80, 0x80, 0xff);
ncchannels_set_bg_rgb(&opts.minchannels, 0x201020);
ncchannels_set_bg_alpha(&opts.minchannels, NCALPHA_BLEND);

View File

@ -79,8 +79,8 @@ orcashow(struct notcurses* nc, int dimy, int dimx){
.scaling = NCSCALE_STRETCH,
};
int cellpxy, cellpxx;
ncplane_pixelgeom(notcurses_stdplane_const(nc), NULL, NULL,
&cellpxy, &cellpxx, NULL, NULL);
ncplane_pixel_geom(notcurses_stdplane_const(nc), NULL, NULL,
&cellpxy, &cellpxx, NULL, NULL);
int odimy, odimx, scaley, scalex;
ncvisual_blitter_geom(nc, ncv, &vopts, &odimy, &odimx, &scaley, &scalex, NULL);
// even if we can't do pixel output, we want her the same size as if weu

View File

@ -27,7 +27,7 @@ draw_background(struct notcurses* nc){
// we list all distributions on which notcurses is known to exist
static struct ncselector_item select_items[] = {
#define SITEM(s, l) { s, l, }
#define SITEM(short, long) { short, long, 0, 0, }
SITEM("fbsd", "FreeBSD"),
SITEM("deb", "Debian Unstable Linux"),
SITEM("rpm", "Fedora Rawhide Linux"),

View File

@ -737,7 +737,7 @@ ncdirect_render_visual(ncdirect* n, ncvisual* ncv,
}
ncdv->sprite = bargs.u.pixel.spx;
}
if(ncvisual_blit(ncv, disprows, dispcols, ncdv, bset, &bargs)){
if(ncvisual_blit_internal(ncv, disprows, dispcols, ncdv, bset, &bargs)){
free_plane(ncdv);
return NULL;
}

View File

@ -1004,9 +1004,9 @@ ALLOC char* ncplane_vprintf_prep(const char* format, va_list ap);
// Resize the provided ncvisual to the specified 'rows' x 'cols', but do not
// change the internals of the ncvisual. Uses oframe.
int ncvisual_blit(struct ncvisual* ncv, int rows, int cols,
ncplane* n, const struct blitset* bset,
const blitterargs* bargs);
int ncvisual_blit_internal(struct ncvisual* ncv, int rows, int cols,
ncplane* n, const struct blitset* bset,
const blitterargs* bargs);
static inline int
tty_emit(const char* seq, int fd){

View File

@ -220,7 +220,7 @@ int redraw_pixelplot_##T(nc##X##plot* ncp){ \
.blitter = NCBLIT_PIXEL, \
.flags = NCVISUAL_OPTION_NODEGRADE, \
}; \
if(ncvisual_render(ncplane_notcurses(ncp->plot.ncp), ncv, &vopts) == NULL){ \
if(ncvisual_blit(ncplane_notcurses(ncp->plot.ncp), ncv, &vopts) == NULL){ \
ncvisual_destroy(ncv); \
return -1; \
} \

View File

@ -32,7 +32,7 @@ void ncvisual_printbanner(fbuf* f){
// you need an actual multimedia implementation for functions which work with
// codecs, including ncvisual_decode(), ncvisual_decode_loop(),
// ncvisual_from_file(), ncvisual_stream(), and ncvisual_subtitle().
// ncvisual_from_file(), ncvisual_stream(), and ncvisual_subtitle_plane().
int ncvisual_decode(ncvisual* nc){
if(!visual_implementation.visual_decode){
return -1;
@ -70,13 +70,8 @@ ncplane* ncvisual_subtitle_plane(ncplane* parent, const ncvisual* ncv){
return visual_implementation.visual_subtitle(parent, ncv);
}
char* ncvisual_subtitle(const ncvisual* ncv){
(void)ncv; // FIXME remove for abi3
return NULL;
}
int ncvisual_blit(ncvisual* ncv, int rows, int cols, ncplane* n,
const struct blitset* bset, const blitterargs* barg){
int ncvisual_blit_internal(ncvisual* ncv, int rows, int cols, ncplane* n,
const struct blitset* bset, const blitterargs* barg){
if(!(barg->flags & NCVISUAL_OPTION_NOINTERPOLATE)){
if(visual_implementation.visual_blit){
if(visual_implementation.visual_blit(ncv, rows, cols, n, bset, barg) < 0){
@ -809,14 +804,15 @@ ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitse
ncplane* createdn = NULL;
//fprintf(stderr, "INPUT N: %p\n", n);
if(n == NULL || (flags & NCVISUAL_OPTION_CHILDPLANE)){ // create plane
if(n == NULL){
n = notcurses_stdplane(nc);
}
if(scaling == NCSCALE_NONE || scaling == NCSCALE_NONE_HIRES){
dispcols = lenx;
disprows = leny;
}else{
ncplane_dim_yx(n, &disprows, &dispcols);
if(n == NULL){
ncplane_dim_yx(notcurses_stdplane(nc), &disprows, &dispcols);
}else{
ncplane_dim_yx(n, &disprows, &dispcols);
}
dispcols *= encoding_x_scale(&nc->tcache, bset);
disprows *= encoding_y_scale(&nc->tcache, bset);
if(scaling == NCSCALE_SCALE || scaling == NCSCALE_SCALE_HIRES){
@ -842,7 +838,12 @@ ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitse
if(flags & NCVISUAL_OPTION_VERALIGNED){
nopts.flags |= NCPLANE_OPTION_VERALIGNED;
}
if((n = ncplane_create(n, &nopts)) == NULL){
if(n){
n = ncplane_create(n, &nopts);
}else{
n = ncpile_create(nc, &nopts);
}
if(n == NULL){
return NULL;
}
createdn = n;
@ -887,7 +888,7 @@ ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitse
bargs.flags = flags;
bargs.u.cell.placey = placey;
bargs.u.cell.placex = placex;
if(ncvisual_blit(ncv, disprows, dispcols, n, bset, &bargs)){
if(ncvisual_blit_internal(ncv, disprows, dispcols, n, bset, &bargs)){
ncplane_destroy(createdn);
return NULL;
}
@ -909,7 +910,11 @@ make_sprixel_plane(notcurses* nc, ncplane* parent, ncvisual* ncv,
uint64_t flags, int* outy, int* outx,
int* placey, int* placex, int pxoffy, int pxoffx){
if(scaling != NCSCALE_NONE && scaling != NCSCALE_NONE_HIRES){
ncplane_dim_yx(parent, disppixy, disppixx);
if(parent == NULL){
ncplane_dim_yx(notcurses_stdplane(nc), disppixy, disppixx);
}else{
ncplane_dim_yx(parent, disppixy, disppixx);
}
// FIXME why do we clamp only vertical, not horizontal, here?
if(*placey + *disppixy >= ncplane_dim_y(notcurses_stdplane_const(nc))){
*disppixy = ncplane_dim_y(notcurses_stdplane_const(nc)) - *placey;
@ -948,8 +953,12 @@ make_sprixel_plane(notcurses* nc, ncplane* parent, ncvisual* ncv,
| ((flags & NCVISUAL_OPTION_VERALIGNED) ? NCPLANE_OPTION_VERALIGNED : 0),
};
//fprintf(stderr, "PLACING NEW PLANE: %d/%d @ %d/%d 0x%016lx\n", nopts.rows, nopts.cols, nopts.y, nopts.x, nopts.flags);
// FIXME might need some particular pile
ncplane* n = ncplane_create(parent, &nopts);
ncplane* n;
if(parent == NULL){
n = ncpile_create(nc, &nopts);
}else{
n = ncplane_create(parent, &nopts);
}
if(n == NULL){
return NULL;
}
@ -993,9 +1002,6 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
int disppixy = 0, disppixx = 0, outy = 0, outx = 0;
ncplane* createdn = NULL;
if(n == NULL || (flags & NCVISUAL_OPTION_CHILDPLANE)){ // create plane
if(n == NULL){
n = notcurses_stdplane(nc);
}
if((createdn = make_sprixel_plane(nc, n, ncv, scaling, &disppixy, &disppixx,
flags, &outy, &outx, &placey, &placex,
pxoffy, pxoffx)) == NULL){
@ -1080,7 +1086,7 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
// at this point, disppixy/disppixx are the output geometry (might be larger
// than scaledy/scaledx for sixel), while scaledy/scaledx are the scaled
// geometry. cells occupied are determined based off disppixy/disppixx.
if(ncvisual_blit(ncv, disppixy, disppixx, n, bset, &bargs)){
if(ncvisual_blit_internal(ncv, disppixy, disppixx, n, bset, &bargs)){
ncplane_destroy(createdn);
return NULL;
}
@ -1123,7 +1129,7 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
return n;
}
ncplane* ncvisual_render(notcurses* nc, ncvisual* ncv, const struct ncvisual_options* vopts){
ncplane* ncvisual_blit(notcurses* nc, ncvisual* ncv, const struct ncvisual_options* vopts){
const struct blitset* bset;
int leny, lenx;
if(ncvisual_blitset_geom(nc, &nc->tcache, ncv, vopts, NULL, NULL, NULL, NULL,
@ -1157,6 +1163,23 @@ ncplane* ncvisual_render(notcurses* nc, ncvisual* ncv, const struct ncvisual_opt
return n;
}
// compatability wrapper around ncvisual_blit that provides the standard plane
// plus NCVISUAL_OPTION_CHILDPLANE if vopts->n is NULL.
ncplane* ncvisual_render(notcurses* nc, ncvisual* ncv, const struct ncvisual_options* vopts){
struct ncvisual_options fakevopts;
if(vopts == NULL){
memset(&fakevopts, 0, sizeof(fakevopts));
}else{
memcpy(&fakevopts, vopts, sizeof(fakevopts));
}
vopts = &fakevopts;
if(vopts->n == NULL){
fakevopts.n = notcurses_stdplane(nc);
fakevopts.flags |= NCVISUAL_OPTION_CHILDPLANE;
}
return ncvisual_blit(nc, ncv, vopts);
}
ncvisual* ncvisual_from_plane(const ncplane* n, ncblitter_e blit, int begy, int begx,
int leny, int lenx){
int py, px;
@ -1274,10 +1297,3 @@ bool notcurses_canopen_videos(const notcurses* nc __attribute__ ((unused))){
}
return visual_implementation.canopen_videos;
}
int ncvisual_inflate(ncvisual* n, int scale){
if(scale <= 0){
return -1;
}
return ncvisual_resize_noninterpolative(n, n->pixy * scale, n->pixx * scale);
}

View File

@ -200,7 +200,7 @@ struct ncplane* ffmpeg_subtitle(ncplane* parent, const ncvisual* ncv){
.blitter = NCBLIT_PIXEL,
.scaling = NCSCALE_STRETCH,
};
if(ncvisual_render(nc, v, &vopts) == NULL){
if(ncvisual_blit(nc, v, &vopts) == NULL){
ncplane_destroy(vn);
ncvisual_destroy(v);
return NULL;
@ -501,7 +501,7 @@ int ffmpeg_stream(notcurses* nc, ncvisual* ncv, float timescale,
// was actually rendered with
ncvisual_blitter_geom(nc, ncv, &activevopts, NULL, NULL, NULL, NULL,
&activevopts.blitter);
if((newn = ncvisual_render(nc, ncv, &activevopts)) == NULL){
if((newn = ncvisual_blit(nc, ncv, &activevopts)) == NULL){
if(activevopts.n != vopts->n){
ncplane_destroy(activevopts.n);
}

View File

@ -28,10 +28,11 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
CHECK(0 == ncvisual_resize(ncv, 1, 1));
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
REQUIRE(nullptr != s);
@ -52,9 +53,9 @@ TEST_CASE("Bitmaps") {
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
int maxy, maxx;
ncplane_pixelgeom(n_, nullptr, nullptr, nullptr, nullptr, &maxy, &maxx);
ncplane_pixel_geom(n_, nullptr, nullptr, nullptr, nullptr, &maxy, &maxx);
CHECK(0 == ncvisual_resize(ncv, maxy, maxx));
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nn == n);
auto s = n->sprite;
REQUIRE(nullptr != s);
@ -81,7 +82,7 @@ TEST_CASE("Bitmaps") {
vopts.n = n;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(nullptr == ncvisual_render(nc_, ncv, &vopts));
CHECK(nullptr == ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
CHECK(0 == ncplane_destroy(n));
@ -104,7 +105,7 @@ TEST_CASE("Bitmaps") {
vopts.n = n;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(nullptr == ncvisual_render(nc_, ncv, &vopts));
CHECK(nullptr == ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
CHECK(0 == ncplane_destroy(n));
@ -126,9 +127,10 @@ TEST_CASE("Bitmaps") {
};
auto n = ncplane_create(n_, &nopts);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(nullptr != ncvisual_render(nc_, ncv, &vopts));
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
CHECK(nullptr != ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 > ncplane_putchar_yx(n, ' ', 0, 0));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
@ -143,9 +145,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto botn = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto botn = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != botn);
// should just have a red plane
CHECK(0 == notcurses_render(nc_));
@ -154,7 +157,7 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v2(x * y, htole(0x8142f1ff));
auto ncv2 = ncvisual_from_rgba(v2.data(), y, sizeof(decltype(v2)::value_type) * x, x);
REQUIRE(nullptr != ncv2);
auto topn = ncvisual_render(nc_, ncv2, &vopts);
auto topn = ncvisual_blit(nc_, ncv2, &vopts);
REQUIRE(nullptr != topn);
// should have a yellow plane partially obscuring a red one
CHECK(0 == notcurses_render(nc_));
@ -179,9 +182,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_file(find_data("worldmap.png").get());
REQUIRE(ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto newn = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto newn = ncvisual_blit(nc_, ncv, &vopts);
CHECK(newn);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(newn));
@ -199,9 +203,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
REQUIRE(nullptr != s);
@ -220,18 +225,20 @@ TEST_CASE("Bitmaps") {
auto bigp = ncplane_create(n_, &nopts);
REQUIRE(bigp);
vopts.n = bigp;
vopts.flags &= ~NCVISUAL_OPTION_CHILDPLANE;
uint64_t white = NCCHANNELS_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
ncplane_set_base(bigp, "x", 0, white);
CHECK(vopts.n == ncvisual_render(nc_, ncv, &vopts));
CHECK(vopts.n == ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_resize_noninterpolative(ncv, ncv->pixy * 4, ncv->pixx * 4));
CHECK(4 * nc_->tcache.cellpixy == ncv->pixy);
CHECK(4 * nc_->tcache.cellpixx == ncv->pixx);
vopts.y = 1;
vopts.x = 6;
vopts.n = nullptr;
vopts.n = n_;
vopts.scaling = NCSCALE_NONE;
auto infn = ncvisual_render(nc_, ncv, &vopts);
vopts.flags |= NCVISUAL_OPTION_CHILDPLANE;
auto infn = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(infn);
if(nc_->tcache.sprixel_scale_height == 6){
if(4 * nc_->tcache.cellpixy % 6){
@ -249,7 +256,7 @@ TEST_CASE("Bitmaps") {
CHECK(ncv->pixy == 8);
CHECK(ncv->pixx == 8);
vopts.x = 11;
auto resizen = ncvisual_render(nc_, ncv, &vopts);
auto resizen = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(resizen);
CHECK((8 + nc_->tcache.cellpixy - 1) / nc_->tcache.cellpixy == ncplane_dim_y(resizen));
CHECK((8 + nc_->tcache.cellpixx - 1) / nc_->tcache.cellpixx == ncplane_dim_x(resizen));
@ -272,14 +279,15 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
struct ncplane_options nopts = {
.y = 2,
.x = 0,
.rows = 5,
.rows = 4,
.cols = 4,
.userptr = nullptr, .name = "scale", .resizecb = nullptr,
.flags = 0, .margin_b = 0, .margin_r = 0,
@ -288,14 +296,15 @@ TEST_CASE("Bitmaps") {
REQUIRE(nullptr != nres);
vopts.n = nres;
vopts.scaling = NCSCALE_SCALE;
ncvisual_render(nc_, ncv, &vopts);
ncvisual_blit(nc_, ncv, &vopts);
CHECK(4 == ncplane_dim_x(vopts.n));
CHECK(0 == ncvisual_resize_noninterpolative(ncv, ncv->pixy * 4, ncv->pixx * 4));
vopts.n = nullptr;
vopts.n = nres;
vopts.y = 2;
vopts.x = 5;
vopts.scaling = NCSCALE_NONE;
auto ninf = ncvisual_render(nc_, ncv, &vopts);
auto ninf = ncvisual_blit(nc_, ncv, &vopts);
notcurses_debug(nc_, stderr);
REQUIRE(nullptr != ninf);
CHECK(ncplane_dim_y(nres) == ncplane_dim_y(ninf));
CHECK(ncplane_dim_x(nres) == ncplane_dim_x(ninf));
@ -339,7 +348,7 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xffffffff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
auto child = ncvisual_render(nc_, ncv, &vopts);
auto child = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(child);
CHECK(18 == ncplane_dim_y(child));
CHECK(5 == ncplane_dim_x(child));
@ -382,7 +391,7 @@ TEST_CASE("Bitmaps") {
std::vector<uint32_t> v(x * y, htole(0xffffffff));
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
auto child = ncvisual_render(nc_, ncv, &vopts);
auto child = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(child);
CHECK(6 == ncplane_dim_y(child));
CHECK(1 == ncplane_dim_x(child));
@ -401,9 +410,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
REQUIRE(nullptr != s);
@ -432,9 +442,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
REQUIRE(nullptr != s);
@ -463,9 +474,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto s = n->sprite;
REQUIRE(nullptr != s);
@ -502,9 +514,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
ncvisual_destroy(ncv);
CHECK(0 == notcurses_render(nc_));
@ -561,10 +574,11 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_file(find_data("worldmap.png").get());
REQUIRE(ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
vopts.scaling = NCSCALE_STRETCH;
auto newn = ncvisual_render(nc_, ncv, &vopts);
auto newn = ncvisual_blit(nc_, ncv, &vopts);
CHECK(newn);
ncplane_move_bottom(newn);
CHECK(0 == notcurses_render(nc_));
@ -592,9 +606,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
for(int i = 0 ; i <= ncplane_dim_x(n_) ; ++i){
CHECK(0 == ncplane_move_yx(n, 0, i));
@ -612,10 +627,11 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
vopts.x = ncplane_dim_x(n_) - 3;
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
for(int i = ncplane_dim_x(n_) - 3 ; i >= 0 ; --i){
CHECK(0 == ncplane_move_yx(n, 0, i));
@ -633,9 +649,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
for(int i = 0 ; i <= ncplane_dim_y(n_) ; ++i){
CHECK(0 == ncplane_move_yx(n, i, 0));
@ -653,10 +670,11 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
vopts.y = ncplane_dim_y(n_) - 3;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
for(int i = ncplane_dim_y(n_) - 3 ; i >= 0 ; --i){
CHECK(0 == ncplane_move_yx(n, i, 0));
@ -675,9 +693,10 @@ TEST_CASE("Bitmaps") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto n = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
auto xpx = (ncplane_dim_x(n_) - 2) * nc_->tcache.cellpixx;
auto ypx = (ncplane_dim_y(n_) - 2) * nc_->tcache.cellpixy;
@ -689,10 +708,8 @@ TEST_CASE("Bitmaps") {
vopts.y = yat / nc_->tcache.cellpixy;
vopts.pxoffy = yat % nc_->tcache.cellpixy;
CHECK(0 == ncplane_destroy(n));
n = ncvisual_render(nc_, ncv, &vopts);
// FIXME disabled REQUIRE until sixel works
// FIXME REQUIRE(nullptr != n);
WARN(nullptr != n);
n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);

View File

@ -123,7 +123,9 @@ TEST_CASE("Blit") {
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_2x2;
auto ncp = ncvisual_render(nc_, ncv, &vopts);
vopts.n = n_;
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto ncp = ncvisual_blit(nc_, ncv, &vopts);
ncvisual_destroy(ncv);
REQUIRE(nullptr != ncp);
CHECK(0 == notcurses_render(nc_));
@ -149,7 +151,9 @@ TEST_CASE("Blit") {
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_1x1;
auto p = ncvisual_render(nc_, ncv, &vopts);
vopts.n = n_;
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(1 == ncplane_dim_y(p));
@ -175,7 +179,9 @@ TEST_CASE("Blit") {
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_2x1;
auto p = ncvisual_render(nc_, ncv, &vopts);
vopts.n = n_;
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(1 == ncplane_dim_y(p));
CHECK(4 == ncplane_dim_x(p));
@ -218,7 +224,9 @@ TEST_CASE("Blit") {
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts{};
vopts.blitter = NCBLIT_2x2;
auto p = ncvisual_render(nc_, ncv, &vopts);
vopts.n = n_;
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(1 == ncplane_dim_y(p));
CHECK(16 == ncplane_dim_x(p));

View File

@ -28,21 +28,23 @@ TEST_CASE("Media") {
struct ncvisual_options vopts{};
vopts.x = NCALIGN_CENTER;
vopts.y = NCALIGN_CENTER;
vopts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED;
auto p = ncvisual_render(nc_, ncv, &vopts);
vopts.n = n_;
vopts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED
| NCVISUAL_OPTION_CHILDPLANE;
auto p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
CHECK(0 == ncvisual_resize(ncv, 20, 20));
p = ncvisual_render(nc_, ncv, &vopts);
p = ncvisual_blit(nc_, ncv, &vopts);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
p = ncvisual_render(nc_, ncv, &vopts);
p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
p = ncvisual_render(nc_, ncv, &vopts);
p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
@ -58,7 +60,10 @@ TEST_CASE("Media") {
CHECK(dimx == frame->width); FIXME */
struct ncvisual_options opts{};
opts.scaling = NCSCALE_STRETCH;
auto newn = ncvisual_render(nc_, ncv, &opts);
opts.n = n_;
opts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED
| NCVISUAL_OPTION_CHILDPLANE;
auto newn = ncvisual_blit(nc_, ncv, &opts);
CHECK(newn);
CHECK(0 == notcurses_render(nc_));
CHECK(1 == ncvisual_decode(ncv));
@ -76,7 +81,7 @@ TEST_CASE("Media") {
struct ncvisual_options opts{};
opts.scaling = NCSCALE_STRETCH;
opts.n = ncp_;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(1 == ncvisual_decode(ncv));
ncvisual_destroy(ncv);
@ -91,13 +96,13 @@ TEST_CASE("Media") {
struct ncvisual_options opts{};
opts.n = ncp_;
CHECK(0 == ncvisual_blitter_geom(nc_, ncv, &opts, &odimy, &odimx, nullptr, nullptr, nullptr));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_resize_noninterpolative(ncv, ncv->pixy * 2, ncv->pixx * 2));
CHECK(0 == ncvisual_blitter_geom(nc_, ncv, &opts, &ndimy, &ndimx, nullptr, nullptr, nullptr));
CHECK(ndimy == odimy * 2);
CHECK(ndimx == odimx * 2);
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
}
@ -110,7 +115,7 @@ TEST_CASE("Media") {
struct ncvisual_options opts{};
opts.n = ncp_;
opts.scaling = NCSCALE_STRETCH;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
void* needle = malloc(1);
REQUIRE(nullptr != needle);
struct ncplane* newn = ncplane_dup(ncp_, needle);
@ -142,7 +147,7 @@ TEST_CASE("Media") {
opts.scaling = NCSCALE_SCALE_HIRES;
opts.n = ncp_;
opts.blitter = NCBLIT_1x1;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -165,7 +170,7 @@ TEST_CASE("Media") {
opts.scaling = NCSCALE_SCALE_HIRES;
opts.n = ncp_;
opts.blitter = NCBLIT_2x1;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -189,7 +194,7 @@ TEST_CASE("Media") {
opts.scaling = NCSCALE_SCALE_HIRES;
opts.n = ncp_;
opts.blitter = NCBLIT_2x2;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -212,7 +217,7 @@ TEST_CASE("Media") {
opts.scaling = NCSCALE_SCALE_HIRES;
opts.n = ncp_;
opts.blitter = NCBLIT_3x2;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -235,7 +240,7 @@ TEST_CASE("Media") {
opts.scaling = NCSCALE_SCALE_HIRES;
opts.n = ncp_;
opts.blitter = NCBLIT_BRAILLE;
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -261,7 +266,7 @@ TEST_CASE("Media") {
opts.scaling = NCSCALE_SCALE;
opts.blitter = NCBLIT_PIXEL;
opts.n = n;
n = ncvisual_render(nc_, ncv, &opts);
n = ncvisual_blit(nc_, ncv, &opts);
REQUIRE(nullptr != n);
CHECK(0 == notcurses_render(nc_));
}
@ -288,7 +293,7 @@ TEST_CASE("Media") {
struct ncvisual_options opts{};
opts.scaling = NCSCALE_SCALE;
opts.blitter = NCBLIT_PIXEL;
REQUIRE(ncvisual_render(nc_, ncv, &opts));
REQUIRE(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -310,13 +315,13 @@ TEST_CASE("Media") {
CHECK(1 == ret);
ret = ncvisual_decode_loop(ncv);
CHECK(1 == ret);
struct ncplane* ncp = ncvisual_render(nc_, ncv, nullptr);
struct ncplane* ncp = ncvisual_blit(nc_, ncv, nullptr);
CHECK(nullptr != ncp);
CHECK(0 == ncplane_destroy(ncp));
// FIXME verify that it is first frame, not last?
ret = ncvisual_decode_loop(ncv);
CHECK(0 == ret);
ncp = ncvisual_render(nc_, ncv, nullptr);
ncp = ncvisual_blit(nc_, ncv, nullptr);
CHECK(nullptr != ncp);
CHECK(0 == ncplane_destroy(ncp));
ncvisual_destroy(ncv);
@ -334,7 +339,7 @@ TEST_CASE("Media") {
CHECK(dimx == frame->width); FIXME */
struct ncvisual_options opts{};
opts.scaling = NCSCALE_STRETCH;
auto newn = ncvisual_render(nc_, ncv, &opts);
auto newn = ncvisual_blit(nc_, ncv, &opts);
CHECK(newn);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(newn));
@ -363,7 +368,7 @@ TEST_CASE("Media") {
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto ncv = ncvisual_from_file(find_data("onedot.png").get());
REQUIRE(ncv);
auto child = ncvisual_render(nc_, ncv, &vopts);
auto child = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(child);
CHECK(5 == ncplane_dim_y(child));
CHECK(5 == ncplane_dim_x(child));

View File

@ -171,7 +171,9 @@ TEST_CASE("Rotate") {
auto ncv = ncvisual_from_rgba(rgba.data(), height, width * 4, width);
REQUIRE(ncv);
ncvisual_options opts{};
auto rendered = ncvisual_render(nc_, ncv, &opts);
opts.n = n_;
opts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto rendered = ncvisual_blit(nc_, ncv, &opts);
REQUIRE(rendered);
int pxdimy, pxdimx;
uint32_t* rgbaret = ncplane_as_rgba(rendered, NCBLIT_2x1,
@ -207,16 +209,16 @@ TEST_CASE("Rotate") {
opts.n = rendered;
// FIXME check pixels after all rotations
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);
@ -231,7 +233,9 @@ TEST_CASE("Rotate") {
auto ncv = ncvisual_from_rgba(rgba.data(), height, width * 4, width);
REQUIRE(ncv);
ncvisual_options opts{};
auto rendered = ncvisual_render(nc_, ncv, &opts);
opts.n = n_;
opts.flags = NCVISUAL_OPTION_CHILDPLANE;
auto rendered = ncvisual_blit(nc_, ncv, &opts);
REQUIRE(rendered);
int pxdimy, pxdimx;
uint32_t* rgbaret = ncplane_as_rgba(rendered, NCBLIT_2x1,
@ -267,16 +271,16 @@ TEST_CASE("Rotate") {
// FIXME check pixels after all rotations
opts.n = rendered;
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_rotate(ncv, -M_PI / 2));
CHECK(ncvisual_render(nc_, ncv, &opts));
CHECK(ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
}
ncvisual_destroy(ncv);

View File

@ -109,10 +109,10 @@ TEST_CASE("Selectors") {
SUBCASE("PopulatedSelector") {
ncselector_item items[] = {
{ strdup("op1"), strdup("this is option 1"), },
{ strdup("2ndop"), strdup("this is option #2"), },
{ strdup("tres"), strdup("option the third"), },
{ NULL, NULL, },
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
{ strdup("tres"), strdup("option the third"), 0, 0, },
{ NULL, NULL, 0, 0, },
};
struct ncselector_options opts{};
opts.items = items;
@ -164,10 +164,10 @@ TEST_CASE("Selectors") {
SUBCASE("SelectorMovement") {
ncselector_item items[] = {
{ strdup("op1"), strdup("this is option 1"), },
{ strdup("2ndop"), strdup("this is option #2"), },
{ strdup("tres"), strdup("option the third"), },
{ NULL, NULL, },
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
{ strdup("tres"), strdup("option the third"), 0, 0, },
{ NULL, NULL, 0, 0, },
};
struct ncselector_options opts{};
opts.items = items;
@ -210,10 +210,10 @@ TEST_CASE("Selectors") {
// Provide three items, limited to 1 shown at a time
SUBCASE("ScrollingSelectorOne") {
ncselector_item items[] = {
{ strdup("op1"), strdup("this is option 1"), },
{ strdup("2ndop"), strdup("this is option #2"), },
{ strdup("tres"), strdup("option the third"), },
{ NULL, NULL, },
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
{ strdup("tres"), strdup("option the third"), 0, 0, },
{ NULL, NULL, 0, 0, },
};
struct ncselector_options opts{};
opts.maxdisplay = 1;
@ -262,10 +262,10 @@ TEST_CASE("Selectors") {
// Provide three items, limited to 2 shown at a time
SUBCASE("ScrollingSelectorTwo") {
ncselector_item items[] = {
{ strdup("op1"), strdup("this is option 1"), },
{ strdup("2ndop"), strdup("this is option #2"), },
{ strdup("tres"), strdup("option the third"), },
{ NULL, NULL, },
{ strdup("op1"), strdup("this is option 1"), 0, 0, },
{ strdup("2ndop"), strdup("this is option #2"), 0, 0, },
{ strdup("tres"), strdup("option the third"), 0, 0, },
{ NULL, NULL, 0, 0, },
};
struct ncselector_options opts{};
opts.maxdisplay = 2;

View File

@ -162,9 +162,10 @@ TEST_CASE("Sixels") {
auto ncv = ncvisual_from_file(find_data("worldmap.png").get());
REQUIRE(ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto newn = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto newn = ncvisual_blit(nc_, ncv, &vopts);
CHECK(newn);
CHECK(0 == notcurses_render(nc_));
auto rgb = sixel_to_rgb(newn->sprite->glyph.buf, newn->sprite->glyph.used,
@ -184,9 +185,10 @@ TEST_CASE("Sixels") {
auto ncv = ncvisual_from_file(find_data("natasha-blur.png").get());
REQUIRE(ncv);
struct ncvisual_options vopts{};
vopts.n = n_;
vopts.blitter = NCBLIT_PIXEL;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
auto newn = ncvisual_render(nc_, ncv, &vopts);
vopts.flags = NCVISUAL_OPTION_NODEGRADE | NCVISUAL_OPTION_CHILDPLANE;
auto newn = ncvisual_blit(nc_, ncv, &vopts);
CHECK(newn);
auto rgbold = sixel_to_rgb(newn->sprite->glyph.buf, newn->sprite->glyph.used,
newn->sprite->pixy, newn->sprite->pixx);

View File

@ -74,18 +74,20 @@ TEST_CASE("Visual") {
struct ncvisual_options vopts{};
vopts.x = NCALIGN_CENTER;
vopts.y = NCALIGN_CENTER;
vopts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED;
auto p = ncvisual_render(nc_, ncv, &vopts);
vopts.n = n_;
vopts.flags |= NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_VERALIGNED
| NCVISUAL_OPTION_CHILDPLANE;
auto p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
CHECK(0 == ncvisual_resize(ncv, 20, 20));
p = ncvisual_render(nc_, ncv, &vopts);
p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
CHECK(0 == ncvisual_rotate(ncv, M_PI / 2));
p = ncvisual_render(nc_, ncv, &vopts);
p = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != p);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(p));
@ -96,7 +98,7 @@ TEST_CASE("Visual") {
SUBCASE("VisualAligned") {
const uint32_t pixels[4] = { htole(0xffff0000), htole(0xff00ff00), htole(0xff0000ff), htole(0xffffffff) };
ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = NCALIGN_LEFT,
@ -105,13 +107,13 @@ TEST_CASE("Visual") {
.leny = 2,
.lenx = 2,
.blitter = NCBLIT_1x1,
.flags = NCVISUAL_OPTION_HORALIGNED,
.flags = NCVISUAL_OPTION_HORALIGNED | NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncv = ncvisual_from_rgba(pixels, 2, 2 * sizeof(*pixels), 2);
REQUIRE(nullptr != ncv);
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
@ -126,16 +128,17 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(v.data(), y, sizeof(decltype(v)::value_type) * x, x);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = 5, .lenx = 8,
.blitter = NCBLIT_1x1,
.flags = 0, .transcolor = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
CHECK(5 == ncplane_dim_y(n));
CHECK(8 == ncplane_dim_x(n));
@ -152,16 +155,17 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(v.data(), 1, sizeof(decltype(v)::value_type), 1);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_STRETCH,
.y = 0, .x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_1x1,
.flags = 0, .transcolor = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
CHECK(0 == notcurses_render(nc_));
REQUIRE(nullptr != n);
CHECK(dimy == ncplane_dim_y(n));
@ -198,7 +202,7 @@ TEST_CASE("Visual") {
.flags = 0, .transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto n = ncvisual_render(nc_, ncv, &vopts);
auto n = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != n);
CHECK(5 == ncplane_dim_y(n));
CHECK(8 == ncplane_dim_x(n));
@ -222,7 +226,7 @@ TEST_CASE("Visual") {
.flags = 0, .transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto newn = ncvisual_render(nc_, ncv, &vopts);
auto newn = ncvisual_blit(nc_, ncv, &vopts);
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncvisual_resize_noninterpolative(ncv, ncv->pixy * 3, ncv->pixx * 3));
CHECK(6 == ncv->pixy);
@ -244,7 +248,7 @@ TEST_CASE("Visual") {
}
}
REQUIRE(newn);
auto enewn = ncvisual_render(nc_, ncv, &vopts);
auto enewn = ncvisual_blit(nc_, ncv, &vopts);
int newy, newx;
ncplane_dim_yx(enewn, &newy, &newx);
CHECK(6 == newy);
@ -265,7 +269,7 @@ TEST_CASE("Visual") {
struct ncvisual_options opts{};
opts.blitter = NCBLIT_1x1;
opts.n = ncp_;
CHECK(ncp_ == ncvisual_render(nc_, ncv, &opts));
CHECK(ncp_ == ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < dimy ; ++y){
for(int x = 0 ; x < dimx ; ++x){
@ -293,7 +297,7 @@ TEST_CASE("Visual") {
struct ncvisual_options opts{};
opts.blitter = NCBLIT_1x1;
opts.n = ncp_;
CHECK(nullptr != ncvisual_render(nc_, ncv, &opts));
CHECK(nullptr != ncvisual_blit(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < dimy ; ++y){
for(int x = 0 ; x < dimx ; ++x){
@ -333,7 +337,7 @@ TEST_CASE("Visual") {
vopts.n = n_;
vopts.blitter = NCBLIT_2x1;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(n_ == ncvisual_render(nc_, ncv, &vopts));
CHECK(n_ == ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < DIMY / 2 ; ++y){
for(int x = 0 ; x < DIMX ; ++x){
@ -373,7 +377,7 @@ TEST_CASE("Visual") {
vopts.n = n_;
vopts.blitter = NCBLIT_2x2;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(n_ == ncvisual_render(nc_, ncv, &vopts));
CHECK(n_ == ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < DIMY / 2 ; ++y){
for(int x = 0 ; x < DIMX / 2 ; ++x){
@ -431,7 +435,7 @@ TEST_CASE("Visual") {
vopts.n = n_;
vopts.blitter = NCBLIT_2x2;
vopts.flags = NCVISUAL_OPTION_NODEGRADE;
CHECK(n_ == ncvisual_render(nc_, ncv, &vopts));
CHECK(n_ == ncvisual_blit(nc_, ncv, &vopts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < DIMY / 2 ; ++y){
for(int x = 0 ; x < DIMX / 2 ; ++x){
@ -471,7 +475,7 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(pixels, 2, 2 * sizeof(*pixels), 2);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
@ -480,11 +484,11 @@ TEST_CASE("Visual") {
.leny = 0,
.lenx = 0,
.blitter = NCBLIT_2x2,
.flags = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
auto ncvp = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
int dimy, dimx;
ncplane_dim_yx(ncvp, &dimy, &dimx);
@ -516,7 +520,7 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
@ -525,11 +529,11 @@ TEST_CASE("Visual") {
.leny = 0,
.lenx = 0,
.blitter = NCBLIT_2x2,
.flags = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
auto ncvp = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
int dimy, dimx;
ncplane_dim_yx(ncvp, &dimy, &dimx);
@ -564,7 +568,7 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
@ -573,11 +577,11 @@ TEST_CASE("Visual") {
.leny = 0,
.lenx = 0,
.blitter = NCBLIT_2x2,
.flags = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
auto ncvp = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
int dimy, dimx;
ncplane_dim_yx(ncvp, &dimy, &dimx);
@ -617,7 +621,7 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
@ -626,11 +630,11 @@ TEST_CASE("Visual") {
.leny = 0,
.lenx = 0,
.blitter = NCBLIT_2x2,
.flags = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
auto ncvp = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
int dimy, dimx;
ncplane_dim_yx(ncvp, &dimy, &dimx);
@ -669,7 +673,7 @@ TEST_CASE("Visual") {
auto ncv = ncvisual_from_rgba(pixels[i], 2, 2 * sizeof(**pixels), 2);
REQUIRE(nullptr != ncv);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
@ -678,11 +682,11 @@ TEST_CASE("Visual") {
.leny = 0,
.lenx = 0,
.blitter = NCBLIT_2x2,
.flags = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
auto ncvp = ncvisual_render(nc_, ncv, &vopts);
auto ncvp = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(nullptr != ncvp);
int dimy, dimx;
ncplane_dim_yx(ncvp, &dimy, &dimx);
@ -702,7 +706,7 @@ TEST_CASE("Visual") {
}
}
// test NCVISUAL_OPTIONS_CHILDPLANE + stretch + null alignment
// test NCVISUAL_OPTION_CHILDPLANE + stretch + null alignment
SUBCASE("ImageChildScaling") {
struct ncplane_options opts = {
.y = 0, .x = 0,
@ -717,14 +721,14 @@ TEST_CASE("Visual") {
auto parent = ncplane_create(n_, &opts);
REQUIRE(parent);
struct ncvisual_options vopts = {
.n = nullptr,
.n = n_,
.scaling = NCSCALE_NONE,
.y = 0,
.x = 0,
.begy = 0, .begx = 0,
.leny = 0, .lenx = 0,
.blitter = NCBLIT_1x1,
.flags = 0,
.flags = NCVISUAL_OPTION_CHILDPLANE,
.transcolor = 0,
.pxoffy = 0, .pxoffx = 0,
};
@ -736,7 +740,7 @@ TEST_CASE("Visual") {
};
auto ncv = ncvisual_from_rgba(pixels, 4, 16, 4);
REQUIRE(ncv);
auto child = ncvisual_render(nc_, ncv, &vopts);
auto child = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(child);
CHECK(4 == ncplane_dim_y(child));
CHECK(4 == ncplane_dim_x(child));
@ -747,7 +751,7 @@ TEST_CASE("Visual") {
vopts.n = parent,
vopts.scaling = NCSCALE_STRETCH,
vopts.flags = NCVISUAL_OPTION_CHILDPLANE;
child = ncvisual_render(nc_, ncv, &vopts);
child = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(child);
CHECK(20 == ncplane_dim_y(child));
CHECK(20 == ncplane_dim_x(child));
@ -787,7 +791,7 @@ TEST_CASE("Visual") {
const uint32_t pixels[1] = { htole(0xffffffff) };
auto ncv = ncvisual_from_rgba(pixels, 1, 4, 1);
REQUIRE(ncv);
auto child = ncvisual_render(nc_, ncv, &vopts);
auto child = ncvisual_blit(nc_, ncv, &vopts);
REQUIRE(child);
CHECK(1 == ncplane_dim_y(child));
CHECK(1 == ncplane_dim_x(child));