diff options
author | rodri <rgl@antares-labs.eu> | 2024-05-03 13:44:42 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-05-03 13:44:42 +0000 |
commit | afc811ce9e8b8a1a3d83b3855f4a9e63ba5a2c7b (patch) | |
tree | 1750d2802cebb26a5f22f442910db6045ce64605 | |
parent | b429311ed087ee7cf7fc7771a8e1834ea074f8da (diff) | |
download | libgraphics-afc811ce9e8b8a1a3d83b3855f4a9e63ba5a2c7b.tar.gz libgraphics-afc811ce9e8b8a1a3d83b3855f4a9e63ba5a2c7b.tar.bz2 libgraphics-afc811ce9e8b8a1a3d83b3855f4a9e63ba5a2c7b.zip |
clip: avoid division by zero.
-rw-r--r-- | clip.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -208,11 +208,11 @@ rectclipline(Rectangle r, Point *p0, Point *p1) p0->y += (r.max.x - p0->x)*m; p0->x = r.max.x; }else if(code0 & CLIPB){ - if(p0->x != p1->x) + if(p0->x != p1->x && m != 0) p0->x += (r.min.y - p0->y)/m; p0->y = r.min.y; }else if(code0 & CLIPT){ - if(p0->x != p1->x) + if(p0->x != p1->x && m != 0) p0->x += (r.max.y - p0->y)/m; p0->y = r.max.y; } |