From 67bac13f6766e4fac48eae4a08d825f6caa58757 Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 18 Apr 2021 10:37:22 -0400 Subject: [PATCH] kill off-by-one in pixel scaling #1558 --- src/lib/visual.c | 4 ++-- src/tests/bitmap.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/visual.c b/src/lib/visual.c index cfd481882..0b7e602d4 100644 --- a/src/lib/visual.c +++ b/src/lib/visual.c @@ -665,10 +665,10 @@ ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blits disprows *= nc->tcache.cellpixy; clamp_to_sixelmax(&nc->tcache, &disprows, &dispcols); if(!(flags & NCVISUAL_OPTION_HORALIGNED)){ - dispcols -= (placex * nc->tcache.cellpixx + 1); + dispcols -= placex * nc->tcache.cellpixx; } if(!(flags & NCVISUAL_OPTION_VERALIGNED)){ - disprows -= (placey * nc->tcache.cellpixy + 1); + disprows -= placey * nc->tcache.cellpixy; } } } diff --git a/src/tests/bitmap.cpp b/src/tests/bitmap.cpp index 5d002b740..5125aba4a 100644 --- a/src/tests/bitmap.cpp +++ b/src/tests/bitmap.cpp @@ -70,7 +70,7 @@ TEST_CASE("Bitmaps") { .userptr = nullptr, .name = "bigp", .resizecb = nullptr, .flags = 0, .margin_b = 0, .margin_r = 0, }; - vopts.scaling = NCSCALE_STRETCH; + vopts.scaling = NCSCALE_SCALE; vopts.n = ncplane_create(n_, &nopts); REQUIRE(vopts.n); uint64_t white = CHANNELS_RGB_INITIALIZER(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);