gdispDrawThickLine: handle zero-length lines correctly.
parent
391de88289
commit
985a3ca43a
|
@ -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)
|
if (len_sq < norm_sq2)
|
||||||
{
|
{
|
||||||
while (len_sq < norm_sq2)
|
while (len_sq && len_sq < norm_sq2)
|
||||||
{
|
{
|
||||||
len_sq <<= 2; dx2 <<= 1; dy2 <<= 1;
|
len_sq <<= 2; dx2 <<= 1; dy2 <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (len_sq > norm_sq2)
|
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;
|
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;
|
dx = x1 - x0;
|
||||||
dy = y1 - y0;
|
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'. */
|
/* Compute a normal vector with length 'width'. */
|
||||||
get_normal_vector(dx, dy, width, &nx, &ny);
|
get_normal_vector(dx, dy, width, &nx, &ny);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue