]> granicus.if.org Git - graphviz/commitdiff
arrows: factor out arrow_type_diamond0 function
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Thu, 6 Oct 2022 07:22:25 +0000 (09:22 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sat, 29 Oct 2022 09:06:44 +0000 (11:06 +0200)
Towards https://gitlab.com/graphviz/graphviz/-/issues/372.

lib/common/arrows.c

index 6a089c69606f4dc4728f0ac6b8b45bc8801b5bc9..faf7a932f16c91e10f060758443ac691238f8d30 100644 (file)
@@ -745,11 +745,9 @@ static pointf arrow_type_box(GVJ_t * job, pointf p, pointf u, double arrowsize,
     return q;
 }
 
-static pointf arrow_type_diamond(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag)
+static pointf arrow_type_diamond0(pointf p, pointf u, double penwidth, int flag, pointf* a)
 {
-    (void)arrowsize;
-
-    pointf q, r, v, a[5];
+    pointf q, r, v;
 
     v.x = -u.y / 3.;
     v.y = u.x / 3.;
@@ -785,6 +783,16 @@ static pointf arrow_type_diamond(GVJ_t * job, pointf p, pointf u, double arrowsi
     // return the visual starting point of the arrow outline
     q = sub_pointf(q, delta);
 
+    return q;
+}
+
+static pointf arrow_type_diamond(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag) {
+    (void)arrowsize;
+
+    pointf a[5];
+
+    pointf q = arrow_type_diamond0(p, u, penwidth, flag, a);
+
     if (flag & ARR_MOD_LEFT)
        gvrender_polygon(job, &a[2], 3, !(flag & ARR_MOD_OPEN));
     else if (flag & ARR_MOD_RIGHT)