diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-12-27 18:44:30 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-01-01 20:09:35 +0000 |
| commit | 17a46378bf8fa7d96f72044bf001dbd1b5db3994 (patch) | |
| tree | 4950b65fb190623fb183b728fa9c8285b49bb87d | |
| parent | box-drawing: QUADRANTs (diff) | |
box-drawing: QUADRANTs: ensure all quads have equal width and hight
If the cell width/height is odd, the previous implementation would
result in uneven quads.
| -rw-r--r-- | box-drawing.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/box-drawing.c b/box-drawing.c index 17f54f3f..86f66ea6 100644 --- a/box-drawing.c +++ b/box-drawing.c @@ -91,10 +91,10 @@ rectangle(uint8_t *buf, int x1, int y1, int x2, int y2, int stride) #define rect(x1, y1, x2, y2) rectangle(buf, x1, y1, x2, y2, stride) -#define quad_upper_left() rect(0, 0, width / 2, height / 2) -#define quad_upper_right() rect(width / 2, 0, width, height / 2) -#define quad_lower_left() rect(0, height / 2, width / 2, height) -#define quad_lower_right() rect(width / 2, height / 2, width, height) +#define quad_upper_left() rect(0, 0, ceil(width / 2.), ceil(height / 2.)) +#define quad_upper_right() rect(floor(width / 2.), 0, width, ceil(height / 2.)) +#define quad_lower_left() rect(0, floor(height / 2.), ceil(width / 2.), height) +#define quad_lower_right() rect(floor(width / 2.), floor(height / 2.), width, height) static void draw_box_drawings_light_horizontal(uint8_t *buf, int width, int height, int stride, int dpi) |
