From eb62fc02411640f279b70564f33d84125bfd95f1 Mon Sep 17 00:00:00 2001 From: hkc Date: Mon, 15 Aug 2022 19:00:39 +0300 Subject: [PATCH] Added support for Braille mode in 1-bit palette --- src/mod_braille.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod_braille.c b/src/mod_braille.c index f5dc600..58b5f2b 100644 --- a/src/mod_braille.c +++ b/src/mod_braille.c @@ -98,7 +98,8 @@ bool mod_braille_main(asc_state_t state) int __bra_best_match_i(rgba8 a, rgba8 b, rgba8 t) { - return color_difference(a, t) < color_difference(b, t) ? 0 : 1; + int diff_a = color_difference(a, t), diff_b = color_difference(b, t); + return diff_a == diff_b ? 0 : diff_a < diff_b ? 0 : 1; } void __bra_putc_raw(asc_state_t state, uint8_t ch) @@ -152,6 +153,8 @@ void __bra_put_pixel(asc_state_t s, rgba8 min, rgba8 max, uint8_t ch, bool fin) clamp_to_pal(*s.palette, max), ch, fin); break; case ASC_STL_BLACKWHITE: + __bra_putc_raw(s, ch); + break; case ASC_STL_ENDL: break; }