aboutsummaryrefslogtreecommitdiff
path: root/graphics/dia/patches/0017-Bug-660574-Avoid-cairo-going-into-an-endless-loop-wi.patch
blob: 04090c267eaefbe995b824fbb8ab61ccdaee4a5b (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
From eb4e80afe3f25b1d91f00bdd8dbf67e38adad1f8 Mon Sep 17 00:00:00 2001
From: Hans Breuer <hans@breuer.org>
Date: Fri, 16 Aug 2013 15:21:16 +0200
Subject: [PATCH 17/24] 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 file 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)
 }
-- 
1.8.4.4