[dia/dia-0-97] Bug 660574 - Avoid cairo going into an endless loop with too small arcs



commit eb4e80afe3f25b1d91f00bdd8dbf67e38adad1f8
Author: Hans Breuer <hans breuer org>
Date:   Fri Aug 16 15:21:16 2013 +0200

    Bug 660574 - Avoid cairo going into an endless loop with too small arcs
    
    this should fix the issue with SADT flow arrow, although I could not reproduce it.

 plug-ins/cairo/diacairo-renderer.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/plug-ins/cairo/diacairo-renderer.c b/plug-ins/cairo/diacairo-renderer.c
index cd13247..137411e 100644
--- a/plug-ins/cairo/diacairo-renderer.c
+++ b/plug-ins/cairo/diacairo-renderer.c
@@ -499,6 +499,7 @@ draw_arc(DiaRenderer *self,
   DiaCairoRenderer *renderer = DIA_CAIRO_RENDERER (self);
   Point start;
   double a1, a2;
+  real onedu = 0.0;
 
   DIAG_NOTE(g_message("draw_arc %fx%f <%f,<%f", 
             width, height, angle1, angle2));
@@ -515,9 +516,12 @@ draw_arc(DiaRenderer *self,
   a1 = - (angle1 / 180.0) * G_PI;
   a2 = - (angle2 / 180.0) * G_PI;
   /* FIXME: to handle width != height some cairo_scale/cairo_translate would be needed */
-  cairo_arc_negative (renderer->cr, center->x, center->y, 
-                      width > height ? height / 2.0 : width / 2.0, /* FIXME 2nd radius */
-                      a1, a2);
+  ensure_minimum_one_device_unit (renderer, &onedu);
+  /* FIXME2: with too small arcs cairo goes into an endless loop */
+  if (height/2.0 > onedu && width/2.0 > onedu)
+    cairo_arc_negative (renderer->cr, center->x, center->y, 
+                        width > height ? height / 2.0 : width / 2.0, /* FIXME 2nd radius */
+                        a1, a2);
   cairo_stroke (renderer->cr);
   DIAG_STATE(renderer->cr)
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]