xref: /plan9/sys/src/libmemdraw/arctest.c (revision 2ffcfecaa1dd9eb9b97ec396dfbb491b6e1d0703)
1 #include <u.h>
2 #include <libc.h>
3 #include <draw.h>
4 #include <memdraw.h>
5 #include <memlayer.h>
6 
7 extern int drawdebug;
8 void
main(int argc,char ** argv)9 main(int argc, char **argv)
10 {
11 	Memimage *x;
12 	Point c = {208,871};
13 	int a = 441;
14 	int b = 441;
15 	int thick = 0;
16 	Point sp = {0,0};
17 	int alpha = 51;
18 	int phi = 3;
19 	vlong t0, t1;
20 	int i, n;
21 	vlong del;
22 
23 	if (argc != 2) {
24 		fprint(2, "usage: arctest number\n");
25 		exits("usage");
26 	}
27 	memimageinit();
28 
29 	x = allocmemimage(Rect(0,0,1000,1000), CMAP8);
30 	n = atoi(argv[1]);
31 
32 	t0 = nsec();
33 	t0 = nsec();
34 	t0 = nsec();
35 	t1 = nsec();
36 	del = t1-t0;
37 	t0 = nsec();
38 	for(i=0; i<n; i++)
39 		memarc(x, c, a, b, thick, memblack, sp, alpha, phi, SoverD);
40 	t1 = nsec();
41 	print("%lld %lld\n", t1-t0-del, del);
42 }
43 
44 int drawdebug = 0;
45 
46 void
rdb(void)47 rdb(void)
48 {
49 }
50 
51 int
iprint(char * fmt,...)52 iprint(char *fmt, ...)
53 {
54 	int n;
55 	va_list va;
56 	char buf[1024];
57 
58 	va_start(va, fmt);
59 	n = vseprint(buf, buf+sizeof buf, fmt, va) - buf;
60 	va_end(va);
61 
62 	write(1,buf,n);
63 	return 1;
64 }
65 
66