jwidget: fix bad display of border of size 0

This is caused by drect() flipping arguments in the order is incorrect,
so x2 < x1 gives you a rectangle instead of nothing.
This commit is contained in:
Lephenixnoir 2022-06-21 09:22:49 +01:00
parent 7ebc3b802c
commit ee98be1cc1
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 8 additions and 4 deletions

View File

@ -609,11 +609,15 @@ void jwidget_render(void *w0, int x, int y)
if(g->border_style == J_BORDER_NONE || color == C_NONE) {
}
else if(g->border_style == J_BORDER_SOLID) {
drect(x1, y1, x2 + b.right - 1, y1 + b.top - 1, color);
drect(x1, y2, x2 + b.right - 1, y2 + b.bottom - 1, color);
if(b.top > 0)
drect(x1, y1, x2 + b.right - 1, y1 + b.top - 1, color);
if(b.bottom > 0)
drect(x1, y2, x2 + b.right - 1, y2 + b.bottom - 1, color);
drect(x1, y1 + b.top, x1 + b.left - 1, y2 - 1, color);
drect(x2, y1 + b.top, x2 + b.right - 1, y2 - 1, color);
if(b.left > 0)
drect(x1, y1 + b.top, x1 + b.left - 1, y2 - 1, color);
if(b.right > 0)
drect(x2, y1 + b.top, x2 + b.right - 1, y2 - 1, color);
}
/* TODO: jwidget_render(): More border types */