From 3faffaa847ea9a1a22f35e3cb7272ac4d0d5240c Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 12 Jan 2020 06:53:25 -0500 Subject: [PATCH] channels_blend() : don't blend in wide status #260 --- include/notcurses.h | 14 ++++++++------ src/lib/render.c | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/notcurses.h b/include/notcurses.h index d1f9469bb..e766c63e5 100644 --- a/include/notcurses.h +++ b/include/notcurses.h @@ -1114,13 +1114,15 @@ channels_set_bg_default(uint64_t* channels){ // it will not be used (unless 'blends' is 0). static inline unsigned channels_blend(unsigned c1, unsigned c2, unsigned blends){ + unsigned rsum, gsum, bsum; if(blends == 0){ - return c2; - } - if(!channel_default_p(c2) && !channel_default_p(c1)){ - int rsum = (channel_r(c1) * blends + channel_r(c2)) / (blends + 1); - int gsum = (channel_g(c1) * blends + channel_g(c2)) / (blends + 1); - int bsum = (channel_b(c1) * blends + channel_b(c2)) / (blends + 1); + // don't just return c2, or you set wide status and all kinds of crap + channel_rgb(c2, &rsum, &gsum, &bsum); + channel_set_rgb(&c1, rsum, gsum, bsum); + }else if(!channel_default_p(c2) && !channel_default_p(c1)){ + rsum = (channel_r(c1) * blends + channel_r(c2)) / (blends + 1); + gsum = (channel_g(c1) * blends + channel_g(c2)) / (blends + 1); + bsum = (channel_b(c1) * blends + channel_b(c2)) / (blends + 1); channel_set_rgb(&c1, rsum, gsum, bsum); } return c1; diff --git a/src/lib/render.c b/src/lib/render.c index f84317f6b..f1a565b8c 100644 --- a/src/lib/render.c +++ b/src/lib/render.c @@ -516,6 +516,8 @@ notcurses_render_internal(notcurses* nc){ } if(depth > 0){ // we are above the previous source plane if(inright){ // wipe out the character to the left + // FIXME do this by keeping an offset for the memstream, and + // truncating it (via lseek()), methinks cell* prev = &nc->lastframe[fbcellidx(nc->stdscr, y, x - 1)]; pool_release(&nc->pool, prev); cell_init(prev);