File ghostscript-8.61-stroke-loop.dif of Package ghostscript-library

--- src/zchar1.c
+++ src/zchar1.c	2007-10-02 10:48:04.538619351 +0000
@@ -42,6 +42,11 @@
 #include "iutil.h"
 #include "store.h"
 
+#if defined(__linux__)
+# define barrier() __asm__ __volatile__("": : :"memory")
+#else
+# define barrier()
+#endif
 /*
  * Properly designed fonts, which have no self-intersecting outlines
  * and in which outer and inner outlines are drawn in opposite
@@ -428,22 +433,34 @@ static int
 bbox_finish_fill(i_ctx_t *i_ctx_p)
 {
     op_proc_t exec_cont = 0;
-    int code;
+    static int loop;
+    int code = 0;
 
+    if (loop > 2)
+	goto out;
+    loop++;
     code = bbox_finish(i_ctx_p, bbox_fill, &exec_cont);
     if (code >= 0 && exec_cont != 0)
 	code = exec_cont(i_ctx_p);
+    loop--;
+out:
     return code;
 }
 static int
 bbox_finish_stroke(i_ctx_t *i_ctx_p)
 {
     op_proc_t exec_cont = 0;
-    int code;
+    static int loop;
+    int code = 0;
 
+    if (loop > 2)
+	goto out;
+    loop++;
     code = bbox_finish(i_ctx_p, bbox_stroke, &exec_cont);
     if (code >= 0 && exec_cont != 0)
 	code = exec_cont(i_ctx_p);
+    loop--;
+out:
     return code;
 }
 
@@ -569,13 +586,15 @@ bbox_draw(i_ctx_t *i_ctx_p, int (*draw)(
 	}
 	return code;
     }
+    barrier();
     if (draw == gs_stroke) {
 	/* Expand the bounding box by the line width. */
 	float width = gs_currentlinewidth(igs) * 1.41422;
 
-	bbox.p.x -= width, bbox.p.y -= width;
-	bbox.q.x += width, bbox.q.y += width;
+	bbox.p.x -= width; bbox.p.y -= width;
+	bbox.q.x += width; bbox.q.y += width;
     }
+    barrier();
     pbfont = (gs_font_base *)pfont;
     if (rect_within(bbox, pbfont->FontBBox))	/* within bounds */
 	return nobbox_draw(i_ctx_p, draw);
openSUSE Build Service is sponsored by