Commit 04360d7a authored by Davis King's avatar Davis King

There was a bug in the version of draw_line() that draws directly onto an

array2d type image (not the one that draws onto a GUI canvas object).  The bug
triggered whenever a perfectly horizontal or vertical line that extended
outside the image was drawn.  This has been fixed.
parent c28e4ec7
...@@ -32,6 +32,9 @@ namespace dlib ...@@ -32,6 +32,9 @@ namespace dlib
if (y1 > y2) if (y1 > y2)
swap(y1,y2); swap(y1,y2);
if (x1 < 0 || x1 >= c.nc())
return;
// this is a vertical line // this is a vertical line
for (long y = y1; y <= y2; ++y) for (long y = y1; y <= y2; ++y)
...@@ -49,6 +52,8 @@ namespace dlib ...@@ -49,6 +52,8 @@ namespace dlib
if (x1 > x2) if (x1 > x2)
swap(x1,x2); swap(x1,x2);
if (y1 < 0 || y1 >= c.nr())
return;
// this is a horizontal line // this is a horizontal line
for (long x = x1; x <= x2; ++x) for (long x = x1; x <= x2; ++x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment