diff options
-rw-r--r-- | draw_linear_bezier_reference.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/draw_linear_bezier_reference.c b/draw_linear_bezier_reference.c index 63a978f..dbfb87f 100644 --- a/draw_linear_bezier_reference.c +++ b/draw_linear_bezier_reference.c @@ -35,8 +35,8 @@ draw_linear_bezier_reference(RASTER *restrict raster, double x1, double y1, doub /* Find next vertical and next hozitonal grid line */ x = xdir < 0 ? floor(prevX) : xdir > 0 ? ceil(prevX) : prevX; y = ydir < 0 ? floor(prevY) : ydir > 0 ? ceil(prevY) : prevY; - x = x == prevX ? x + xdir : x; - y = y == prevY ? y + ydir : y; + x = iszeroish(x - prevX) ? x + xdir : x; + y = iszeroish(y - prevY) ? y + ydir : y; /* Limit to the extend of the drawn line segment */ if ((xdir < 0 && x < x2) || (xdir > 0 && x > x2)) @@ -540,13 +540,13 @@ check_random_line(double rand_xmin, double rand_xmax, double rand_ymin, double r if (!dy) continue; - hit = x >= floor(xmin) && x <= ceil(xmax); + hit = (double)x >= floor(xmin) && (double)x <= ceil(xmax); hit |= !x && xmin < 0; - hit &= y >= floor(ymin) && y <= ceil(ymax); + hit &= (double)y >= floor(ymin) && (double)y <= ceil(ymax); ASSERT(hit || !raster->cells[y * 10 + x].cell_coverage); - hit = x >= floor(xmin) && x <= ceil(xmax); - hit &= y >= floor(ymin) && y <= ceil(ymax); + hit = (double)x >= floor(xmin) && (double)x <= ceil(xmax); + hit &= (double)y >= floor(ymin) && (double)y <= ceil(ymax); if (!hit || !dx || !x) continue; |