place resized pixel planes properly

pull/1729/head
nick black 3 years ago
parent 7b7308e866
commit e3bf3c9802
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -918,6 +918,7 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
ncplane_destroy(createdn);
return NULL;
}
//fprintf(stderr, "FOLLOWING PLANE: %d %d %d %d\n", n->absy, n->absx, n->leny, n->lenx);
// if we created the plane earlier, placex/placey were taken into account, and
// zeroed out, thus neither of these will have any effect.
if(flags & NCVISUAL_OPTION_HORALIGNED){
@ -945,9 +946,9 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
// the intended location.
sprixel* s = n->sprite;
n->sprite = NULL;
//fprintf(stderr, "ABOUT TO RESIZE: yoff/xoff: %d/%d\n", placey, placex);
// FIXME might need shrink down the TAM and kill unnecessary auxvecs
if(ncplane_resize(n, 0, 0, s->dimy, s->dimx, placey - ncplane_y(n),
placex - ncplane_x(n), s->dimy, s->dimx)){
if(ncplane_resize(n, 0, 0, s->dimy, s->dimx, placey, placex, s->dimy, s->dimx)){
sprixel_hide(bargs.u.pixel.spx);
ncplane_destroy(createdn);
return NULL;

@ -344,7 +344,6 @@ TEST_CASE("Bitmaps") {
vopts.n = nres;
vopts.scaling = NCSCALE_SCALE;
ncvisual_render(nc_, ncv, &vopts);
CHECK(5 == ncplane_dim_y(vopts.n));
CHECK(4 == ncplane_dim_x(vopts.n));
ncvisual_inflate(ncv, 4);
vopts.n = nullptr;
@ -353,8 +352,8 @@ TEST_CASE("Bitmaps") {
vopts.scaling = NCSCALE_NONE;
auto ninf = ncvisual_render(nc_, ncv, &vopts);
REQUIRE(nullptr != ninf);
CHECK(5 == ncplane_dim_y(ninf));
CHECK(4 == ncplane_dim_x(ninf));
CHECK(ncplane_dim_y(nres) == ncplane_dim_y(ninf));
CHECK(ncplane_dim_x(nres) == ncplane_dim_x(ninf));
CHECK(0 == notcurses_render(nc_));
ncvisual_destroy(ncv);
CHECK(0 == ncplane_destroy(n));

Loading…
Cancel
Save