mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-06 07:15:30 -04:00
box-drawing: sextants: convert sextant_*() macros to functions
While this doesn’t really reduce foot’s size, it is cleaner
This commit is contained in:
parent
f7669c1e24
commit
d1993f1f91
1 changed files with 41 additions and 12 deletions
|
|
@ -1716,12 +1716,41 @@ draw_quadrant_upper_right_and_lower_left_and_lower_right(struct buf *buf)
|
||||||
quad_lower_right(buf);
|
quad_lower_right(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define sextant_upper_left() rect(0, 0, round(buf->width / 2.), round(buf->height / 3.))
|
static void
|
||||||
#define sextant_middle_left() rect(0, buf->height / 3, round(buf->width / 2.), round(2. * buf->height / 3.))
|
sextant_upper_left(struct buf *buf)
|
||||||
#define sextant_lower_left() rect(0, 2 * buf->height / 3, round(buf->width / 2.), buf->height)
|
{
|
||||||
#define sextant_upper_right() rect(buf->width / 2, 0, buf->width, round(buf->height / 3.))
|
rect(0, 0, round(buf->width / 2.), round(buf->height / 3.));
|
||||||
#define sextant_middle_right() rect(buf->width / 2, buf->height / 3, buf->width, round(2. * buf->height / 3.))
|
}
|
||||||
#define sextant_lower_right() rect(buf->width / 2, 2 * buf->height / 3, buf->width, buf->height)
|
|
||||||
|
static void
|
||||||
|
sextant_middle_left(struct buf *buf)
|
||||||
|
{
|
||||||
|
rect(0, buf->height / 3, round(buf->width / 2.), round(2. * buf->height / 3.));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sextant_lower_left(struct buf *buf)
|
||||||
|
{
|
||||||
|
rect(0, 2 * buf->height / 3, round(buf->width / 2.), buf->height);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sextant_upper_right(struct buf *buf)
|
||||||
|
{
|
||||||
|
rect(buf->width / 2, 0, buf->width, round(buf->height / 3.));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sextant_middle_right(struct buf *buf)
|
||||||
|
{
|
||||||
|
rect(buf->width / 2, buf->height / 3, buf->width, round(2. * buf->height / 3.));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
sextant_lower_right(struct buf *buf)
|
||||||
|
{
|
||||||
|
rect(buf->width / 2, 2 * buf->height / 3, buf->width, buf->height);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
draw_sextant(wchar_t wc, struct buf *buf)
|
draw_sextant(wchar_t wc, struct buf *buf)
|
||||||
|
|
@ -1821,22 +1850,22 @@ draw_sextant(wchar_t wc, struct buf *buf)
|
||||||
uint8_t encoded = matrix[idx];
|
uint8_t encoded = matrix[idx];
|
||||||
|
|
||||||
if (encoded & UPPER_LEFT)
|
if (encoded & UPPER_LEFT)
|
||||||
sextant_upper_left();
|
sextant_upper_left(buf);
|
||||||
|
|
||||||
if (encoded & MIDDLE_LEFT)
|
if (encoded & MIDDLE_LEFT)
|
||||||
sextant_middle_left();
|
sextant_middle_left(buf);
|
||||||
|
|
||||||
if (encoded & LOWER_LEFT)
|
if (encoded & LOWER_LEFT)
|
||||||
sextant_lower_left();
|
sextant_lower_left(buf);
|
||||||
|
|
||||||
if (encoded & UPPER_RIGHT)
|
if (encoded & UPPER_RIGHT)
|
||||||
sextant_upper_right();
|
sextant_upper_right(buf);
|
||||||
|
|
||||||
if (encoded & MIDDLE_RIGHT)
|
if (encoded & MIDDLE_RIGHT)
|
||||||
sextant_middle_right();
|
sextant_middle_right(buf);
|
||||||
|
|
||||||
if (encoded & LOWER_RIGHT)
|
if (encoded & LOWER_RIGHT)
|
||||||
sextant_lower_right();
|
sextant_lower_right(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue