From c72572cc5005f4c99b8f4cb69bdf9c920cb14987 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 31 May 2021 17:11:58 -0400 Subject: [PATCH] blitsets: break up egcs/plotegcs, use latter for plots #1490 --- src/lib/blit.c | 27 ++++++++++++++++++--------- src/lib/internal.h | 1 + src/lib/plot.c | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/lib/blit.c b/src/lib/blit.c index 57a8354db3..228839ac9d 100644 --- a/src/lib/blit.c +++ b/src/lib/blit.c @@ -857,23 +857,32 @@ braille_blit(ncplane* nc, int linesize, const void* data, // always be the full block █ (note that this will be rendered as a space, so // it's safe to use even in the NCBLIT_1x1 ASCII case). static struct blitset notcurses_blitters[] = { - { .geom = NCBLIT_8x1, .width = 1, .height = 8, .egcs = L" ▁▂▃▄▅▆▇█", + { .geom = NCBLIT_8x1, .width = 1, .height = 8, + .egcs = NULL, .plotegcs = L" ▁▂▃▄▅▆▇█", .blit = tria_blit, .name = "eightstep", .fill = false, }, - { .geom = NCBLIT_1x1, .width = 1, .height = 1, .egcs = L" █", + { .geom = NCBLIT_1x1, .width = 1, .height = 1, + .egcs = L" █", .plotegcs = L" █", .blit = tria_blit_ascii,.name = "ascii", .fill = false, }, - { .geom = NCBLIT_2x1, .width = 1, .height = 2, .egcs = L" ▀▄█", + { .geom = NCBLIT_2x1, .width = 1, .height = 2, + .egcs = L" ▀▄█", .plotegcs = L" ▄█", .blit = tria_blit, .name = "half", .fill = false, }, - { .geom = NCBLIT_2x2, .width = 2, .height = 2, .egcs = L" ▘▝▀▖ ▌▞▛▗▚▐▜▄▙▟█", + { .geom = NCBLIT_2x2, .width = 2, .height = 2, + .egcs = L" ▗▐▖▄▟▌▙█", .plotegcs = L" ▘▝▀▖▌▞▛▗▚▐▜▄▙▟█", .blit = quadrant_blit, .name = "quad", .fill = false, }, - { .geom = NCBLIT_3x2, .width = 2, .height = 3, .egcs = L" 🬞🬦▐🬏🬭🬵🬷🬓🬱🬹🬻▌🬲🬺█", + { .geom = NCBLIT_3x2, .width = 2, .height = 3, + .egcs = L" 🬞🬦▐🬏🬭🬵🬷🬓🬱🬹🬻▌🬲🬺█", .plotegcs = NULL, .blit = sextant_blit, .name = "sex", .fill = false, }, - { .geom = NCBLIT_4x1, .width = 1, .height = 4, .egcs = L" ▂▄▆█", + { .geom = NCBLIT_4x1, .width = 1, .height = 4, + .egcs = NULL, .plotegcs = L" ▂▄▆█", .blit = tria_blit, .name = "fourstep", .fill = false, }, - { .geom = NCBLIT_BRAILLE, .width = 2, .height = 4, .egcs = L"⠀⢀⢠⢰⢸⡀⣀⣠⣰⣸⡄⣄⣤⣴⣼⡆⣆⣦⣶⣾⡇⣇⣧⣷⣿", + { .geom = NCBLIT_BRAILLE, .width = 2, .height = 4, + .egcs = L"⠀⢀⢠⢰⢸⡀⣀⣠⣰⣸⡄⣄⣤⣴⣼⡆⣆⣦⣶⣾⡇⣇⣧⣷⣿", .plotegcs = NULL, .blit = braille_blit, .name = "braille", .fill = true, }, - { .geom = NCBLIT_PIXEL, .width = 1, .height = 1, .egcs = L"", + { .geom = NCBLIT_PIXEL, .width = 1, .height = 1, + .egcs = L"", .plotegcs = L"", .blit = sixel_blit, .name = "pixel", .fill = true, }, - { .geom = 0, .width = 0, .height = 0, .egcs = NULL, + { .geom = 0, .width = 0, .height = 0, + .egcs = NULL, .plotegcs = NULL, .blit = NULL, .name = NULL, .fill = false, }, }; diff --git a/src/lib/internal.h b/src/lib/internal.h index 33015810e5..2db2750bb0 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -542,6 +542,7 @@ struct blitset { // quickly, i.e. it can be indexed as height arrays of 1 + height glyphs. i.e. // the first five braille EGCs are all 0 on the left, [0..4] on the right. const wchar_t* egcs; + const wchar_t* plotegcs; ncblitter blit; const char* name; bool fill; diff --git a/src/lib/plot.c b/src/lib/plot.c index e29ce5d2d9..ca06f6e863 100644 --- a/src/lib/plot.c +++ b/src/lib/plot.c @@ -124,7 +124,7 @@ int redraw_plot_##T(nc##X##plot* ncp){ \ direction, drawing egcs from the grid specification, aborting early if \ we can't draw anything in a given cell. */ \ T intervalbase = ncp->miny; \ - const wchar_t* egc = ncp->bset->egcs; \ + const wchar_t* egc = ncp->bset->plotegcs; \ bool done = !ncp->bset->fill; \ for(int y = 0 ; y < dimy ; ++y){ \ uint64_t channels = 0; \