83bc7c
--- libwmf-0.2.8.4/src/extra/gd/gd.c
83bc7c
+++ libwmf-0.2.8.4/src/extra/gd/gd.c
83bc7c
@@ -1335,10 +1335,31 @@
83bc7c
   int w2, h2;
83bc7c
   w2 = w / 2;
83bc7c
   h2 = h / 2;
83bc7c
-  while (e < s)
83bc7c
-    {
83bc7c
-      e += 360;
83bc7c
-    }
83bc7c
+
83bc7c
+  if ((s % 360)  == (e % 360)) {
83bc7c
+         s = 0; e = 360;
83bc7c
+  } else {
83bc7c
+         if (s > 360) {
83bc7c
+                 s = s % 360;
83bc7c
+         }
83bc7c
+
83bc7c
+         if (e > 360) {
83bc7c
+                 e = e % 360;
83bc7c
+         }
83bc7c
+
83bc7c
+         while (s < 0) {
83bc7c
+                 s += 360;
83bc7c
+         }
83bc7c
+
83bc7c
+         while (e < s) {
83bc7c
+                 e += 360;
83bc7c
+         }
83bc7c
+
83bc7c
+         if (s == e) {
83bc7c
+                 s = 0; e = 360;
83bc7c
+         }
83bc7c
+  }
83bc7c
+
83bc7c
   for (i = s; (i <= e); i++)
83bc7c
     {
83bc7c
       int x, y;