diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2013-12-19 12:52:31 +0200 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2013-12-19 18:00:49 +0100 |
commit | 985a3ca43a93d9975da30be7948e673774c1022c (patch) | |
tree | ce1a0a6b07dd24d35a65f68918ff25d658df5064 | |
parent | 391de882895ae233381de94d6284daa6199dda82 (diff) | |
download | uGFX-985a3ca43a93d9975da30be7948e673774c1022c.tar.gz uGFX-985a3ca43a93d9975da30be7948e673774c1022c.tar.bz2 uGFX-985a3ca43a93d9975da30be7948e673774c1022c.zip |
gdispDrawThickLine: handle zero-length lines correctly.
-rw-r--r-- | src/gdisp/gdisp.c | 8 |
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); |