situation One:
The function appears in an infinite loop in the following two-sentence code:
while (ABS (SX-LP.X1) + ABS (SY-LP.Y1) > Lp2.len)
{
SX = (lp.x1 + sx) >> 1;
Sy = (lp.y1 + sy) >> 1;
}
When debugging a breakpoint, the result of an infinite loop is that the value appears as follows:
Sx=0x3d00
Lp.x1=0x3d01
Sy=0x7a00
Lp.y1=0x7a01
Lp2.len=1
in this case, SX and the Sy value is never changed, and the condition of the loop is always set ( While (2>1).
Try modifying the following:
SX = lp.x1 + ((sx-lp.x1) >> 1);
SY = lp.y1 + ((sy-lp.y1) >> 1);
The purpose of the modification is to eventually jump out of the loop. Does not understand the logic of the code.
situation Two:
There is also an infinite loop for the following code:
while (ABS (EX-LP.X2) + ABS (EY-LP.Y2) >
Lp2.len)
{
/* Original
ex = (lp.x2 + ex) >> 1;
EY = (lp.y2 + ey) >> 1;
*/
ex = Lp.x2 + ((ex-lp.x2) >> 1);
EY = Lp.y2 + ((ey-lp.y2) >> 1);
}
situation Three:
Agg_renderer_outline_aa file 1801 Line (Clipbox enabled):
while (ABS (SX-LP.X1) + ABS (SY-LP.Y1) >lp2.len)
{
SX = (lp.x1 + sx) >> 1;
Sy = (lp.y1 + sy) >> 1;
}
SX = 365433
SY =-512
Lp.x1 = 365434
Lp.y1 =-511
Sx/sy always keep the same value: ( -511 + -512) >> 1 =-512;
Modify the following:
while (ABS (SX-LP.X1) + ABS (SY-LP.Y1) > (Lp2.len + 1))
{
...
}
Lp2.len Plus 1 .
It's very pleasure to offer me point
From
Http://vector-agg-general.narkive.com/Zl9USSxj/renderer-outline-aa-line3-infinite-loop-and-fix
Http://vector-agg-general.narkive.com/pJq7asry/infinite-loop-in-renderer-outline-aa
Renderer_outline_aa::line3 () Infinite loop