aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-01 12:18:51 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-01 20:09:38 +0000
commit848bd27dd52b433d1de789f7629f543c2b23fe82 (patch)
treebf9acd7aabd82a3e36e814162869455293be1b46
parentbox-drawing: LIGHT ARC: no need to do floating point since we’re truncating (diff)
box-drawing: LIGHT ARC: improve symmetry when cell width is even
-rw-r--r--box-drawing.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/box-drawing.c b/box-drawing.c
index 3dd27d13..31fe191f 100644
--- a/box-drawing.c
+++ b/box-drawing.c
@@ -1066,9 +1066,9 @@ draw_box_drawings_light_arc(wchar_t wc, uint8_t *buf, int width, int height, int
if (wc == L'╭') {
start_x = hw;
- start_y = height - 1;
+ start_y = 2 * hh;
- end_x = width - 1;
+ end_x = 2 * hw;
end_y = hh;
c1_x = hw;
@@ -1078,7 +1078,7 @@ draw_box_drawings_light_arc(wchar_t wc, uint8_t *buf, int width, int height, int
c2_y = hh;
} else if (wc == L'╮') {
start_x = hw;
- start_y = height - 1;
+ start_y = 2 * hh;
end_x = 0;
end_y = hh;
@@ -1106,7 +1106,7 @@ draw_box_drawings_light_arc(wchar_t wc, uint8_t *buf, int width, int height, int
start_x = hw;
start_y = 0;
- end_x = width - 1;
+ end_x = 2 * hw;
end_y = hh;
c1_x = hw;
@@ -1131,6 +1131,26 @@ draw_box_drawings_light_arc(wchar_t wc, uint8_t *buf, int width, int height, int
}
}
}
+
+ if (wc == L'╭' || wc == L'╰') {
+ for (int x = 2 * hw; x < width; x++) {
+ for (int y = max(hh - delta, 0); y < min(hh + delta + extra, height); y++) {
+ size_t ofs = x / 8;
+ size_t bit_no = x % 8;
+ buf[y * stride + ofs] |= 1 << bit_no;
+ }
+ }
+ }
+
+ if (wc == L'╭' || wc == L'╮') {
+ for (int y = 2 * hh; y < height; y++) {
+ for (int x = max(hw - delta, 0); x < min(hw + delta + extra, width); x++) {
+ size_t ofs = x / 8;
+ size_t bit_no = x % 8;
+ buf[y * stride + ofs] |= 1 << bit_no;
+ }
+ }
+ }
}
static void