kill off-by-one in pixel scaling #1558

pull/1567/head
nick black 4 years ago
parent 6a509328fa
commit 67bac13f67
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -665,10 +665,10 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits
disprows *= nc->tcache.cellpixy; disprows *= nc->tcache.cellpixy;
clamp_to_sixelmax(&nc->tcache, &disprows, &dispcols); clamp_to_sixelmax(&nc->tcache, &disprows, &dispcols);
if(!(flags & NCVISUAL_OPTION_HORALIGNED)){ if(!(flags & NCVISUAL_OPTION_HORALIGNED)){
dispcols -= (placex * nc->tcache.cellpixx + 1); dispcols -= placex * nc->tcache.cellpixx;
} }
if(!(flags & NCVISUAL_OPTION_VERALIGNED)){ if(!(flags & NCVISUAL_OPTION_VERALIGNED)){
disprows -= (placey * nc->tcache.cellpixy + 1); disprows -= placey * nc->tcache.cellpixy;
} }
} }
} }

@ -70,7 +70,7 @@ TEST_CASE("Bitmaps") {
.userptr = nullptr, .name = "bigp", .resizecb = nullptr, .userptr = nullptr, .name = "bigp", .resizecb = nullptr,
.flags = 0, .margin_b = 0, .margin_r = 0, .flags = 0, .margin_b = 0, .margin_r = 0,
}; };
vopts.scaling = NCSCALE_STRETCH; vopts.scaling = NCSCALE_SCALE;
vopts.n = ncplane_create(n_, &nopts); vopts.n = ncplane_create(n_, &nopts);
REQUIRE(vopts.n); REQUIRE(vopts.n);
uint64_t white = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff); uint64_t white = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);

Loading…
Cancel
Save