From: Magnus Jacobsson Date: Thu, 6 Oct 2022 07:22:25 +0000 (+0200) Subject: arrows: factor out arrow_type_diamond0 function X-Git-Tag: 7.0.1~18^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=643aed84dc95f81064d4492f89300cb18586895b;p=graphviz arrows: factor out arrow_type_diamond0 function Towards https://gitlab.com/graphviz/graphviz/-/issues/372. --- diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 6a089c696..faf7a932f 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -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)