From efd33aad5e69f36ab343b1f28839a55db4538104 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 19 May 2013 10:55:37 +0100 Subject: [PATCH 01/15] Fix non-terminating loop conditions when len=1 - while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) + while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; } --- include/agg_renderer_outline_aa.h | 8 ++++---- include/agg_renderer_outline_image.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/agg_renderer_outline_aa.h b/include/agg_renderer_outline_aa.h index ce25a2e..cb2aa00 100644 --- a/include/agg_renderer_outline_aa.h +++ b/include/agg_renderer_outline_aa.h @@ -1659,7 +1659,7 @@ namespace agg } else { - while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) + while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; @@ -1726,7 +1726,7 @@ namespace agg } else { - while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len) + while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len) { ex = (lp.x2 + ex) >> 1; ey = (lp.y2 + ey) >> 1; @@ -1798,7 +1798,7 @@ namespace agg } else { - while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) + while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; @@ -1811,7 +1811,7 @@ namespace agg } else { - while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len) + while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len) { ex = (lp.x2 + ex) >> 1; ey = (lp.y2 + ey) >> 1; diff --git a/include/agg_renderer_outline_image.h b/include/agg_renderer_outline_image.h index fbfac10..66d2b9a 100644 --- a/include/agg_renderer_outline_image.h +++ b/include/agg_renderer_outline_image.h @@ -969,7 +969,7 @@ namespace agg } else { - while(abs(sx - lp.x1) + abs(sy - lp.y1) > lp2.len) + while(abs(sx - lp.x1) + abs(sy - lp.y1) > 1 + lp2.len) { sx = (lp.x1 + sx) >> 1; sy = (lp.y1 + sy) >> 1; @@ -982,7 +982,7 @@ namespace agg } else { - while(abs(ex - lp.x2) + abs(ey - lp.y2) > lp2.len) + while(abs(ex - lp.x2) + abs(ey - lp.y2) > 1 + lp2.len) { ex = (lp.x2 + ex) >> 1; ey = (lp.y2 + ey) >> 1; -- 1.8.1.4