1264fa531Smrg/*****************************************************************************
2264fa531SmrgCopyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts.
3264fa531Smrg
4264fa531Smrg                        All Rights Reserved
5264fa531Smrg
6dfac8f13SmrgPermission to use, copy, modify, and distribute this software and its
7dfac8f13Smrgdocumentation for any purpose and without fee is hereby granted,
8264fa531Smrgprovided that the above copyright notice appear in all copies and that
9dfac8f13Smrgboth that copyright notice and this permission notice appear in
10264fa531Smrgsupporting documentation, and that the name of Digital not be
11264fa531Smrgused in advertising or publicity pertaining to distribution of the
12dfac8f13Smrgsoftware without specific, written prior permission.
13264fa531Smrg
14264fa531SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
15264fa531SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
16264fa531SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
17264fa531SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
18264fa531SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
19264fa531SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
20264fa531SmrgSOFTWARE.
21264fa531Smrg
22264fa531Smrg******************************************************************************/
23264fa531Smrg
24264fa531Smrg#include "x11perf.h"
25264fa531Smrg
26264fa531Smrgstatic XArc *arcs;
27264fa531Smrgstatic GC   pgc;
28264fa531Smrg
29264fa531Smrg#define DegreesToX(degrees) (degrees * 64)
30264fa531Smrg
31dfac8f13Smrgstatic void
32264fa531SmrgGenerateCircles(XParms xp, Parms p, Bool partialArcs, Bool ddashed)
33264fa531Smrg{
34264fa531Smrg    int     rows;       /* Number of rows filled in current column	    */
35264fa531Smrg    int     x, y;       /* base of square to draw the circle in		    */
36264fa531Smrg    int     xorg, yorg; /* Used to get from column to column or row to row  */
37264fa531Smrg    int     size;
38264fa531Smrg    int     half;
39264fa531Smrg    int     startAngle, arcAngle;
40264fa531Smrg
41264fa531Smrg    if(ddashed)
42264fa531Smrg	pgc = xp->ddfggc;
43264fa531Smrg    else
44264fa531Smrg	pgc = xp->fggc;
45264fa531Smrg
46264fa531Smrg    size = p->special;
47264fa531Smrg    half = (size + 19) / 20;
48c9e4df9bSmrg    arcs = malloc((p->objects) * sizeof(XArc));
49264fa531Smrg    x = xorg = half; y = yorg = half;
50264fa531Smrg    rows = 0;
51264fa531Smrg    startAngle = DegreesToX(0);
52264fa531Smrg    arcAngle = DegreesToX(360);
53264fa531Smrg
54c9e4df9bSmrg    for (int i = 0; i != p->objects; i++) {
55264fa531Smrg	arcs[i].x = x;
56264fa531Smrg	arcs[i].y = y;
57264fa531Smrg	arcs[i].width = size;
58264fa531Smrg	arcs[i].height = size;
59264fa531Smrg	arcs[i].angle1 = startAngle;
60264fa531Smrg	arcs[i].angle2 = arcAngle;
61264fa531Smrg
62264fa531Smrg	if (partialArcs) {
63264fa531Smrg	    startAngle += DegreesToX(30);
64264fa531Smrg	    if (startAngle >= DegreesToX(360)) startAngle -= DegreesToX(360);
65264fa531Smrg	    arcAngle -= DegreesToX(20);
66264fa531Smrg	    if (arcAngle <= DegreesToX(0)) arcAngle += DegreesToX(360);
67264fa531Smrg	}
68264fa531Smrg
69264fa531Smrg	y += size + 1;
70264fa531Smrg	rows++;
71264fa531Smrg	if (y >= HEIGHT - size  - half || rows == MAXROWS) {
72264fa531Smrg	    /* Go to next column */
73264fa531Smrg	    rows = 0;
74264fa531Smrg	    x += size + 1;
75264fa531Smrg	    if (x >= WIDTH - size) {
76264fa531Smrg		yorg++;
77264fa531Smrg		if (yorg >= size + half || yorg >= HEIGHT - size - half) {
78264fa531Smrg		    yorg = half;
79264fa531Smrg		    xorg++;
80264fa531Smrg		    if (xorg >= size + half || xorg >= WIDTH - size - half) {
81264fa531Smrg			xorg = half;
82264fa531Smrg		    }
83264fa531Smrg		}
84264fa531Smrg		x = xorg;
85264fa531Smrg	    }
86264fa531Smrg	    y = yorg;
87264fa531Smrg	}
88264fa531Smrg    }
89264fa531Smrg}
90264fa531Smrg
91dfac8f13Smrgint
92533545b5SmrgInitCircles(XParms xp, Parms p, int64_t reps)
93264fa531Smrg{
94264fa531Smrg    GenerateCircles(xp, p, False, False);
95264fa531Smrg    return reps;
96264fa531Smrg}
97264fa531Smrg
98dfac8f13Smrgint
99533545b5SmrgInitPartCircles(XParms xp, Parms p, int64_t reps)
100264fa531Smrg{
101264fa531Smrg    GenerateCircles(xp, p, True, False);
102264fa531Smrg    return reps;
103264fa531Smrg}
104264fa531Smrg
105264fa531Smrg
106dfac8f13Smrgint
107533545b5SmrgInitChordPartCircles(XParms xp, Parms p, int64_t reps)
108264fa531Smrg{
109264fa531Smrg    GenerateCircles(xp, p, True, False);
110264fa531Smrg    XSetArcMode(xp->d, xp->bggc, ArcChord);
111264fa531Smrg    XSetArcMode(xp->d, xp->fggc, ArcChord);
112264fa531Smrg    return reps;
113264fa531Smrg}
114264fa531Smrg
115264fa531Smrg
116dfac8f13Smrgint
117533545b5SmrgInitSlicePartCircles(XParms xp, Parms p, int64_t reps)
118264fa531Smrg{
119264fa531Smrg    GenerateCircles(xp, p, True, False);
120264fa531Smrg    XSetArcMode(xp->d, xp->bggc, ArcPieSlice);
121264fa531Smrg    XSetArcMode(xp->d, xp->fggc, ArcPieSlice);
122264fa531Smrg    return reps;
123264fa531Smrg}
124264fa531Smrg
125264fa531Smrgstatic void
126264fa531SmrgGenerateWideCircles(XParms xp, Parms p, Bool partialArcs, Bool ddashed)
127264fa531Smrg{
128264fa531Smrg    int	    size;
129264fa531Smrg
130264fa531Smrg    GenerateCircles(xp, p, partialArcs, ddashed);
131264fa531Smrg
132264fa531Smrg    size = p->special;
133264fa531Smrg    if(ddashed) {
134264fa531Smrg	XSetLineAttributes(xp->d, xp->ddbggc, (int) ((size + 9) / 10),
135264fa531Smrg	    LineSolid, CapRound, JoinRound);
136264fa531Smrg	XSetLineAttributes(xp->d, xp->ddfggc, (int) ((size + 9) / 10),
137264fa531Smrg	    LineSolid, CapRound, JoinRound);
138264fa531Smrg    }
139264fa531Smrg    else {
140264fa531Smrg	XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10),
141264fa531Smrg	    LineSolid, CapRound, JoinRound);
142264fa531Smrg	XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10),
143264fa531Smrg	    LineSolid, CapRound, JoinRound);
144264fa531Smrg    }
145264fa531Smrg}
146264fa531Smrg
147dfac8f13Smrgint
148533545b5SmrgInitWideCircles(XParms xp, Parms p, int64_t reps)
149264fa531Smrg{
150264fa531Smrg    GenerateWideCircles (xp, p, False, False);
151264fa531Smrg    return reps;
152264fa531Smrg}
153dfac8f13Smrg
154dfac8f13Smrgint
155533545b5SmrgInitPartWideCircles(XParms xp, Parms p, int64_t reps)
156264fa531Smrg{
157264fa531Smrg    GenerateWideCircles (xp, p, True, False);
158264fa531Smrg    return reps;
159264fa531Smrg}
160dfac8f13Smrg
161dfac8f13Smrgint
162533545b5SmrgInitDashedCircles(XParms xp, Parms p, int64_t reps)
163264fa531Smrg{
164264fa531Smrg    char dashes[2];
165264fa531Smrg
166264fa531Smrg    GenerateCircles(xp, p, False, False);
167264fa531Smrg
168264fa531Smrg    /* Modify GCs to draw dashed */
169264fa531Smrg    XSetLineAttributes(xp->d, xp->bggc, 0, LineOnOffDash, CapButt, JoinMiter);
170264fa531Smrg    XSetLineAttributes(xp->d, xp->fggc, 0, LineOnOffDash, CapButt, JoinMiter);
171264fa531Smrg    dashes[0] = 3;   dashes[1] = 2;
172264fa531Smrg    XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
173264fa531Smrg    XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
174264fa531Smrg    return reps;
175264fa531Smrg}
176264fa531Smrg
177dfac8f13Smrgint
178533545b5SmrgInitWideDashedCircles(XParms xp, Parms p, int64_t reps)
179264fa531Smrg{
180264fa531Smrg    int		size;
181264fa531Smrg    XGCValues   gcv;
182264fa531Smrg    char	dashes[2];
183264fa531Smrg
184264fa531Smrg    GenerateWideCircles(xp, p, False, False);
185264fa531Smrg    size = p->special;
186264fa531Smrg    size = (size + 9) / 10;
187264fa531Smrg
188264fa531Smrg    /* Modify GCs to draw dashed */
189264fa531Smrg    dashes[0] = 2*size;   dashes[1] = 2*size;
190264fa531Smrg    gcv.line_style = LineOnOffDash;
191264fa531Smrg    XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv);
192264fa531Smrg    XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv);
193264fa531Smrg    XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
194264fa531Smrg    XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
195264fa531Smrg    return reps;
196264fa531Smrg}
197264fa531Smrg
198dfac8f13Smrgint
199533545b5SmrgInitDoubleDashedCircles(XParms xp, Parms p, int64_t reps)
200264fa531Smrg{
201264fa531Smrg    char dashes[2];
202264fa531Smrg
203264fa531Smrg    GenerateCircles(xp, p, False, True);
204264fa531Smrg
205264fa531Smrg    /* Modify GCs to draw dashed */
206264fa531Smrg    XSetLineAttributes(xp->d, xp->ddbggc, 0, LineDoubleDash, CapButt, JoinMiter);
207264fa531Smrg    XSetLineAttributes(xp->d, xp->ddfggc, 0, LineDoubleDash, CapButt, JoinMiter);
208264fa531Smrg    dashes[0] = 3;   dashes[1] = 2;
209264fa531Smrg    XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2);
210264fa531Smrg    XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2);
211264fa531Smrg    return reps;
212264fa531Smrg}
213264fa531Smrg
214dfac8f13Smrgint
215533545b5SmrgInitWideDoubleDashedCircles(XParms xp, Parms p, int64_t reps)
216264fa531Smrg{
217264fa531Smrg    int		size;
218264fa531Smrg    XGCValues   gcv;
219264fa531Smrg    char	dashes[2];
220264fa531Smrg
221264fa531Smrg    GenerateWideCircles(xp, p, False, True);
222264fa531Smrg    size = p->special;
223264fa531Smrg    size = (size + 9) / 10;
224264fa531Smrg
225264fa531Smrg    /* Modify GCs to draw dashed */
226264fa531Smrg    dashes[0] = 2*size;   dashes[1] = 2*size;
227264fa531Smrg    gcv.line_style = LineDoubleDash;
228264fa531Smrg    XChangeGC(xp->d, xp->ddfggc, GCLineStyle, &gcv);
229264fa531Smrg    XChangeGC(xp->d, xp->ddbggc, GCLineStyle, &gcv);
230264fa531Smrg    XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2);
231264fa531Smrg    XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2);
232264fa531Smrg    return reps;
233264fa531Smrg}
234264fa531Smrg
235dfac8f13Smrgstatic void
236264fa531SmrgGenerateEllipses(XParms xp, Parms p, int partialArcs, Bool ddashed)
237264fa531Smrg{
238264fa531Smrg    int     size;
239264fa531Smrg    int     half;
240264fa531Smrg    int     rows;       /* Number of rows filled in current column	    */
241264fa531Smrg    int     x, y;	    /* base of square to draw ellipse in	    */
242264fa531Smrg    int     vsize, vsizeinc;
243264fa531Smrg    int     dir;
244264fa531Smrg    int     startAngle, arcAngle;
245264fa531Smrg
246264fa531Smrg    if(ddashed)
247264fa531Smrg	pgc = xp->ddfggc;
248264fa531Smrg    else
249264fa531Smrg	pgc = xp->fggc;
250264fa531Smrg
251264fa531Smrg    size = p->special;
252264fa531Smrg    half = (size + 19) / 20;
253c9e4df9bSmrg    arcs = malloc((p->objects) * sizeof(XArc));
254264fa531Smrg    vsize = 1;
255264fa531Smrg    vsizeinc = (size - 1) / (p->objects - 1);
256264fa531Smrg    if (vsizeinc == 0) vsizeinc = 1;
257264fa531Smrg
258264fa531Smrg    x = half; y = half;
259264fa531Smrg    dir = 0;
260264fa531Smrg    rows = 0;
261264fa531Smrg    startAngle = DegreesToX(0);
262264fa531Smrg    arcAngle = DegreesToX(360);
263264fa531Smrg
264c9e4df9bSmrg    for (int i = 0; i != p->objects; i++) {
265264fa531Smrg	arcs[i].x = x;
266264fa531Smrg	arcs[i].y = y;
267264fa531Smrg	if ((i & 1) ^ dir) {
268264fa531Smrg	    /* Make vertical axis longer */
269264fa531Smrg	    arcs[i].width = vsize;
270264fa531Smrg	    arcs[i].height = size;
271264fa531Smrg	} else {
272264fa531Smrg	    /* Make horizontal axis longer */
273264fa531Smrg	    arcs[i].width = size;
274264fa531Smrg	    arcs[i].height = vsize;
275264fa531Smrg	}
276264fa531Smrg	arcs[i].angle1 = startAngle;
277264fa531Smrg	arcs[i].angle2 = arcAngle;
278264fa531Smrg
279264fa531Smrg	if (partialArcs) {
280264fa531Smrg	    startAngle += DegreesToX(30);
281264fa531Smrg	    if (startAngle >= DegreesToX(360)) startAngle -= DegreesToX(360);
282264fa531Smrg	    arcAngle -= DegreesToX(20);
283264fa531Smrg	    if (arcAngle <= DegreesToX(0)) arcAngle += DegreesToX(360);
284264fa531Smrg	}
285264fa531Smrg
286264fa531Smrg	y += size + 1;
287264fa531Smrg	rows++;
288264fa531Smrg	if (y >= HEIGHT - size - half || rows == MAXROWS) {
289264fa531Smrg	    /* Go to next column */
290264fa531Smrg	    rows = 0;
291264fa531Smrg	    y = half;
292264fa531Smrg	    x += size + 1;
293264fa531Smrg	    if (x >= WIDTH - size - half) {
294264fa531Smrg		x = half;
295264fa531Smrg	    }
296264fa531Smrg	}
297dfac8f13Smrg
298264fa531Smrg	vsize += vsizeinc;
299264fa531Smrg	if (vsize > size) {
300264fa531Smrg	    vsize -= size;
301264fa531Smrg	    dir = 1 - dir;
302264fa531Smrg	}
303264fa531Smrg    }
304264fa531Smrg}
305264fa531Smrg
306dfac8f13Smrgint
307533545b5SmrgInitEllipses(XParms xp, Parms p, int64_t reps)
308264fa531Smrg{
309264fa531Smrg    GenerateEllipses(xp, p, False, False);
310264fa531Smrg    return reps;
311264fa531Smrg}
312264fa531Smrg
313264fa531Smrg
314dfac8f13Smrgint
315533545b5SmrgInitPartEllipses(XParms xp, Parms p, int64_t reps)
316264fa531Smrg{
317264fa531Smrg    GenerateEllipses(xp, p, True, False);
318264fa531Smrg    return reps;
319264fa531Smrg}
320264fa531Smrg
321264fa531Smrg
322dfac8f13Smrgint
323533545b5SmrgInitChordPartEllipses(XParms xp, Parms p, int64_t reps)
324264fa531Smrg{
325264fa531Smrg    GenerateEllipses(xp, p, True, False);
326264fa531Smrg    XSetArcMode(xp->d, xp->bggc, ArcChord);
327264fa531Smrg    XSetArcMode(xp->d, xp->fggc, ArcChord);
328264fa531Smrg    return reps;
329264fa531Smrg}
330264fa531Smrg
331264fa531Smrg
332dfac8f13Smrgint
333533545b5SmrgInitSlicePartEllipses(XParms xp, Parms p, int64_t reps)
334264fa531Smrg{
335264fa531Smrg    GenerateEllipses(xp, p, True, False);
336264fa531Smrg    XSetArcMode(xp->d, xp->bggc, ArcPieSlice);
337264fa531Smrg    XSetArcMode(xp->d, xp->fggc, ArcPieSlice);
338264fa531Smrg    return reps;
339264fa531Smrg}
340264fa531Smrg
341264fa531Smrg
342264fa531Smrgstatic void
343264fa531SmrgGenerateWideEllipses(XParms xp, Parms p, Bool partialArcs, Bool ddashed)
344264fa531Smrg{
345264fa531Smrg    int size;
346264fa531Smrg
347264fa531Smrg    GenerateEllipses (xp, p, partialArcs, ddashed);
348264fa531Smrg    size = p->special;
349264fa531Smrg    if(ddashed) {
350264fa531Smrg	XSetLineAttributes(xp->d, xp->ddbggc, (int) ((size + 9) / 10),
351264fa531Smrg	    LineSolid, CapRound, JoinRound);
352264fa531Smrg	XSetLineAttributes(xp->d, xp->ddfggc, (int) ((size + 9) / 10),
353264fa531Smrg	    LineSolid, CapRound, JoinRound);
354264fa531Smrg    }
355264fa531Smrg    else {
356264fa531Smrg	XSetLineAttributes(xp->d, xp->bggc, (int) ((size + 9) / 10),
357264fa531Smrg	    LineSolid, CapRound, JoinRound);
358264fa531Smrg	XSetLineAttributes(xp->d, xp->fggc, (int) ((size + 9) / 10),
359264fa531Smrg	    LineSolid, CapRound, JoinRound);
360264fa531Smrg    }
361264fa531Smrg
362264fa531Smrg}
363264fa531Smrg
364dfac8f13Smrgint
365533545b5SmrgInitWideEllipses(XParms xp, Parms p, int64_t reps)
366264fa531Smrg{
367264fa531Smrg    GenerateWideEllipses(xp, p, False, False);
368264fa531Smrg    return reps;
369264fa531Smrg}
370dfac8f13Smrg
371dfac8f13Smrgint
372533545b5SmrgInitPartWideEllipses(XParms xp, Parms p, int64_t reps)
373264fa531Smrg{
374264fa531Smrg    GenerateWideEllipses(xp, p, True, False);
375264fa531Smrg    return reps;
376264fa531Smrg}
377dfac8f13Smrg
378dfac8f13Smrgint
379533545b5SmrgInitDashedEllipses(XParms xp, Parms p, int64_t reps)
380264fa531Smrg{
381264fa531Smrg    char dashes[2];
382264fa531Smrg
383264fa531Smrg    GenerateEllipses(xp, p, False, False);
384264fa531Smrg
385264fa531Smrg    /* Modify GCs to draw dashed */
386264fa531Smrg    XSetLineAttributes(xp->d, xp->bggc, 0, LineOnOffDash, CapButt, JoinMiter);
387264fa531Smrg    XSetLineAttributes(xp->d, xp->fggc, 0, LineOnOffDash, CapButt, JoinMiter);
388264fa531Smrg    dashes[0] = 3;   dashes[1] = 2;
389264fa531Smrg    XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
390264fa531Smrg    XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
391264fa531Smrg    return reps;
392264fa531Smrg}
393264fa531Smrg
394dfac8f13Smrgint
395533545b5SmrgInitWideDashedEllipses(XParms xp, Parms p, int64_t reps)
396264fa531Smrg{
397264fa531Smrg    int		size;
398264fa531Smrg    XGCValues   gcv;
399264fa531Smrg    char	dashes[2];
400264fa531Smrg
401264fa531Smrg    GenerateWideEllipses(xp, p, False, False);
402264fa531Smrg    size = p->special;
403264fa531Smrg    size = (size + 9) / 10;
404264fa531Smrg
405264fa531Smrg    /* Modify GCs to draw dashed */
406264fa531Smrg    dashes[0] = 2*size;   dashes[1] = 2*size;
407264fa531Smrg    gcv.line_style = LineOnOffDash;
408264fa531Smrg    XChangeGC(xp->d, xp->fggc, GCLineStyle, &gcv);
409264fa531Smrg    XChangeGC(xp->d, xp->bggc, GCLineStyle, &gcv);
410264fa531Smrg    XSetDashes(xp->d, xp->fggc, 0, dashes, 2);
411264fa531Smrg    XSetDashes(xp->d, xp->bggc, 0, dashes, 2);
412264fa531Smrg    return reps;
413264fa531Smrg}
414264fa531Smrg
415dfac8f13Smrgint
416533545b5SmrgInitDoubleDashedEllipses(XParms xp, Parms p, int64_t reps)
417264fa531Smrg{
418264fa531Smrg    char dashes[2];
419264fa531Smrg
420264fa531Smrg    GenerateEllipses(xp, p, False, True);
421264fa531Smrg
422264fa531Smrg    /* Modify GCs to draw dashed */
423264fa531Smrg    XSetLineAttributes(xp->d, xp->ddbggc, 0, LineDoubleDash, CapButt, JoinMiter);
424264fa531Smrg    XSetLineAttributes(xp->d, xp->ddfggc, 0, LineDoubleDash, CapButt, JoinMiter);
425264fa531Smrg    dashes[0] = 3;   dashes[1] = 2;
426264fa531Smrg    XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2);
427264fa531Smrg    XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2);
428264fa531Smrg    return reps;
429264fa531Smrg}
430264fa531Smrg
431dfac8f13Smrgint
432533545b5SmrgInitWideDoubleDashedEllipses(XParms xp, Parms p, int64_t reps)
433264fa531Smrg{
434264fa531Smrg    int		size;
435264fa531Smrg    XGCValues   gcv;
436264fa531Smrg    char	dashes[2];
437264fa531Smrg
438264fa531Smrg    GenerateWideEllipses(xp, p, False, True);
439264fa531Smrg    size = p->special;
440264fa531Smrg    size = (size + 9) / 10;
441264fa531Smrg
442264fa531Smrg    /* Modify GCs to draw dashed */
443264fa531Smrg    dashes[0] = 2*size;   dashes[1] = 2*size;
444264fa531Smrg    gcv.line_style = LineDoubleDash;
445264fa531Smrg    XChangeGC(xp->d, xp->ddfggc, GCLineStyle, &gcv);
446264fa531Smrg    XChangeGC(xp->d, xp->ddbggc, GCLineStyle, &gcv);
447264fa531Smrg    XSetDashes(xp->d, xp->ddfggc, 0, dashes, 2);
448264fa531Smrg    XSetDashes(xp->d, xp->ddbggc, 0, dashes, 2);
449264fa531Smrg    return reps;
450264fa531Smrg}
451264fa531Smrg
452dfac8f13Smrgvoid
453533545b5SmrgDoArcs(XParms xp, Parms p, int64_t reps)
454264fa531Smrg{
455c9e4df9bSmrg    for (int i = 0; i != reps; i++) {
456264fa531Smrg        XDrawArcs(xp->d, xp->w, pgc, arcs, p->objects);
457264fa531Smrg        if (pgc == xp->ddbggc)
458264fa531Smrg            pgc = xp->ddfggc;
459264fa531Smrg        else if(pgc == xp->ddfggc)
460264fa531Smrg            pgc = xp->ddbggc;
461264fa531Smrg        else if (pgc == xp->bggc)
462264fa531Smrg            pgc = xp->fggc;
463264fa531Smrg        else
464264fa531Smrg            pgc = xp->bggc;
465264fa531Smrg	CheckAbort ();
466264fa531Smrg    }
467264fa531Smrg}
468264fa531Smrg
469dfac8f13Smrgvoid
470533545b5SmrgDoFilledArcs(XParms xp, Parms p, int64_t reps)
471264fa531Smrg{
472c9e4df9bSmrg    for (int i = 0; i != reps; i++) {
473264fa531Smrg        XFillArcs(xp->d, xp->w, pgc, arcs, p->objects);
474264fa531Smrg        if (pgc == xp->ddbggc)
475264fa531Smrg            pgc = xp->ddfggc;
476264fa531Smrg        else if(pgc == xp->ddfggc)
477264fa531Smrg            pgc = xp->ddbggc;
478264fa531Smrg        else if (pgc == xp->bggc)
479264fa531Smrg            pgc = xp->fggc;
480264fa531Smrg        else
481264fa531Smrg            pgc = xp->bggc;
482264fa531Smrg	CheckAbort ();
483264fa531Smrg    }
484264fa531Smrg}
485264fa531Smrg
486dfac8f13Smrgvoid
487264fa531SmrgEndArcs(XParms xp, Parms p)
488264fa531Smrg{
489264fa531Smrg    free(arcs);
490264fa531Smrg}
491264fa531Smrg
492