From: Magnus Jacobsson Date: Sun, 17 Apr 2022 16:05:47 +0000 (+0200) Subject: arrows: factor out arrow_type_normal0 function X-Git-Tag: 7.0.0~21^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9b7611e72bccbd5158e6a0a7ad958369f0eb79b;p=graphviz arrows: factor out arrow_type_normal0 function Towards https://gitlab.com/graphviz/graphviz/-/issues/372. --- diff --git a/lib/common/arrows.c b/lib/common/arrows.c index 1c82594dd..f03325576 100644 --- a/lib/common/arrows.c +++ b/lib/common/arrows.c @@ -466,11 +466,9 @@ static pointf miter_point(pointf base_left, pointf P, pointf base_right, return P3; } -static pointf arrow_type_normal(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag) +static pointf arrow_type_normal0(pointf p, pointf u, double penwidth, int flag, pointf* a) { - (void)arrowsize; - - pointf q, v, a[5]; + pointf q, v; double arrowwidth; arrowwidth = 0.35; @@ -529,6 +527,18 @@ static pointf arrow_type_normal(GVJ_t * job, pointf p, pointf u, double arrowsiz q.x -= delta_base.x; q.y -= delta_base.y; } + + return q; +} + +static pointf arrow_type_normal(GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag) +{ + (void)arrowsize; + + pointf a[5]; + + pointf q = arrow_type_normal0(p, u, penwidth, flag, a); + if (flag & ARR_MOD_LEFT) gvrender_polygon(job, a, 3, !(flag & ARR_MOD_OPEN)); else if (flag & ARR_MOD_RIGHT)