Merge pull request #1729 from dankamongmen/dankamongmen/pixel-cell-rust

[rust] pixel-cell example: make 'em match #1728
pull/1736/head
José Luis Cruz 3 years ago committed by GitHub
commit 481d0d69e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -46,7 +46,7 @@ fn main() -> NcResult<()> {
rsleep![&mut nc, 1];
// show the ncvisual, scaled
let mut vplane2 = NcPlane::new_bound(&mut stdplane, 6, 2, 4, 4)?;
let mut vplane2 = NcPlane::new_bound(&mut stdplane, 6, 2, 5, 4)?;
let voptions2 = NcVisualOptions::with_plane(
&mut vplane2,
NCSCALE_SCALE,

@ -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