From 0d7fe5822dded8b2c73ee72522174da0ed78b0bf Mon Sep 17 00:00:00 2001 From: nick black Date: Sun, 18 Oct 2020 17:17:38 -0400 Subject: [PATCH] quadblitter: emit spaces when possible #1067 --- src/lib/blit.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/blit.c b/src/lib/blit.c index 5388b31d6..f85980102 100644 --- a/src/lib/blit.c +++ b/src/lib/blit.c @@ -224,11 +224,20 @@ quadrant_solver(uint32_t tl, uint32_t tr, uint32_t bl, uint32_t br, // so fuck it, just go ahead and initialize to 0 / diffs[0] size_t mindiffidx = 0; unsigned mindiff = diffs[0]; // 3 * 256 + 1; // max distance is 256 * 3 + // if all diffs are 0, emit a space + bool allzerodiffs = (mindiff == 0); for(size_t idx = 1 ; idx < sizeof(diffs) / sizeof(*diffs) ; ++idx){ if(diffs[idx] < mindiff){ mindiffidx = idx; mindiff = diffs[idx]; } + if(diffs[idx]){ + allzerodiffs = false; + } + } + if(allzerodiffs){ + *fore = *back = tl; + return " "; } // at this point, 0 <= mindiffidx <= 5. foreground color will be the // lerp of this nearest pair. we then check the other two. if they are