aboutsummaryrefslogtreecommitdiffstats
path: root/testing/agg/0001-Fix-non-terminating-loop-conditions-when-len-1.patch
blob: eaf0467fb8462a8f5149e10810dfdc22f6578ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From efd33aad5e69f36ab343b1f28839a55db4538104 Mon Sep 17 00:00:00 2001
From: Tom Hughes <tom@compton.nu>
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