aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gdisp/gdisp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index 8f1d073b..bb642b30 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -2596,14 +2596,14 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
if (len_sq < norm_sq2)
{
- while (len_sq < norm_sq2)
+ while (len_sq && len_sq < norm_sq2)
{
len_sq <<= 2; dx2 <<= 1; dy2 <<= 1;
}
}
else if (len_sq > norm_sq2)
{
- while (len_sq > norm_sq2)
+ while (len_sq && len_sq > norm_sq2)
{
len_sq >>= 2; dx2 >>= 1; dy2 >>= 1;
}
@@ -2660,6 +2660,10 @@ void gdispGDrawBox(GDisplay *g, coord_t x, coord_t y, coord_t cx, coord_t cy, co
dx = x1 - x0;
dy = y1 - y0;
+ /* Draw a small dot if the line length is zero. */
+ if (dx == 0 && dy == 0)
+ dx += 1;
+
/* Compute a normal vector with length 'width'. */
get_normal_vector(dx, dy, width, &nx, &ny);