gdispDrawThickLine: handle zero-length lines correctly.

remotes/origin_old/ugfx_release_2.6
Petteri Aimonen 2013-12-19 12:52:31 +02:00 committed by Joel Bodenmann
parent 391de88289
commit 985a3ca43a
1 changed files with 6 additions and 2 deletions

View File

@ -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);