Mercurial > hg > orthanc
diff OrthancFramework/Sources/Images/ImageProcessing.cpp @ 4889:d8c8274d4e41
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sat, 19 Feb 2022 12:17:41 +0100 |
parents | 5dae41084ab7 |
children | dfbe764995cf |
line wrap: on
line diff
--- a/OrthancFramework/Sources/Images/ImageProcessing.cpp Fri Feb 18 15:45:28 2022 +0100 +++ b/OrthancFramework/Sources/Images/ImageProcessing.cpp Sat Feb 19 12:17:41 2022 +0100 @@ -2059,14 +2059,16 @@ if (onlyHorizontalSegments) { // Degenerate case: There are only horizontal lines. If this is - // the case, "GetPolygonPreviousY()" will be an infinite loop + // the case, "GetPolygonPreviousY()" would be an infinite loop int x1 = points[0].GetX(); - int x2 = points[0].GetX(); + int x2 = x1; for (size_t i = 1; i < points.size(); i++) { assert(points[i].GetY() == points[0].GetY()); - x1 = std::min(x1, points[i].GetX()); - x2 = std::max(x2, points[i].GetX()); + + const int x = points[i].GetX(); + x1 = std::min(x1, x); + x2 = std::max(x2, x); } filler.Fill(points[0].GetY(), x1, x2); return;