comparison 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
comparison
equal deleted inserted replaced
4888:8523078f3f4b 4889:d8c8274d4e41
2057 } 2057 }
2058 2058
2059 if (onlyHorizontalSegments) 2059 if (onlyHorizontalSegments)
2060 { 2060 {
2061 // Degenerate case: There are only horizontal lines. If this is 2061 // Degenerate case: There are only horizontal lines. If this is
2062 // the case, "GetPolygonPreviousY()" will be an infinite loop 2062 // the case, "GetPolygonPreviousY()" would be an infinite loop
2063 int x1 = points[0].GetX(); 2063 int x1 = points[0].GetX();
2064 int x2 = points[0].GetX(); 2064 int x2 = x1;
2065 for (size_t i = 1; i < points.size(); i++) 2065 for (size_t i = 1; i < points.size(); i++)
2066 { 2066 {
2067 assert(points[i].GetY() == points[0].GetY()); 2067 assert(points[i].GetY() == points[0].GetY());
2068 x1 = std::min(x1, points[i].GetX()); 2068
2069 x2 = std::max(x2, points[i].GetX()); 2069 const int x = points[i].GetX();
2070 x1 = std::min(x1, x);
2071 x2 = std::max(x2, x);
2070 } 2072 }
2071 filler.Fill(points[0].GetY(), x1, x2); 2073 filler.Fill(points[0].GetY(), x1, x2);
2072 return; 2074 return;
2073 } 2075 }
2074 2076