aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-12-19 12:52:31 +0200
committerJoel Bodenmann <joel@unormal.org>2013-12-19 18:00:49 +0100
commit985a3ca43a93d9975da30be7948e673774c1022c (patch)
treece1a0a6b07dd24d35a65f68918ff25d658df5064 /src
parent391de882895ae233381de94d6284daa6199dda82 (diff)
downloaduGFX-985a3ca43a93d9975da30be7948e673774c1022c.tar.gz
uGFX-985a3ca43a93d9975da30be7948e673774c1022c.tar.bz2
uGFX-985a3ca43a93d9975da30be7948e673774c1022c.zip
gdispDrawThickLine: handle zero-length lines correctly.
Diffstat (limited to 'src')
-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);