Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1502 | giacomo | 1 | |
2 | #include <kernel/kern.h> |
||
3 | #include <tracer.h> |
||
4 | |||
5 | #define PWCET_Automatic_Ipoint(a) TRACER_LOGEVENT(FTrace_EVT_ipoint,(a),0); |
||
6 | |||
7 | /* here are the bezier curves defined |
||
8 | format: |
||
9 | {startpoint, endpoint, controlpoint1, controlpoint} |
||
10 | . |
||
11 | . |
||
12 | . */ |
||
13 | int curveno = 20; |
||
14 | int data[20][4][2] = { |
||
15 | {{123,321},{ 23,432},{345,120},{123, 98}}, |
||
16 | {{567, 31},{ 23, 24},{ 35,421},{123,398}}, |
||
17 | {{ 0, 21},{623,532},{145,323},{153, 68}}, |
||
18 | {{253,321},{ 23,432},{745,525},{423,198}}, |
||
19 | {{123,456},{ 23,482},{ 0,123},{123,128}}, |
||
20 | {{322, 21},{223,232},{ 45,224},{123,98}}, |
||
21 | {{423, 32},{123,332},{144,329},{123,98}}, |
||
22 | {{276, 35},{ 23,492},{476,423},{123,98}}, |
||
23 | {{783,121},{723,139},{ 78,528},{123,98}}, |
||
24 | {{723,221},{623, 98},{734,683},{123,98}}, |
||
25 | {{ 60,421},{523,132},{364,753},{123,98}}, |
||
26 | {{100,521},{423,432},{633,623},{123,98}}, |
||
27 | {{ 23,371},{323,599},{343,533},{123,98}}, |
||
28 | {{123,123},{123, 0},{343,403},{123,98}}, |
||
29 | {{253,321},{490, 32},{347,393},{123,98}}, |
||
30 | {{ 68,321},{260,272},{674,283},{123,98}}, |
||
31 | {{500,321},{245,373},{ 98,173},{123,98}}, |
||
32 | {{423,321},{198,532},{306, 63},{123,98}}, |
||
33 | {{197,321},{203,432},{307,443},{123,98}}, |
||
34 | {{143,321},{293,132},{334,393},{123,98}} |
||
35 | }; |
||
36 | #define STEPWIDTH 0.01 /* draws 1/STEPWIDTH +1 points between SP and EP */ |
||
37 | #define XSIZE 800 |
||
38 | #define YSIZE 600 |
||
39 | |||
40 | char screen[YSIZE][XSIZE]; |
||
41 | int xco[4],yco[4]; |
||
42 | |||
43 | void init() |
||
44 | { /*FB1*/PWCET_Automatic_Ipoint( 3157); /*FB2*/{ |
||
45 | int y,x; |
||
46 | |||
47 | |||
48 | { /*forx1*/for (x = 0; x < XSIZE;x++) { /*forx2*/PWCET_Automatic_Ipoint( 3158); /*forx3*/{ |
||
49 | { /*forx1*/for (y = 0;y < YSIZE;y++) { /*forx2*/PWCET_Automatic_Ipoint( 3159); /*forx3*/{ |
||
50 | screen[y][x] = 255; |
||
51 | } } /*forx4*/PWCET_Automatic_Ipoint( 3160); /*forx5*/ } /*forx6*/ |
||
52 | } } /*forx4*/PWCET_Automatic_Ipoint( 3161); /*forx5*/ } /*forx6*/ |
||
53 | |||
54 | }PWCET_Automatic_Ipoint( 3162); /*FB3*/} /*FB4*/ |
||
55 | |||
56 | void rand_init() |
||
57 | { /*FB1*/PWCET_Automatic_Ipoint( 33519); /*FB2*/{ |
||
58 | int i,j,x,y; |
||
59 | |||
60 | |||
61 | |||
62 | { /*forx1*/for (i=0;i<20;i++) |
||
63 | { /*forx1*/ { /*forx2*/PWCET_Automatic_Ipoint( 33520); /*forx3*/for (j=0;j<4;j++) { /*forx2*/PWCET_Automatic_Ipoint( 33521); /*forx3*/{ |
||
64 | x=rand()%XSIZE; |
||
65 | y=rand()%YSIZE; |
||
66 | data[i][j][0]=x; |
||
67 | data[i][j][1]=y; |
||
68 | } } /*forx4*/PWCET_Automatic_Ipoint( 33522); /*forx5*/ } /*forx6*/ } /*forx4*/PWCET_Automatic_Ipoint( 33523); /*forx5*/ } /*forx6*/ |
||
69 | |||
70 | |||
71 | }PWCET_Automatic_Ipoint( 33524); /*FB3*/} /*FB4*/ |
||
72 | |||
73 | void pepe(){ /*FB1*/PWCET_Automatic_Ipoint( 64662); /*FB2*/{ |
||
74 | int a; |
||
75 | |||
76 | a=a+2; |
||
77 | }PWCET_Automatic_Ipoint( 64663); /*FB3*/} /*FB4*/ |
||
78 | |||
79 | int bezier() |
||
80 | { /*FB1*/PWCET_Automatic_Ipoint( 23955); /*FB2*/{ |
||
81 | int i,y,x; |
||
82 | float k; |
||
83 | init(); |
||
84 | |||
85 | { /*forx1*/for (i = 0;i < curveno;i++) { /*forx2*/PWCET_Automatic_Ipoint( 23956); /*forx3*/{ |
||
86 | xco[3] = data[i][0][0]; |
||
87 | yco[3] = data[i][0][1]; |
||
88 | xco[2] = 3*(data[i][2][0] - data[i][0][0]); |
||
89 | yco[2] = 3*(data[i][2][1] - data[i][0][1]); |
||
90 | xco[1] = 3*(data[i][3][0] - data[i][2][0]) - xco[2]; |
||
91 | yco[1] = 3*(data[i][3][1] - data[i][2][1]) - yco[2]; |
||
92 | xco[0] = data[i][1][0] - data[i][0][0] - xco[2]- xco[1]; |
||
93 | yco[0] = data[i][1][1] - data[i][0][1] - yco[2]- yco[1]; |
||
94 | |||
95 | |||
96 | { /*forx1*/for (k = 0;k <=1;k+=0.01) { /*forx2*/PWCET_Automatic_Ipoint( 23957); /*forx3*/{ |
||
97 | x = (int)(((float)xco[0]*k*k*k)+((float)xco[1]*k*k)+((float)xco[2]*k)+(float)xco[3]); |
||
98 | y = (int)(((float)yco[0]*k*k*k)+((float)yco[1]*k*k)+((float)yco[2]*k)+(float)yco[3]); |
||
99 | if ((x < XSIZE)&&(x > 0)&&(y < YSIZE)&&(y > 0)) { /*if1*/ PWCET_Automatic_Ipoint( 23958); /*if2*/ { |
||
100 | |||
101 | screen[y][x] = 0; |
||
102 | } } /*if3*/ PWCET_Automatic_Ipoint( 23959); /*ifxxx2*/ |
||
103 | } } /*forx4*/PWCET_Automatic_Ipoint( 23960); /*forx5*/ } /*forx6*/ |
||
104 | } } /*forx4*/PWCET_Automatic_Ipoint( 23961); /*forx5*/ } /*forx6*/ |
||
105 | if (1==0) { /*if1*/ PWCET_Automatic_Ipoint( 23962); /*if2*/ { |
||
106 | k++; |
||
107 | pepe(); |
||
108 | } } /*if3*/ PWCET_Automatic_Ipoint( 23963); /*ifxxx2*/ |
||
109 | |||
110 | |||
111 | { /*returnE1*/PWCET_Automatic_Ipoint( 23964); /*returnE2*/return 0; } /*returnE3*/ |
||
112 | }PWCET_Automatic_Ipoint( 23965); /*FB3*/} /*FB4*/ |
||
113 | |||
114 | |||
115 | int instrumented_function(){ /*FB1*/PWCET_Automatic_Ipoint( 18549); /*FB2*/{ |
||
116 | |||
117 | rand_init(); |
||
118 | bezier(); |
||
119 | { /*returnE1*/PWCET_Automatic_Ipoint( 18550); /*returnE2*/return 0; } /*returnE3*/ |
||
120 | }PWCET_Automatic_Ipoint( 18551); /*FB3*/} /*FB4*/ |