Skip to content

Commit

Permalink
Fixed reverse iterator comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
baddstats committed Apr 2, 2016
1 parent b841bc5 commit 0ec64c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: polyclip
Version: 1.5-5
Date: 2016-03-31
Version: 1.5-6
Date: 2016-04-02
Title: Polygon Clipping
Authors@R: c(person("Angus", "Johnson", role = "aut",
comment="C++ original, http://www.angusj.com/delphi/clipper.php"),
Expand Down
16 changes: 8 additions & 8 deletions src/clipper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2680,8 +2680,8 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
eMaxPair = GetMaximaPair(eLastHorz);

MaximaList::const_iterator maxIt;
MaximaList::const_reverse_iterator maxRit, maxRend;
if (m_Maxima.size() > 0)
MaximaList::const_reverse_iterator maxRit;
if (!m_Maxima.empty())
{
//get the first maxima in range (X) ...
if (dir == dLeftToRight)
Expand All @@ -2694,9 +2694,9 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
else
{
maxRit = m_Maxima.rbegin();
maxRend = m_Maxima.rend();
while (maxRit != maxRend && *maxRit > horzEdge->Bot.X) maxRit++;
if (maxRit != maxRend && *maxRit <= eLastHorz->Top.X)
// reverse "!=" to work around a defect in early compilers
while(m_Maxima.rend() != maxRit && *maxRit > horzEdge->Bot.X) maxRit++;
if (m_Maxima.rend() != maxRit && *maxRit <= eLastHorz->Top.X)
maxRit = m_Maxima.rend();
}
}
Expand All @@ -2714,7 +2714,7 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
//this code block inserts extra coords into horizontal edges (in output
//polygons) whereever maxima touch these horizontal edges. This helps
//'simplifying' polygons (ie if the Simplify property is set).
if (m_Maxima.size() > 0)
if (!m_Maxima.empty())
{
if (dir == dLeftToRight)
{
Expand All @@ -2727,8 +2727,8 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge)
}
else
{
maxRend = m_Maxima.rend();
while (maxRit != maxRend && *maxRit > e->Curr.X)
// reverse "!=" to work around a defect in early compilers
while (m_Maxima.rend() != maxRit && *maxRit > e->Curr.X)
{
if (horzEdge->OutIdx >= 0 && !IsOpen)
AddOutPt(horzEdge, IntPoint(*maxRit, horzEdge->Bot.Y));
Expand Down

0 comments on commit 0ec64c2

Please sign in to comment.