blob: 4643ade47e3720fd41d71597a574ea9c9bffefd2 [file] [log] [blame]
caryclark@google.com32546db2012-08-31 20:55:07 +00001<!-- path visualizer -->
caryclark@google.com752b60e2012-03-22 21:11:17 +00002<html>
3<head>
4<div style="height:0">
caryclark@google.comfa0588f2012-04-26 21:01:06 +00005
6<div id="testSimplifyQuadratic1">
7 SkPath path, out;
8 path.moveTo(0, 0);
9 path.quadTo(1, 0, 1, 1);
10 path.close();
11 path.moveTo(1, 0);
12 path.quadTo(0, 0, 0, 1);
13 path.close();
14 testSimplify(path, true, out, bitmap);
15}
caryclark@google.com752b60e2012-03-22 21:11:17 +000016</div>
caryclark@google.comfa0588f2012-04-26 21:01:06 +000017
18<div id="testSimplifyQuadratic2">
19 SkPath path, out;
20 path.moveTo(0, 0);
21 path.quadTo(20, 0, 20, 20);
22 path.close();
23 path.moveTo(20, 0);
24 path.quadTo(0, 0, 0, 20);
25 path.close();
26 testSimplify(path, true, out, bitmap);
27}
caryclark@google.comd88e0892012-03-27 13:23:51 +000028</div>
caryclark@google.comfa0588f2012-04-26 21:01:06 +000029
30<div id="testSimplifyQuadratic3">
31 SkPath path, out;
32 path.moveTo(0, 0);
33 path.quadTo(20, 0, 20, 20);
34 path.close();
35 path.moveTo(0, 20);
36 path.quadTo(0, 0, 20, 0);
37 path.close();
38 testSimplify(path, true, out, bitmap);
39}
caryclark@google.comd88e0892012-03-27 13:23:51 +000040</div>
caryclark@google.comfa0588f2012-04-26 21:01:06 +000041
42<div id="testSimplifyQuadratic4">
43 SkPath path, out;
44 path.moveTo(0, 20);
45 path.quadTo(20, 0, 40, 20);
46 path.close();
47 path.moveTo(40, 10);
48 path.quadTo(20, 30, 0, 10);
49 path.close();
50 testSimplify(path, true, out, bitmap);
51 drawAsciiPaths(path, out, true);
52}
caryclark@google.comd88e0892012-03-27 13:23:51 +000053</div>
caryclark@google.comfa0588f2012-04-26 21:01:06 +000054
55<div id="testSimplifyQuadratic5">
56 SkPath path, out;
57 path.moveTo(0, 0);
58 path.quadTo(0, 0, 0, 0);
59 path.lineTo(0, 0);
60 path.close();
61 path.moveTo(0, 0);
62 path.lineTo(0, 0);
63 path.quadTo(0, 0, 0, 1);
64 path.close();
65 testSimplify(path, true, out, bitmap);
66 drawAsciiPaths(path, out, true);
67}
caryclark@google.comfb173422012-04-10 18:28:55 +000068</div>
caryclark@google.comfa0588f2012-04-26 21:01:06 +000069
70<div id="testSimplifyQuadratic6">
71 SkPath path, out;
72 path.moveTo(0, 0);
73 path.quadTo(0, 0, 0, 0);
74 path.lineTo(1, 0);
75 path.close();
76 path.moveTo(0, 0);
77 path.lineTo(0, 0);
78 path.quadTo(1, 0, 0, 1);
79 path.close();
80 testSimplify(path, true, out, bitmap);
81 drawAsciiPaths(path, out, true);
82}
caryclark@google.comfb173422012-04-10 18:28:55 +000083</div>
caryclark@google.comfa0588f2012-04-26 21:01:06 +000084
85<div id="testSimplifyQuadratic7">
86 SkPath path, out;
87 path.moveTo(0, 0);
88 path.quadTo(0, 0, 0, 0);
89 path.lineTo(0, 1);
90 path.close();
91 path.moveTo(0, 0);
92 path.lineTo(0, 0);
93 path.quadTo(1, 0, 0, 2);
94 path.close();
95 testSimplify(path, true, out, bitmap);
96 drawAsciiPaths(path, out, true);
97}
98</div>
99
100<div id="testSimplifyQuadratic8">
101 SkPath path, out;
102 path.moveTo(0, 0);
103 path.quadTo(0, 0, 0, 0);
104 path.lineTo(0, 0);
105 path.close();
106 path.moveTo(0, 0);
107 path.lineTo(0, 0);
108 path.quadTo(1, 0, 0, 2);
109 path.close();
110 testSimplify(path, true, out, bitmap);
111 drawAsciiPaths(path, out, true);
112}
113</div>
114
115<div id="testSimplifyQuadratic9">
116 SkPath path, out;
117 path.moveTo(0, 0);
118 path.quadTo(0, 0, 0, 0);
119 path.lineTo(1, 1);
120 path.close();
121 path.moveTo(0, 0);
122 path.lineTo(0, 0);
123 path.quadTo(1, 0, 2, 2);
124 path.close();
125 testSimplify(path, true, out, bitmap);
126 drawAsciiPaths(path, out, true);
127}
128</div>
129
130<div id="testSimplifyQuadratic10">
131 SkPath path, out;
caryclark@google.com78e17132012-04-17 11:40:34 +0000132 path.moveTo(0, 0);
133 path.quadTo(0, 0, 0, 0);
134 path.lineTo(0, 0);
135 path.close();
136 path.moveTo(0, 0);
137 path.lineTo(0, 1);
138 path.quadTo(1, 1, 1, 2);
caryclark@google.com78e17132012-04-17 11:40:34 +0000139 path.close();
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000140 testSimplify(path, true, out, bitmap);
141 drawAsciiPaths(path, out, true);
142}
caryclark@google.com78e17132012-04-17 11:40:34 +0000143</div>
144
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000145<div id="testSimplifyQuadratic11">
146 SkPath path, out;
caryclark@google.com78e17132012-04-17 11:40:34 +0000147 path.moveTo(0, 0);
148 path.quadTo(0, 0, 0, 0);
149 path.lineTo(0, 2);
caryclark@google.com78e17132012-04-17 11:40:34 +0000150 path.close();
151 path.moveTo(0, 0);
152 path.lineTo(2, 1);
153 path.quadTo(2, 2, 3, 3);
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000154 path.close();
155 testSimplify(path, true, out, bitmap);
156 drawAsciiPaths(path, out, true);
157}
158</div>
159
160<div id="testSimplifyQuadratic12">
161 SkPath path, out;
162 path.moveTo(0, 0);
163 path.lineTo(0, 2);
caryclark@google.com78e17132012-04-17 11:40:34 +0000164 path.lineTo(0, 0);
165 path.close();
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000166 path.moveTo(3, 0);
167 path.quadTo(1, 1, 0, 2);
168 path.lineTo(3, 0);
169 path.close();
170 testSimplify(path, true, out, bitmap);
171 drawAsciiPaths(path, out, true);
172}
caryclark@google.com78e17132012-04-17 11:40:34 +0000173</div>
174
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000175<div id="testSimplifyQuadratic13">
176 SkPath path, out;
caryclark@google.com78e17132012-04-17 11:40:34 +0000177path.moveTo(0, 0);
178path.quadTo(0, 0, 1, 0);
179path.lineTo(1, 1);
180path.lineTo(0, 0);
181path.close();
182path.moveTo(0, 0);
183path.quadTo(3, 0, 1, 1);
184path.lineTo(0, 0);
185path.close();
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000186 testSimplify(path, true, out, bitmap);
187 drawAsciiPaths(path, out, true);
188}
caryclark@google.com78e17132012-04-17 11:40:34 +0000189</div>
190
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000191<div id="testSimplifyQuadratic14">
192 SkPath path, out;
caryclark@google.com78e17132012-04-17 11:40:34 +0000193 path.moveTo(0, 0);
194 path.quadTo(0, 0, 0, 0);
195 path.lineTo(1, 1);
caryclark@google.com78e17132012-04-17 11:40:34 +0000196 path.close();
197 path.moveTo(0, 0);
198 path.lineTo(0, 0);
199 path.quadTo(0, 1, 2, 1);
caryclark@google.com78e17132012-04-17 11:40:34 +0000200 path.close();
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000201 testSimplify(path, true, out, bitmap);
202 drawAsciiPaths(path, out, true);
203}
caryclark@google.com78e17132012-04-17 11:40:34 +0000204</div>
205
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000206<div id="testSimplifyQuadratic15">
207 SkPath path, out;
208 path.moveTo(0, 0);
209 path.quadTo(0, 0, 1, 3);
210 path.lineTo(3, 3);
211 path.close();
212 path.moveTo(0, 1);
213 path.lineTo(1, 1);
214 path.quadTo(0, 3, 3, 3);
215 path.close();
216 testSimplify(path, true, out, bitmap);
217 drawAsciiPaths(path, out, true);
218}
219</div>
220
221<div id="testSimplifyQuadratic16">
222 SkPath path, out;
223 path.moveTo(0, 0);
224 path.quadTo(0, 0, 0, 0);
225 path.lineTo(0, 1);
226 path.close();
227 path.moveTo(0, 0);
228 path.lineTo(0, 0);
229 path.quadTo(1, 0, 0, 1);
230 path.close();
231 testSimplify(path, true, out, bitmap);
232 drawAsciiPaths(path, out, true);
233}
234</div>
235
236<div id="testSimplifyQuadratic17">
237 SkPath path, out;
caryclark@google.comb45a1b42012-05-18 20:50:33 +0000238 path.moveTo(8, 8);
239 path.quadTo(10, 10, 8, -10);
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000240 path.close();
caryclark@google.comb45a1b42012-05-18 20:50:33 +0000241 path.moveTo(8, 8);
242 path.quadTo(12, 12, 14, 4);
243 path.close();
244 path.moveTo(8, 8);
245 path.quadTo(9, 9, 10, 8);
caryclark@google.comfa0588f2012-04-26 21:01:06 +0000246 path.close();
247 testSimplify(path, true, out, bitmap);
248 drawAsciiPaths(path, out, true);
249}
caryclark@google.com78e17132012-04-17 11:40:34 +0000250</div>
caryclark@google.comfb173422012-04-10 18:28:55 +0000251
caryclark@google.comb45a1b42012-05-18 20:50:33 +0000252<div id="testSimplifyQuadratic18">
253 SkPath path, out;
254 path.moveTo(8.0000000000000071, 8.0000000000000071);
255 path.quadTo(8.7289570079366854, 8.7289570079366889, 9.3914917259458743, 9.0593802763083691);
256 path.close();
257 path.moveTo(8.0000000000000142, 8.0000000000000142);
258 path.quadTo(8.1250000000000107, 8.1250000000000071, 8.2500000000000071, 8.2187500000000053);
259 path.close();
260 testSimplify(path, true, out, bitmap);
261 drawAsciiPaths(path, out, true);
262</div>
caryclark@google.com8dcf1142012-07-02 20:27:02 +0000263
264<div id="testSimplifyQuadratic19">
265 SkPath path, simple;
266 path.moveTo(0,4);
267 path.lineTo(6,4);
268 path.lineTo(3,1);
269 path.close();
270 path.moveTo(2,3);
271 path.lineTo(3,2);
272 path.lineTo(4,3);
273 path.close();
274 testSimplifyx(path);
275</div>
276
277<div id="testSimplifyQuadratic20">
278 SkPath path, simple;
279 path.moveTo(0,4);
280 path.lineTo(6,4);
281 path.lineTo(3,1);
282 path.close();
283 path.moveTo(2,3);
284 path.lineTo(4,3);
285 path.lineTo(3,2);
286 path.close();
287 testSimplifyx(path);
288</div>
289
290<div id="testSimplifyQuadratic21">
291 SkPath path, simple;
292 path.moveTo(0,4);
293 path.lineTo(8,4);
294 path.lineTo(4,0);
295 path.close();
296 path.moveTo(2,2);
297 path.lineTo(3,3);
298 path.lineTo(4,2);
299 path.close();
300 testSimplifyx(path);
301</div>
302
303<div id="testLine6">
304 SkPath path, simple;
305 path.moveTo(0,0);
306 path.lineTo(4,0);
307 path.lineTo(2,2);
308 path.close();
309 path.moveTo(2,0);
310 path.lineTo(6,0);
311 path.lineTo(4,2);
312 path.close();
313 testSimplifyx(path);
314</div>
315
caryclark@google.comfa4a6e92012-07-11 17:52:32 +0000316<div id="testLine7">
317 SkPath path, simple;
318 path.moveTo(0,0);
319 path.lineTo(4,0);
320 path.lineTo(2,2);
321 path.close();
322 path.moveTo(6,0);
323 path.lineTo(2,0);
324 path.lineTo(4,2);
325 path.close();
326 testSimplifyx(path);
327</div>
328
caryclark@google.comcc905052012-07-25 20:59:42 +0000329<div id="testLine7b">
330 path.moveTo(0,0);
331 path.lineTo(4,0);
332 path.close();
333 path.moveTo(6,0);
334 path.lineTo(2,0);
335 path.lineTo(4,2);
336 path.close();
337</div>
338
caryclark@google.comfa4a6e92012-07-11 17:52:32 +0000339<div id="testLine9">
340 SkPath path, simple;
341 path.moveTo(0,4);
342 path.lineTo(4,4);
343 path.lineTo(2,2);
344 path.close();
345 path.moveTo(6,4);
346 path.lineTo(2,4);
347 path.lineTo(4,2);
348 path.close();
349 testSimplifyx(path);
350</div>
351
caryclark@google.come21cb182012-07-23 21:26:31 +0000352<div id="testLine12">
353 path.moveTo(0,4);
354 path.lineTo(6,4);
355 path.lineTo(3,1);
356 path.close();
357 path.moveTo(2,3);
358 path.lineTo(3,2);
359 path.lineTo(4,3);
360 path.close();
361</div>
362
363<div id="testLine13">
364 path.moveTo(6,4);
365 path.lineTo(0,4);
366 path.lineTo(3,1);
367 path.close();
368 path.moveTo(3,2);
369 path.lineTo(2,3);
370 path.lineTo(4,3);
371 path.close();
372</div>
373
caryclark@google.com8dcf1142012-07-02 20:27:02 +0000374<div id="testLine17">
375 SkPath path, simple;
376 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
377 path.addRect(4, 12, 13, 13, (SkPath::Direction) 0);
378 testSimplifyx(path);
379</div>
380
caryclark@google.com47580692012-07-23 12:14:49 +0000381<div id="testLine19">
382 SkPath path, simple;
383 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
384 path.addRect(12, 16, 21, 21, (SkPath::Direction) 0);
385 testSimplifyx(path);
386</div>
387
caryclark@google.comcc905052012-07-25 20:59:42 +0000388<div id="testLine22">
389 path.addRect(0, 12, 12, 12, (SkPath::Direction) 0);
390 path.addRect(4, 12, 13, 13, (SkPath::Direction) 0);
391</div>
392
caryclark@google.com47580692012-07-23 12:14:49 +0000393<div id="testLine24">
394 path.addRect(0, 18, 12, 12, (SkPath::Direction) 0);
395 path.addRect(4, 12, 13, 13, (SkPath::Direction) 0);
396</div>
397
caryclark@google.comfa4a6e92012-07-11 17:52:32 +0000398<div id="testLine28">
399 SkPath path, simple;
400 path.addRect(0, 6, 12, 12, (SkPath::Direction) 0);
401 path.addRect(0, 0, 9, 9, (SkPath::Direction) 0);
402 testSimplifyx(path);
403</div>
404
405<div id="testLine29">
406 SkPath path, simple;
407 path.addRect(0, 18, 12, 12, (SkPath::Direction) 0);
408 path.addRect(12, 12, 21, 21, (SkPath::Direction) 0);
409 testSimplifyx(path);
410</div>
411
412<div id="testLine30">
413 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
414 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
415 path.addRect(4, 4, 13, 13, (SkPath::Direction) 0);
416</div>
417
418<div id="testLine31">
419 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
420 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
421 path.addRect(0, 4, 9, 9, (SkPath::Direction) 0);
422</div>
423
424<div id="testLine32">
425 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
426 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
427 path.addRect(4, 12, 13, 13, (SkPath::Direction) 0);
428</div>
429
caryclark@google.com9764cc62012-07-12 19:29:45 +0000430<div id="testLine33">
431 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
432 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
433 path.addRect(4, 16, 13, 13, (SkPath::Direction) 0);
434</div>
435
caryclark@google.com210acaf2012-07-12 21:05:13 +0000436<div id="testLine34">
437 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
438 path.addRect(0, 6, 12, 12, (SkPath::Direction) 0);
439 path.addRect(4, 12, 13, 13, (SkPath::Direction) 0);
440</div>
441
442<div id="testLine35">
443 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
444 path.addRect(6, 0, 18, 18, (SkPath::Direction) 0);
445 path.addRect(4, 16, 13, 13, (SkPath::Direction) 0);
446</div>
447
caryclark@google.com0e08a192012-07-13 21:07:52 +0000448<div id="testLine36">
449 path.addRect(0, 10, 20, 20, (SkPath::Direction) 0);
450 path.addRect(6, 12, 18, 18, (SkPath::Direction) 0);
451 path.addRect(4, 16, 13, 13, (SkPath::Direction) 0);
452</div>
453
caryclark@google.com47580692012-07-23 12:14:49 +0000454<div id="testLine37">
455 path.addRect(0, 20, 20, 20, (SkPath::Direction) 0);
456 path.addRect(18, 24, 30, 30, (SkPath::Direction) 0);
457 path.addRect(0, 0, 9, 9, (SkPath::Direction) 0);
458</div>
459
460<div id="testLine38">
461 path.addRect(10, 0, 30, 30, (SkPath::Direction) 0);
462 path.addRect(6, 12, 18, 18, (SkPath::Direction) 0);
463 path.addRect(12, 12, 21, 21, (SkPath::Direction) 0);
464</div>
465
466<div id="testLine39">
467 path.addRect(10, 0, 30, 30, (SkPath::Direction) 0);
468 path.addRect(12, 6, 24, 24, (SkPath::Direction) 0);
469 path.addRect(12, 4, 21, 21, (SkPath::Direction) 0);
470</div>
471
472<div id="testLine40">
473 path.addRect(10, 0, 30, 30, (SkPath::Direction) 0);
474 path.addRect(12, 18, 24, 24, (SkPath::Direction) 0);
475 path.addRect(4, 16, 13, 13, (SkPath::Direction) 0);
476</div>
477
478<div id="testLine41">
479 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
480 path.addRect(18, 24, 30, 30, (SkPath::Direction) 0);
481 path.addRect(12, 0, 21, 21, (SkPath::Direction) 0);
482</div>
483
484<div id="testLine42">
485 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
486 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
487 path.addRect(8, 16, 17, 17, (SkPath::Direction) 0);
488</div>
489
490<div id="testLine43">
491 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
492 path.addRect(6, 24, 18, 18, (SkPath::Direction) 0);
493 path.addRect(0, 32, 9, 36, (SkPath::Direction) 1);
494</div>
495
496<div id="testLine44">
497 path.addRect(10, 40, 30, 30, (SkPath::Direction) 0);
498 path.addRect(18, 0, 30, 30, (SkPath::Direction) 0);
499 path.addRect(18, 32, 27, 36, (SkPath::Direction) 1);
500</div>
501
502<div id="testLine45">
503 path.addRect(10, 0, 30, 30, (SkPath::Direction) 0);
504 path.addRect(18, 0, 30, 30, (SkPath::Direction) 0);
505 path.addRect(24, 32, 33, 36, (SkPath::Direction) 0);
506</div>
507
508<div id="testLine46">
509 path.addRect(10, 40, 30, 30, (SkPath::Direction) 0);
510 path.addRect(24, 0, 36, 36, (SkPath::Direction) 0);
511 path.addRect(24, 32, 33, 36, (SkPath::Direction) 0);
512</div>
513
514<div id="testLine47">
515 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
516 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
517 path.addRect(0, 0, 9, 9, (SkPath::Direction) 1);
518</div>
519
520<div id="testLine48">
521 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
522 path.addRect(0, 6, 12, 12, (SkPath::Direction) 0);
523 path.addRect(0, 0, 9, 9, (SkPath::Direction) 1);
524</div>
525
526<div id="testLine49">
527 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
528 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
529 path.addRect(0, 0, 9, 9, (SkPath::Direction) 0);
530</div>
531
532<div id="testLine50">
533 path.addRect(10, 30, 30, 30, (SkPath::Direction) 0);
534 path.addRect(24, 20, 36, 30, (SkPath::Direction) 0);
535</div>
536
537<div id="testLine51">
538 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
539 path.addRect(0, 12, 12, 12, (SkPath::Direction) 0);
540 path.addRect(4, 12, 13, 13, (SkPath::Direction) 1);
541</div>
542
caryclark@google.come21cb182012-07-23 21:26:31 +0000543<div id="testLine52">
544 path.addRect(0, 30, 20, 20, (SkPath::Direction) 0);
545 path.addRect(6, 20, 18, 30, (SkPath::Direction) 0);
546 path.addRect(32, 0, 36, 41, (SkPath::Direction) 0);
547</div>
548
549<div id="testLine53">
550 path.addRect(10, 30, 30, 30, (SkPath::Direction) 0);
551 path.addRect(12, 20, 24, 30, (SkPath::Direction) 0);
552 path.addRect(12, 32, 21, 36, (SkPath::Direction) 1);
553</div>
554
555<div id="testLine54">
556 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
557 path.addRect(6, 0, 18, 18, (SkPath::Direction) 0);
558 path.addRect(8, 4, 17, 17, (SkPath::Direction) 1);
559</div>
560
561<div id="testLine55">
562 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
563 path.addRect(6, 6, 18, 18, (SkPath::Direction) 0);
564 path.addRect(4, 4, 13, 13, (SkPath::Direction) 1);
565</div>
566
caryclark@google.com18063442012-07-25 12:05:18 +0000567<div id="testLine56">
568 path.addRect(0, 20, 20, 20, (SkPath::Direction) 0);
569 path.addRect(18, 20, 30, 30, (SkPath::Direction) 0);
570 path.addRect(12, 0, 21, 21, (SkPath::Direction) 1);
571</div>
572
573<div id="testLine57">
574 path.addRect(20, 0, 40, 40, (SkPath::Direction) 0);
575 path.addRect(20, 0, 30, 40, (SkPath::Direction) 0);
576 path.addRect(12, 0, 21, 21, (SkPath::Direction) 1);
577</div>
578
caryclark@google.comcc905052012-07-25 20:59:42 +0000579<div id="testLine58">
580 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
581 path.addRect(0, 0, 12, 12, (SkPath::Direction) 1);
582 path.addRect(0, 12, 9, 9, (SkPath::Direction) 1);
583</div>
584
585<div id="testLine59">
586 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
587 path.addRect(6, 6, 18, 18, (SkPath::Direction) 1);
588 path.addRect(4, 4, 13, 13, (SkPath::Direction) 1);
589</div>
590
caryclark@google.com27c449a2012-07-27 18:26:38 +0000591<div id="testLine60">
592 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
593 path.addRect(6, 12, 18, 18, (SkPath::Direction) 1);
594 path.addRect(4, 12, 13, 13, (SkPath::Direction) 1);
595</div>
596
597<div id="testLine61">
598 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
599 path.addRect(12, 0, 24, 24, (SkPath::Direction) 1);
600 path.addRect(12, 0, 21, 21, (SkPath::Direction) 1);
601</div>
602
603<div id="testLine62">
604 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
605 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
606 path.addRect(0, 12, 12, 12, (SkPath::Direction) 0);
607 path.addRect(4, 12, 13, 13, (SkPath::Direction) 1);
608</div>
609
610<div id="testLine63">
611 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
612 path.addRect(0, 10, 20, 20, (SkPath::Direction) 0);
613 path.addRect(0, 6, 12, 12, (SkPath::Direction) 1);
614 path.addRect(0, 32, 9, 36, (SkPath::Direction) 1);
615</div>
616
617<div id="testLine64">
618 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
619 path.addRect(10, 40, 30, 30, (SkPath::Direction) 0);
620 path.addRect(18, 6, 30, 30, (SkPath::Direction) 0);
621</div>
622
623<div id="testLine65">
624 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
625 path.addRect(10, 0, 30, 30, (SkPath::Direction) 0);
626 path.addRect(24, 0, 36, 36, (SkPath::Direction) 0);
627 path.addRect(32, 6, 36, 41, (SkPath::Direction) 1);
628</div>
629
630<div id="testLine66">
631 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
632 path.addRect(0, 30, 20, 20, (SkPath::Direction) 0);
633 path.addRect(12, 20, 24, 30, (SkPath::Direction) 0);
634</div>
635
caryclark@google.com534aa5b2012-08-02 20:08:21 +0000636<div id="testLine67">
637 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
638 path.addRect(10, 40, 30, 30, (SkPath::Direction) 0);
639 path.addRect(24, 20, 36, 30, (SkPath::Direction) 0);
640 path.addRect(32, 0, 36, 41, (SkPath::Direction) 0);
641</div>
642
643<div id="testLine68a">
644 path.addRect(0, 0, 8, 8, (SkPath::Direction) 0);
645 path.addRect(2, 2, 6, 6, (SkPath::Direction) 0);
646 path.addRect(1, 2, 4, 2, (SkPath::Direction) 0);
647</div>
648
649<div id="testLine68b">
650 path.addRect(0, 0, 8, 8, (SkPath::Direction) 0);
651 path.addRect(2, 2, 6, 6, (SkPath::Direction) 1);
652 path.addRect(1, 2, 4, 2, (SkPath::Direction) 0);
653</div>
654
655<div id="testLine68c">
656 path.addRect(0, 0, 8, 8, (SkPath::Direction) 1);
657 path.addRect(2, 2, 6, 6, (SkPath::Direction) 0);
658 path.addRect(1, 2, 4, 2, (SkPath::Direction) 0);
659</div>
660
661<div id="testLine68d">
662 path.addRect(0, 0, 8, 8, (SkPath::Direction) 1);
663 path.addRect(2, 2, 6, 6, (SkPath::Direction) 1);
664 path.addRect(1, 2, 4, 2, (SkPath::Direction) 0);
665</div>
666
667<div id="testLine68e">
668 path.addRect(0, 0, 8, 8, (SkPath::Direction) 0);
669 path.addRect(0, 0, 8, 8, (SkPath::Direction) 0);
670 path.addRect(2, 2, 6, 6, (SkPath::Direction) 1);
671 path.addRect(1, 2, 2, 2, (SkPath::Direction) 0);
672</div>
673
674<div id="testLine68f">
675 path.addRect(0, 0, 8, 8, (SkPath::Direction) 0);
676 path.addRect(2, 2, 6, 6, (SkPath::Direction) 1);
677 path.addRect(2, 2, 6, 6, (SkPath::Direction) 1);
678 path.addRect(1, 2, 2, 2, (SkPath::Direction) 0);
679</div>
680
681<div id="testLine69">
682 path.addRect(0, 20, 20, 20, (SkPath::Direction) 0);
683 path.addRect(0, 20, 12, 30, (SkPath::Direction) 0);
684 path.addRect(12, 32, 21, 36, (SkPath::Direction) 0);
685</div>
686
687<div id="testLine70">
688 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
689 path.addRect(0, 24, 12, 12, (SkPath::Direction) 0);
690 path.addRect(12, 32, 21, 36, (SkPath::Direction) 1);
691</div>
692
693<div id="testLine71">
694 path.addRect(0, 0, 20, 20, (SkPath::Direction) 0);
695 path.addRect(12, 0, 24, 24, (SkPath::Direction) 0);
696 path.addRect(12, 32, 21, 36, (SkPath::Direction) 0);
697</div>
698
caryclark@google.com200c2112012-08-03 15:05:04 +0000699<div id="testLine72">
700 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
701 path.addRect(10, 40, 30, 30, (SkPath::Direction) 0);
702 path.addRect(6, 20, 18, 30, (SkPath::Direction) 0);
703</div>
704
705<div id="testLine73">
706 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
707 path.addRect(0, 40, 20, 20, (SkPath::Direction) 0);
708 path.addRect(0, 20, 12, 30, (SkPath::Direction) 0);
709 path.addRect(0, 0, 9, 9, (SkPath::Direction) 1);
710</div>
711
caryclark@google.com0c803d02012-08-06 11:15:47 +0000712<div id="testLine74">
713 path.addRect(20, 30, 40, 40, (SkPath::Direction) 0);
714 path.addRect(24, 20, 36, 30, (SkPath::Direction) 1);
715 path.addRect(32, 24, 36, 41, (SkPath::Direction) 1);
716</div>
717
caryclark@google.com2ddff932012-08-07 21:25:27 +0000718<div id="testLine75">
719 path.addRect(0, 0, 60, 60, (SkPath::Direction) 0);
720 path.addRect(10, 0, 30, 30, (SkPath::Direction) 1);
721 path.addRect(18, 0, 30, 30, (SkPath::Direction) 1);
722 path.addRect(12, 0, 21, 21, (SkPath::Direction) 1);
723</div>
724
725<div id="testLine76">
726 path.addRect(36, 0, 66, 60, (SkPath::Direction) 0);
727 path.addRect(10, 20, 40, 30, (SkPath::Direction) 0);
728 path.addRect(24, 20, 36, 30, (SkPath::Direction) 1);
729 path.addRect(32, 6, 36, 41, (SkPath::Direction) 1);
730</div>
731
732<div id="testLine77">
733 path.addRect(20, 0, 40, 40, (SkPath::Direction) 0);
734 path.addRect(24, 6, 36, 36, (SkPath::Direction) 1);
735 path.addRect(24, 32, 33, 36, (SkPath::Direction) 1);
736</div>
737
738<div id="testLine78">
739 path.addRect(0, 0, 30, 60, (SkPath::Direction) 0);
740 path.addRect(10, 20, 30, 30, (SkPath::Direction) 1);
741 path.addRect(18, 20, 30, 30, (SkPath::Direction) 1);
742 path.addRect(32, 0, 36, 41, (SkPath::Direction) 1);
743</div>
744
745<div id="testLine79">
746 path.addRect(0, 36, 60, 30, (SkPath::Direction) 0);
747 path.addRect(10, 30, 40, 30, (SkPath::Direction) 0);
748 path.addRect(0, 20, 12, 30, (SkPath::Direction) 1);
749 path.addRect(0, 32, 9, 36, (SkPath::Direction) 1);
750</div>
751
caryclark@google.com59823f72012-08-09 18:17:47 +0000752<div id="testDegenerate1">
753 path.moveTo(0, 0);
754 path.lineTo(0, 0);
755 path.lineTo(2, 0);
756 path.close();
757 path.moveTo(0, 0);
758 path.lineTo(1, 0);
759 path.lineTo(2, 0);
760 path.close();
761</div>
762
763<div id="testDegenerate2">
764 path.moveTo(0, 0);
765 path.lineTo(0, 0);
766 path.lineTo(0, 0);
767 path.close();
768 path.moveTo(0, 0);
769 path.lineTo(1, 0);
770 path.lineTo(0, 1);
771 path.close();
772</div>
773
774<div id="testDegenerate3">
775 path.moveTo(0, 0);
776 path.lineTo(2, 0);
777 path.lineTo(1, 0);
778 path.close();
779 path.moveTo(0, 0);
780 path.lineTo(0, 0);
781 path.lineTo(3, 0);
782 path.close();
783</div>
784
785<div id="testDegenerate4">
786 path.moveTo(0, 0);
787 path.lineTo(1, 0);
788 path.lineTo(1, 3);
789 path.close();
790 path.moveTo(1, 0);
791 path.lineTo(1, 1);
792 path.lineTo(1, 2);
793 path.close();
794</div>
795
796<div id="testNondegenerate1">
797 path.moveTo(0, 0);
798 path.lineTo(3, 0);
799 path.lineTo(1, 3);
800 path.close();
801 path.moveTo(1, 1);
802 path.lineTo(2, 1);
803 path.lineTo(1, 2);
804 path.close();
805</div>
806
807<div id="testNondegenerate2">
808 path.moveTo(1, 0);
809 path.lineTo(0, 1);
810 path.lineTo(1, 1);
811 path.close();
812 path.moveTo(0, 2);
813 path.lineTo(0, 3);
814 path.lineTo(1, 2);
815 path.close();
816</div>
817
818<div id="testNondegenerate3">
819 path.moveTo(0, 0);
820 path.lineTo(1, 0);
821 path.lineTo(2, 1);
822 path.close();
823 path.moveTo(0, 1);
824 path.lineTo(1, 1);
825 path.lineTo(0, 2);
826 path.close();
827</div>
828
829<div id="testNondegenerate4">
830 path.moveTo(1, 0);
831 path.lineTo(0, 1);
832 path.lineTo(1, 2);
833 path.close();
834 path.moveTo(0, 2);
835 path.lineTo(0, 3);
836 path.lineTo(1, 3);
837 path.close();
838</div>
839
840<div id="testQuadralateral5">
841 path.moveTo(0, 0);
842 path.lineTo(0, 0);
843 path.lineTo(1, 0);
844 path.lineTo(1, 1);
845 path.close();
846 path.moveTo(0, 0);
847 path.lineTo(2, 2);
848 path.lineTo(3, 2);
849 path.lineTo(3, 3);
850 path.close();
851</div>
852
853<div id="testQuadralateral6">
854 path.moveTo(0, 0);
855 path.lineTo(0, 0);
856 path.lineTo(1, 0);
857 path.lineTo(1, 1);
858 path.close();
859 path.moveTo(1, 0);
860 path.lineTo(2, 0);
861 path.lineTo(0, 2);
862 path.lineTo(2, 2);
863 path.close();
864</div>
865
caryclark@google.com24bec792012-08-20 12:43:57 +0000866<div id="testFauxQuadralateral6">
867 path.moveTo(0, 0);
868 path.lineTo(1, 0);
869 path.lineTo(1, 1);
870 path.close();
871 path.moveTo(1, 0);
872 path.lineTo(2, 0);
873 path.lineTo(1.333, 0.667);
874 path.close();
875 path.moveTo(1.333, 0.667);
876 path.lineTo(0, 2);
877 path.lineTo(2, 2);
878 path.close();
879</div>
880
881<div id="testFauxQuadralateral6a">
882 path.moveTo(0, 0);
883 path.lineTo(3, 0);
884 path.lineTo(3, 3);
885 path.close();
886 path.moveTo(3, 0);
887 path.lineTo(6, 0);
888 path.lineTo(4, 2);
889 path.close();
890 path.moveTo(4, 2);
891 path.lineTo(0, 6);
892 path.lineTo(6, 6);
893 path.close();
894</div>
895
896<div id="testFauxQuadralateral6b">
897 path.moveTo(0, 0);
898 path.lineTo(3, 0);
899 path.lineTo(3, 3);
900 path.close();
901 path.moveTo(3, 0);
902 path.lineTo(6, 0);
903 path.lineTo(4, 2);
904 path.close();
905 path.moveTo(4, 2);
906 path.lineTo(6, 6);
907 path.lineTo(0, 6);
908 path.close();
909</div>
910
911<div id="testFauxQuadralateral6c">
912 path.moveTo(0, 0);
913 path.lineTo(3, 3);
914 path.lineTo(3, 0);
915 path.close();
916 path.moveTo(3, 0);
917 path.lineTo(6, 0);
918 path.lineTo(4, 2);
919 path.close();
920 path.moveTo(4, 2);
921 path.lineTo(0, 6);
922 path.lineTo(6, 6);
923 path.close();
924</div>
925
926<div id="testFauxQuadralateral6d">
927 path.moveTo(0, 0);
928 path.lineTo(3, 3);
929 path.lineTo(3, 0);
930 path.close();
931 path.moveTo(3, 0);
932 path.lineTo(6, 0);
933 path.lineTo(4, 2);
934 path.close();
935 path.moveTo(4, 2);
936 path.lineTo(6, 6);
937 path.lineTo(0, 6);
938</div>
939
940<div id="testQuadralateral6a">
941 path.moveTo(0, 0);
942 path.lineTo(0, 0);
943 path.lineTo(3, 0);
944 path.lineTo(3, 3);
945 path.close();
946 path.moveTo(3, 0);
947 path.lineTo(6, 0);
948 path.lineTo(0, 6);
949 path.lineTo(6, 6);
950</div>
951
952<div id="testQuadralateral7">
953 path.moveTo(0, 0);
954 path.lineTo(0, 0);
955 path.lineTo(1, 0);
956 path.lineTo(2, 1);
957 path.close();
958 path.moveTo(1, 0);
959 path.lineTo(1, 1);
960 path.lineTo(2, 2);
961 path.lineTo(1, 3);
962 path.close();
963</div>
964
965<div id="testQuadralateral8">
966 path.moveTo(0, 0);
967 path.lineTo(3, 1);
968 path.lineTo(1, 3);
969 path.lineTo(3, 3);
970 path.close();
971 path.moveTo(2, 1);
972 path.lineTo(0, 2);
973 path.lineTo(3, 2);
974 path.lineTo(2, 3);
975 path.close();
976</div>
977
978<div id="testQuadralateral9">
979 path.moveTo(0, 0);
980 path.lineTo(1, 0);
981 path.lineTo(1, 2);
982 path.lineTo(2, 2);
983 path.close();
984 path.moveTo(1, 1);
985 path.lineTo(2, 1);
986 path.lineTo(1, 3);
987 path.lineTo(2, 3);
988 path.close();
989</div>
990
991<div id="testLine1x">
992 path.setFillType(SkPath::kEvenOdd_FillType);
993 path.addRect(0, 0, 12, 12, (SkPath::Direction) 0);
994 path.addRect(4, 0, 13, 13, (SkPath::Direction) 0);
995</div>
996
997<div id="testLine2x">
998 path.setFillType(SkPath::kEvenOdd_FillType);
999 path.addRect(0, 20, 20, 20, (SkPath::Direction) 0);
1000 path.addRect(0, 20, 12, 30, (SkPath::Direction) 0);
1001 path.addRect(12, 0, 21, 21, (SkPath::Direction) 1);
1002</div>
1003
1004<div id="testLine3x">
1005 path.setFillType(SkPath::kEvenOdd_FillType);
1006 path.addRect(10, 30, 30, 30, (SkPath::Direction) 0);
1007 path.addRect(18, 20, 30, 30, (SkPath::Direction) 1);
1008 path.addRect(0, 32, 9, 36, (SkPath::Direction) 1);
1009</div>
1010
1011<div id="testLine4x">
1012 path.setFillType(SkPath::kEvenOdd_FillType);
1013 path.addRect(10, 30, 30, 30, (SkPath::Direction) 0);
1014 path.addRect(24, 20, 36, 30, (SkPath::Direction) 1);
1015 path.addRect(0, 32, 9, 36, (SkPath::Direction) 1);
1016</div>
1017
1018<div id="testQuadratic1">
1019 path.moveTo(0, 0);
1020 path.quadTo(0, 0, 0, 0);
1021 path.lineTo(1, 0);
1022 path.close();
1023 path.moveTo(0, 0);
1024 path.lineTo(0, 0);
1025 path.quadTo(0, 0, 0, 0);
1026 path.close();
1027</div>
1028
1029<div id="testQuadratic2">
1030 path.moveTo(0, 0);
1031 path.quadTo(0, 0, 0, 0);
1032 path.lineTo(3, 0);
1033 path.close();
1034 path.moveTo(0, 0);
1035 path.lineTo(0, 0);
1036 path.quadTo(1, 0, 0, 1);
1037 path.close();
1038</div>
1039
caryclark@google.com03f97062012-08-21 13:13:52 +00001040<div id="testQuadratic3">
1041 path.moveTo(0, 0);
1042 path.quadTo(0, 0, 1, 0);
1043 path.lineTo(0, 2);
1044 path.close();
1045 path.moveTo(0, 0);
1046 path.lineTo(0, 0);
1047 path.quadTo(1, 0, 0, 1);
1048 path.close();
1049</div>
1050
caryclark@google.comc899ad92012-08-23 15:24:42 +00001051<div id="testQuadratic4x">
1052 path.setFillType(SkPath::kEvenOdd_FillType);
1053 path.moveTo(0, 0);
1054 path.quadTo(0, 0, 1, 0);
1055 path.lineTo(0, 2);
1056 path.close();
1057 path.moveTo(0, 0);
1058 path.lineTo(0, 0);
1059 path.quadTo(1, 0, 0, 2);
1060 path.close();
1061</div>
1062
1063<div id="testQuadratic5">
1064 path.moveTo(0, 0);
1065 path.quadTo(0, 0, 0, 0);
1066 path.lineTo(0, 1);
1067 path.close();
1068 path.moveTo(0, 0);
1069 path.lineTo(1, 0);
1070 path.quadTo(0, 1, 0, 2);
1071 path.close();
1072</div>
1073
1074<div id="testQuadratic6">
1075 path.moveTo(0, 0);
1076 path.quadTo(0, 0, 1, 0);
1077 path.lineTo(2, 1);
1078 path.close();
1079 path.moveTo(0, 0);
1080 path.lineTo(0, 0);
1081 path.quadTo(2, 0, 0, 1);
1082 path.close();
1083</div>
1084
1085<div id="testQuadratic7">
1086 path.moveTo(0, 0);
1087 path.quadTo(0, 0, 1, 0);
1088 path.lineTo(3, 1);
1089 path.close();
1090 path.moveTo(0, 0);
1091 path.lineTo(0, 0);
1092 path.quadTo(3, 0, 1, 2);
1093 path.close();
1094</div>
1095
1096<div id="testQuadratic8">
1097 path.moveTo(0, 0);
1098 path.quadTo(0, 0, 1, 0);
1099 path.lineTo(0, 2);
1100 path.close();
1101 path.moveTo(0, 0);
1102 path.lineTo(1, 0);
1103 path.quadTo(0, 1, 1, 2);
1104 path.close();
1105</div>
1106
1107<div id="testQuadratic9">
1108 path.moveTo(0, 0);
1109 path.quadTo(0, 0, 1, 0);
1110 path.lineTo(3, 1);
1111 path.close();
1112 path.moveTo(0, 0);
1113 path.lineTo(1, 0);
1114 path.quadTo(1, 2, 3, 2);
1115 path.close();
1116</div>
1117
1118<div id="testQuadratic9a">
1119 path.moveTo(1.08000004, 0.720000029);
1120 path.lineTo(0, 0);
1121 path.lineTo(1, 0);
1122 path.lineTo(3, 1);
1123 path.lineTo(1.01568651, 0.338562161);
1124 path.quadTo(1.03542483, 0.541699469, 1.08000004, 0.720000029);
1125 path.close();
1126 path.moveTo(1.08000004, 0.720000029);
1127 path.lineTo(3, 2);
1128 path.quadTo(1.39999998, 2, 1.08000004, 0.720000029);
1129 path.close();
1130
1131</div>
1132
1133<div id="testQuadratic10a">
1134path.moveTo(15.5, 15.5);
1135path.lineTo(46.5, 15.5);
1136path.quadTo(0, 31, 0, 46.5);
1137path.lineTo(15.5, 15.5);
1138path.close();
1139</div>
1140
1141<div id="testQuadratic10b">
1142path.moveTo(5.16666698, 36.1666641);
1143path.lineTo(15.5, 15.5);
1144path.lineTo(46.5, 15.5);
1145path.quadTo(15.5, 25.8333321, 5.16666698, 36.1666641);
1146path.close();
1147path.moveTo(5.16666698, 36.1666641);
1148path.lineTo(0, 46.5);
1149path.quadTo(0, 41.3333359, 5.16666698, 36.1666641);
1150path.close();
1151</div>
1152
1153<div id="testQuadratic11a">
1154path.moveTo(0, 0);
1155path.lineTo(15.5, 31);
1156path.lineTo(0, 0);
1157path.close();
1158path.moveTo(0, 15.5);
1159path.lineTo(15.5, 15.5);
1160path.quadTo(15.5, 15.5, 46.5, 31);
1161path.lineTo(0, 15.5);
1162path.close();
1163</div>
1164
1165<div id="testQuadratic11b">
1166path.moveTo(9.30000019, 18.6000004);
1167path.lineTo(0, 15.5);
1168path.lineTo(7.75, 15.5);
1169path.lineTo(15.5, 15.5);
1170path.lineTo(46.5, 31);
1171path.lineTo(9.30000019, 18.6000004);
1172path.close();
1173</div>
1174
1175<div id="testQuadratic12">
1176 path.moveTo(0, 0);
1177 path.quadTo(0, 0, 0, 0);
1178 path.lineTo(1, 3);
1179 path.close();
1180 path.moveTo(1, 0);
1181 path.lineTo(0, 1);
1182 path.quadTo(1, 1, 0, 3);
1183 path.close();
1184</div>
1185
1186<div id="testQuadratic13a">
1187path.moveTo(0, 0);
1188path.quadTo(0, 0, 15.5, 0);
1189path.lineTo(15.5, 31);
1190path.lineTo(0, 0);
1191path.close();
1192path.moveTo(0, 0);
1193path.quadTo(15.5, 46.5, 46.5, 46.5);
1194path.lineTo(0, 0);
1195path.close();
1196</div>
1197
1198<div id="testQuadratic13b">
1199path.moveTo(14.8800001, 29.7600002);
1200path.quadTo(6.20000029, 18.6000004, 0, 0);
1201path.lineTo(14.8800001, 29.7600002);
1202path.close();
1203path.moveTo(15.5, 30.5437222);
1204path.lineTo(15.5, 31);
1205path.lineTo(14.8800001, 29.7600002);
1206path.quadTo(15.1884346, 30.156559, 15.5, 30.5437222);
1207path.close();
1208path.moveTo(15.5, 15.5);
1209path.lineTo(0, 0);
1210path.lineTo(15.5, 0);
1211path.lineTo(15.5, 15.5);
1212path.close();
1213path.moveTo(15.5, 30.5437222);
1214path.lineTo(15.5, 15.5);
1215path.lineTo(46.5, 46.5);
1216path.quadTo(28.34062, 46.5, 15.5, 30.5437222);
1217path.close();
1218</div>
1219
1220<div id="testQuadratic14">
1221 path.moveTo(0, 0);
1222 path.quadTo(0, 0, 1, 0);
1223 path.lineTo(3, 2);
1224 path.close();
1225 path.moveTo(0, 0);
1226 path.lineTo(1, 0);
1227 path.quadTo(3, 2, 3, 3);
1228 path.close();
1229</div>
1230
caryclark@google.com3350c3c2012-08-24 15:24:36 +00001231<div id="testQuadratic15">
1232 path.moveTo(0, 0);
1233 path.quadTo(0, 0, 1, 0);
1234 path.lineTo(1, 3);
1235 path.close();
1236 path.moveTo(1, 0);
1237 path.lineTo(0, 1);
1238 path.quadTo(1, 1, 0, 3);
1239 path.close();
1240</div>
1241
1242<div id="testQuadratic16a">
1243path.moveTo(0, 0);
1244path.quadTo(0, 0, 31, 0);
1245path.lineTo(46.5, 31);
1246path.lineTo(0, 0);
1247path.close();
1248path.moveTo(46.5, 15.5);
1249path.lineTo(0, 31);
1250path.quadTo(0, 31, 15.5, 31);
1251path.lineTo(46.5, 15.5);
1252path.close();
1253</div>
1254
1255<div id="testQuadratic16b">
1256path.moveTo(31, 20.6666679);
1257path.lineTo(0, 0);
1258path.lineTo(31, 0);
1259path.lineTo(39.8571434, 17.7142868);
1260path.lineTo(31, 20.6666679);
1261path.close();
1262path.moveTo(33.214283, 22.1428585);
1263path.lineTo(15.5, 31);
1264path.lineTo(0, 31);
1265path.lineTo(31, 20.6666679);
1266path.lineTo(33.214283, 22.1428585);
1267path.close();
1268path.moveTo(40.2999992, 18.6000004);
1269path.lineTo(46.5, 31);
1270path.lineTo(33.214283, 22.1428585);
1271path.lineTo(40.2999992, 18.6000004);
1272path.close();
1273path.moveTo(39.8571434, 17.7142868);
1274path.lineTo(46.5, 15.5);
1275path.lineTo(40.2999992, 18.6000004);
1276path.lineTo(39.8571434, 17.7142868);
1277path.close();
1278</div>
1279
1280<div id="testQuadratic17x">
1281 path.setFillType(SkPath::kEvenOdd_FillType);
1282 path.moveTo(0, 0);
1283 path.quadTo(0, 0, 3, 1);
1284 path.lineTo(0, 2);
1285 path.close();
1286 path.moveTo(0, 0);
1287 path.lineTo(1, 0);
1288 path.quadTo(3, 1, 0, 2);
1289 path.close();
1290</div>
1291
1292<div id="testQuadratic18">
1293 path.moveTo(0, 0);
1294 path.quadTo(1, 0, 0, 1);
1295 path.lineTo(0, 1);
1296 path.close();
1297 path.moveTo(0, 0);
1298 path.lineTo(0, 0);
1299 path.quadTo(1, 0, 1, 1);
1300 path.close();
1301</div>
1302
caryclark@google.coma7e483d2012-08-28 20:44:43 +00001303<div id="testQuadratic19">
1304 path.moveTo(0, 0);
1305 path.quadTo(1, 0, 0, 1);
1306 path.lineTo(0, 1);
1307 path.close();
1308 path.moveTo(0, 0);
1309 path.lineTo(0, 0);
1310 path.quadTo(2, 0, 0, 1);
1311 path.close();
1312</div>
1313
caryclark@google.com32546db2012-08-31 20:55:07 +00001314<div id="testQuadratic20">
1315 path.moveTo(0, 0);
1316 path.quadTo(1, 0, 0, 1);
1317 path.lineTo(0, 1);
1318 path.close();
1319 path.moveTo(0, 0);
1320 path.lineTo(0, 0);
1321 path.quadTo(1, 0, 0, 1);
1322 path.close();
1323</div>
1324
caryclark@google.com235f56a2012-09-14 14:19:30 +00001325<div id="testQuadratic21">
1326 path.moveTo(0, 0);
1327 path.quadTo(1, 0, 0, 1);
1328 path.lineTo(0, 1);
1329 path.close();
1330 path.moveTo(0, 0);
1331 path.lineTo(0, 0);
1332 path.quadTo(1, 0, 0, 2);
1333 path.close();
1334</div>
1335
1336<div id="testQuadratic22">
1337 path.moveTo(0, 0);
1338 path.quadTo(1, 0, 0, 1);
1339 path.lineTo(0, 1);
1340 path.close();
1341 path.moveTo(0, 0);
1342 path.lineTo(0, 0);
1343 path.quadTo(0, 1, 2, 1);
1344 path.close();
1345</div>
1346
1347<div id="testQuadratic23">
1348 path.moveTo(0, 0);
1349 path.quadTo(1, 0, 0, 1);
1350 path.lineTo(0, 1);
1351 path.close();
1352 path.moveTo(0, 0);
1353 path.lineTo(0, 0);
1354 path.quadTo(0, 2, 1, 2);
1355 path.close();
1356</div>
1357
1358<div id="testQuadratic24">
1359 path.moveTo(0, 0);
1360 path.quadTo(1, 0, 0, 1);
1361 path.lineTo(0, 1);
1362 path.close();
1363 path.moveTo(0, 0);
1364 path.lineTo(1, 0);
1365 path.quadTo(2, 0, 0, 1);
1366 path.close();
1367</div>
1368
1369<div id="testQuadratic25">
1370 path.moveTo(0, 0);
1371 path.quadTo(1, 0, 1, 1);
1372 path.lineTo(1, 1);
1373 path.close();
1374 path.moveTo(0, 0);
1375 path.lineTo(0, 0);
1376 path.quadTo(2, 1, 0, 2);
1377 path.close();
1378</div>
1379
1380<div id="testQuadratic26">
1381 path.moveTo(0, 0);
1382 path.quadTo(1, 0, 1, 1);
1383 path.lineTo(0, 2);
1384 path.close();
1385 path.moveTo(0, 0);
1386 path.lineTo(0, 0);
1387 path.quadTo(1, 0, 0, 1);
1388 path.close();
1389</div>
1390
1391<div id="testQuadratic27">
1392 path.moveTo(0, 0);
1393 path.quadTo(1, 0, 1, 1);
1394 path.lineTo(2, 1);
1395 path.close();
1396 path.moveTo(0, 0);
1397 path.lineTo(0, 0);
1398 path.quadTo(2, 1, 0, 2);
1399 path.close();
1400</div>
1401
1402<div id="testQuadratic28">
1403 path.moveTo(0, 0);
1404 path.quadTo(1, 0, 0, 1);
1405 path.lineTo(0, 1);
1406 path.close();
1407 path.moveTo(0, 0);
1408 path.lineTo(0, 2);
1409 path.quadTo(1, 2, 0, 3);
1410 path.close();
1411</div>
1412
caryclark@google.com752b60e2012-03-22 21:11:17 +00001413</div>
1414
1415<script type="text/javascript">
1416
1417var testDivs = [
caryclark@google.com235f56a2012-09-14 14:19:30 +00001418 testQuadratic28,
1419 testQuadratic27,
1420 testQuadratic26,
1421 testQuadratic25,
1422 testQuadratic24,
1423 testQuadratic23,
1424 testQuadratic22,
1425 testQuadratic21,
caryclark@google.com32546db2012-08-31 20:55:07 +00001426 testQuadratic20,
caryclark@google.coma7e483d2012-08-28 20:44:43 +00001427 testQuadratic19,
caryclark@google.com3350c3c2012-08-24 15:24:36 +00001428 testQuadratic18,
1429 testQuadratic17x,
1430 testQuadratic16b,
1431 testQuadratic16a,
1432 testQuadratic15,
caryclark@google.comc899ad92012-08-23 15:24:42 +00001433 testQuadratic14,
1434 testQuadratic13b,
1435 testQuadratic13a,
1436 testQuadratic12,
1437 testQuadratic11b,
1438 testQuadratic11a,
1439 testQuadratic10b,
1440 testQuadratic10a,
1441 testQuadratic9a,
1442 testQuadratic9,
1443 testQuadratic8,
1444 testQuadratic7,
1445 testQuadratic6,
1446 testQuadratic5,
1447 testQuadratic4x,
caryclark@google.com03f97062012-08-21 13:13:52 +00001448 testQuadratic3,
caryclark@google.com24bec792012-08-20 12:43:57 +00001449 testQuadratic2,
1450 testQuadratic1,
1451 testLine4x,
1452 testLine3x,
1453 testLine2x,
1454 testLine1x,
1455 testQuadralateral9,
1456 testQuadralateral8,
1457 testQuadralateral7,
1458 testFauxQuadralateral6d,
1459 testFauxQuadralateral6c,
1460 testFauxQuadralateral6b,
1461 testFauxQuadralateral6a,
1462 testFauxQuadralateral6,
1463 testQuadralateral6a,
caryclark@google.com59823f72012-08-09 18:17:47 +00001464 testQuadralateral6,
1465 testQuadralateral5,
1466 testNondegenerate4,
1467 testNondegenerate3,
1468 testNondegenerate2,
1469 testNondegenerate1,
1470 testDegenerate4,
1471 testDegenerate3,
1472 testDegenerate2,
1473 testDegenerate1,
caryclark@google.com2ddff932012-08-07 21:25:27 +00001474 testLine79,
1475 testLine78,
1476 testLine77,
1477 testLine76,
1478 testLine75,
caryclark@google.com0c803d02012-08-06 11:15:47 +00001479 testLine74,
caryclark@google.com200c2112012-08-03 15:05:04 +00001480 testLine73,
1481 testLine72,
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001482 testLine71,
1483 testLine70,
1484 testLine69,
1485 testLine68f,
1486 testLine68e,
1487 testLine68d,
1488 testLine68c,
1489 testLine68b,
1490 testLine68a,
1491 testLine67,
caryclark@google.com27c449a2012-07-27 18:26:38 +00001492 testLine66,
1493 testLine65,
1494 testLine64,
1495 testLine63,
1496 testLine62,
1497 testLine61,
1498 testLine60,
caryclark@google.comcc905052012-07-25 20:59:42 +00001499 testLine59,
1500 testLine58,
caryclark@google.com18063442012-07-25 12:05:18 +00001501 testLine57,
1502 testLine56,
caryclark@google.come21cb182012-07-23 21:26:31 +00001503 testLine55,
1504 testLine54,
1505 testLine53,
1506 testLine52,
caryclark@google.com47580692012-07-23 12:14:49 +00001507 testLine51,
1508 testLine50,
1509 testLine49,
1510 testLine48,
1511 testLine47,
1512 testLine46,
1513 testLine45,
1514 testLine44,
1515 testLine43,
1516 testLine42,
1517 testLine41,
1518 testLine40,
1519 testLine39,
1520 testLine38,
1521 testLine37,
caryclark@google.com0e08a192012-07-13 21:07:52 +00001522 testLine36,
caryclark@google.com210acaf2012-07-12 21:05:13 +00001523 testLine35,
1524 testLine34,
caryclark@google.com9764cc62012-07-12 19:29:45 +00001525 testLine33,
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001526 testLine32,
1527 testLine31,
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001528 testLine30,
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001529 testLine29,
1530 testLine28,
caryclark@google.com47580692012-07-23 12:14:49 +00001531 testLine24,
caryclark@google.comcc905052012-07-25 20:59:42 +00001532 testLine22,
caryclark@google.com47580692012-07-23 12:14:49 +00001533 testLine19,
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001534 testLine17,
caryclark@google.come21cb182012-07-23 21:26:31 +00001535 testLine13,
1536 testLine12,
caryclark@google.com47580692012-07-23 12:14:49 +00001537 testLine9,
caryclark@google.comcc905052012-07-25 20:59:42 +00001538 testLine7b,
caryclark@google.com47580692012-07-23 12:14:49 +00001539 testLine7,
caryclark@google.com8dcf1142012-07-02 20:27:02 +00001540 testSimplifyQuadratic21,
1541 testSimplifyQuadratic20,
1542 testSimplifyQuadratic19,
caryclark@google.comb45a1b42012-05-18 20:50:33 +00001543 testSimplifyQuadratic18,
caryclark@google.comfa0588f2012-04-26 21:01:06 +00001544 testSimplifyQuadratic17,
1545 testSimplifyQuadratic16,
1546 testSimplifyQuadratic15,
1547 testSimplifyQuadratic14,
1548 testSimplifyQuadratic13,
1549 testSimplifyQuadratic12,
1550 testSimplifyQuadratic11,
1551 testSimplifyQuadratic10,
1552 testSimplifyQuadratic9,
1553 testSimplifyQuadratic8,
1554 testSimplifyQuadratic7,
1555 testSimplifyQuadratic6,
1556 testSimplifyQuadratic5,
1557 testSimplifyQuadratic4,
1558 testSimplifyQuadratic3,
1559 testSimplifyQuadratic2,
1560 testSimplifyQuadratic1,
caryclark@google.com752b60e2012-03-22 21:11:17 +00001561];
1562
1563var scale, columns, rows, xStart, yStart;
1564
1565var ticks = 0.1;
1566var at_x = 13 + 0.5;
1567var at_y = 13 + 0.5;
caryclark@google.com2ddff932012-08-07 21:25:27 +00001568var decimal_places = 0; // make this 3 to show more precision
caryclark@google.com752b60e2012-03-22 21:11:17 +00001569
1570var tests = [];
caryclark@google.com0e08a192012-07-13 21:07:52 +00001571var testTitles = [];
caryclark@google.com752b60e2012-03-22 21:11:17 +00001572var testIndex = 0;
caryclark@google.com24bec792012-08-20 12:43:57 +00001573var hasXor = false;
caryclark@google.com752b60e2012-03-22 21:11:17 +00001574
1575var ctx;
1576
caryclark@google.com0e08a192012-07-13 21:07:52 +00001577function parse(test, title) {
caryclark@google.com752b60e2012-03-22 21:11:17 +00001578 var contours = [];
1579 var contourStrs = test.split("path.close();");
caryclark@google.comd88e0892012-03-27 13:23:51 +00001580 var pattern = /-?\d+\.*\d*/g;
caryclark@google.com24bec792012-08-20 12:43:57 +00001581 hasXor = test.split("kEvenOdd_FillType").length > 1;
caryclark@google.com752b60e2012-03-22 21:11:17 +00001582 for (var c in contourStrs) {
caryclark@google.comfb173422012-04-10 18:28:55 +00001583 var contour = contourStrs[c];
1584 var verbStrs = contour.split("path");
1585 var verbs = [];
1586 for (var v in verbStrs) {
1587 var verbStr = verbStrs[v];
1588 var points = verbStr.match(pattern);
1589 var pts = [];
1590 for (var wd in points) {
1591 var num = parseFloat(points[wd]);
1592 if (isNaN(num)) continue;
1593 pts.push(num);
1594 }
1595 if (pts.length > 0)
1596 verbs.push(pts);
caryclark@google.com752b60e2012-03-22 21:11:17 +00001597 }
caryclark@google.comfa0588f2012-04-26 21:01:06 +00001598 if (verbs.length > 0) {
1599 var lastIndex = verbs.length - 1;
1600 var lastVerb = verbs[lastIndex];
1601 var lastLen = lastVerb.length;
1602 if (verbs[0][0] != lastVerb[lastLen - 2] && verbs[0][1] != lastVerb[lastLen - 1]) {
1603 var lastPts = [];
1604 lastPts.push(verbs[0][0]);
1605 lastPts.push(verbs[0][1]);
1606 verbs.push(lastPts);
1607 }
caryclark@google.comfb173422012-04-10 18:28:55 +00001608 contours.push(verbs);
caryclark@google.comfa0588f2012-04-26 21:01:06 +00001609 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001610 }
caryclark@google.com0e08a192012-07-13 21:07:52 +00001611 if (contours.length > 0) {
caryclark@google.comfb173422012-04-10 18:28:55 +00001612 tests.push(contours);
caryclark@google.com0e08a192012-07-13 21:07:52 +00001613 testTitles.push(title);
1614 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001615}
1616
caryclark@google.com0e08a192012-07-13 21:07:52 +00001617function parseRect(test, title) {
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001618 var contours = [];
1619 var rectStrs = test.split("path.addRect");
1620 var pattern = /-?\d+\.*\d*/g;
caryclark@google.com24bec792012-08-20 12:43:57 +00001621 hasXor = test.split("kEvenOdd_FillType").length > 1;
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001622 for (var r in rectStrs) {
1623 var rect = rectStrs[r];
1624 var sideStrs = rect.match(pattern);
1625 var sides = [];
1626 for (var wd in sideStrs) {
1627 var num = parseFloat(sideStrs[wd]);
1628 if (isNaN(num)) continue;
1629 sides.push(num);
1630 }
1631 if (sides.length == 0)
1632 continue;
1633 var verbs = [];
1634 var topLeft = [];
1635 topLeft.push(sides[0]); topLeft.push(sides[1]);
1636 var topRight = [];
1637 topRight.push(sides[2]); topRight.push(sides[1]);
1638 var botLeft = [];
1639 botLeft.push(sides[0]); botLeft.push(sides[3]);
1640 var botRight = [];
1641 botRight.push(sides[2]); botRight.push(sides[3]);
1642 verbs.push(topLeft);
1643 if (sides[4] == 0) {
1644 verbs.push(topRight);
1645 verbs.push(botRight);
1646 verbs.push(botLeft);
1647 } else {
1648 verbs.push(botLeft);
1649 verbs.push(botRight);
1650 verbs.push(topRight);
1651 }
1652 verbs.push(topLeft);
1653 contours.push(verbs);
1654 }
caryclark@google.com0e08a192012-07-13 21:07:52 +00001655 if (contours.length > 0) {
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001656 tests.push(contours);
caryclark@google.com0e08a192012-07-13 21:07:52 +00001657 testTitles.push(title);
1658 }
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001659}
1660
caryclark@google.com752b60e2012-03-22 21:11:17 +00001661function init(test) {
1662 var canvas = document.getElementById('canvas');
1663 if (!canvas.getContext) return;
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001664 canvas.width = window.innerWidth - at_x;
1665 canvas.height = window.innerHeight - at_y;
caryclark@google.com752b60e2012-03-22 21:11:17 +00001666 ctx = canvas.getContext('2d');
1667 var xmin = Infinity;
1668 var xmax = -Infinity;
1669 var ymin = Infinity;
1670 var ymax = -Infinity;
caryclark@google.comfb173422012-04-10 18:28:55 +00001671 for (var contours in test) {
1672 var contour = test[contours];
1673 for (var verbs in contour) {
1674 var verb = contour[verbs];
1675 var last = verb.length;
caryclark@google.comb45a1b42012-05-18 20:50:33 +00001676 for (var idx = 0; idx < last; idx += 2) {
1677 xmin = Math.min(xmin, verb[idx]);
1678 xmax = Math.max(xmax, verb[idx]);
1679 ymin = Math.min(ymin, verb[idx + 1]);
1680 ymax = Math.max(ymax, verb[idx + 1]);
1681 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001682 }
1683 }
1684 var subscale = 1;
1685 while ((xmax - xmin) * subscale < 0.1 && (ymax - ymin) * subscale < 0.1) {
1686 subscale *= 10;
1687 }
1688 columns = Math.ceil(xmax) - Math.floor(xmin) + 1;
1689 rows = Math.ceil(ymax) - Math.floor(ymin) + 1;
1690 xStart = Math.floor(xmin);
1691 yStart = Math.floor(ymin);
1692 var hscale = ctx.canvas.width / columns / ticks;
1693 var vscale = ctx.canvas.height / rows / ticks;
1694 scale = Math.floor(Math.min(hscale, vscale)) * subscale;
1695}
1696
1697function drawPoint(px, py, xoffset, yoffset, unit) {
caryclark@google.com2ddff932012-08-07 21:25:27 +00001698 var label = px.toFixed(decimal_places) + ", " + py.toFixed(decimal_places);
caryclark@google.com752b60e2012-03-22 21:11:17 +00001699 var _px = px * unit + xoffset;
1700 var _py = py * unit + yoffset;
1701 ctx.beginPath();
1702 ctx.arc(_px, _py, 3, 0, Math.PI*2, true);
1703 ctx.closePath();
1704 ctx.fill();
1705 ctx.fillText(label, _px + 5, _py);
1706}
1707
caryclark@google.com0e08a192012-07-13 21:07:52 +00001708function draw(test, title, _at_x, _at_y, scale) {
1709 ctx.fillStyle = "rgba(0,0,0, 0.1)";
1710 ctx.font = "normal 50px Arial";
1711 ctx.fillText(title, 50, 50);
1712 ctx.font = "normal 10px Arial";
1713
caryclark@google.com752b60e2012-03-22 21:11:17 +00001714 var unit = scale * ticks;
1715 ctx.lineWidth = 1;
1716 var i;
1717 for (i = 0; i <= rows * ticks; ++i) {
1718 ctx.strokeStyle = (i % ticks) != 0 ? "rgb(160,160,160)" : "black";
1719 ctx.beginPath();
1720 ctx.moveTo(_at_x + 0, _at_y + i * scale);
1721 ctx.lineTo(_at_x + unit * columns, _at_y + i * scale);
1722 ctx.stroke();
1723 }
1724 for (i = 0; i <= columns * ticks; ++i) {
1725 ctx.strokeStyle = (i % ticks) != 0 ? "rgb(160,160,160)" : "black";
1726 ctx.beginPath();
1727 ctx.moveTo(_at_x + i * scale, _at_y + 0);
1728 ctx.lineTo(_at_x + i * scale, _at_y + unit * rows);
1729 ctx.stroke();
1730 }
1731
1732 var xoffset = xStart * -unit + _at_x;
1733 var yoffset = yStart * -unit + _at_y;
1734
1735 ctx.fillStyle = "rgb(40,80,60)"
1736 for (i = 0; i <= columns; i += (1 / ticks))
1737 {
1738 num = (xoffset - _at_x) / -unit + i;
1739 ctx.fillText(num.toFixed(0), i * unit + _at_y - 5, 10);
1740 }
1741 for (i = 0; i <= rows; i += (1 / ticks))
1742 {
1743 num = (yoffset - _at_x) / -unit + i;
1744 ctx.fillText(num.toFixed(0), 0, i * unit + _at_y + 0);
1745 }
caryclark@google.com32546db2012-08-31 20:55:07 +00001746
caryclark@google.com752b60e2012-03-22 21:11:17 +00001747 ctx.strokeStyle = "red";
caryclark@google.comfb173422012-04-10 18:28:55 +00001748 var contours, verbs, pts;
caryclark@google.com8dcf1142012-07-02 20:27:02 +00001749 ctx.beginPath();
caryclark@google.comfb173422012-04-10 18:28:55 +00001750 for (contours in test) {
1751 var contour = test[contours];
1752 if (contours == 2) ctx.strokeStyle = "blue";
caryclark@google.comfb173422012-04-10 18:28:55 +00001753 var first = true;
1754 for (verbs in contour) {
1755 var verb = contour[verbs];
1756 switch (verb.length) {
1757 case 2:
1758 if (first) {
1759 ctx.moveTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit);
1760 first = false;
1761 } else
1762 ctx.lineTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit);
1763 break;
1764 case 4:
1765 ctx.quadraticCurveTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit,
1766 xoffset + verb[2] * unit, yoffset + verb[3] * unit);
1767 break;
1768 case 6:
1769 ctx.bezierCurveTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit,
1770 xoffset + verb[2] * unit, yoffset + verb[3] * unit,
1771 xoffset + verb[4] * unit, yoffset + verb[5] * unit);
1772 break;
1773 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001774 }
caryclark@google.com8dcf1142012-07-02 20:27:02 +00001775 ctx.closePath();
caryclark@google.com752b60e2012-03-22 21:11:17 +00001776 }
caryclark@google.com24bec792012-08-20 12:43:57 +00001777 if (hasXor) {
1778 ctx.fillType=xor; // how is this done?
1779 }
caryclark@google.com8dcf1142012-07-02 20:27:02 +00001780 ctx.stroke();
1781 ctx.fillStyle="rgba(192,192,255, 0.3)";
1782 ctx.fill();
caryclark@google.com752b60e2012-03-22 21:11:17 +00001783
1784 ctx.fillStyle="blue";
caryclark@google.comfb173422012-04-10 18:28:55 +00001785 for (contours in test) {
1786 var contour = test[contours];
1787 for (verbs in contour) {
1788 var verb = contour[verbs];
1789 for (i = 0; i < verb.length; i += 2) {
1790 x = verb[i];
1791 y = verb[i + 1];
1792 drawPoint(x, y, xoffset, yoffset, unit);
1793 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001794 }
1795 }
1796}
1797
1798var mouseX = Infinity, mouseY;
1799
1800function calcXY() {
1801 var e = window.event;
1802 var tgt = e.target || e.srcElement;
1803 var left = tgt.offsetLeft;
1804 var top = tgt.offsetTop;
1805 var unit = scale * ticks;
1806 mouseX = (e.clientX - left - Math.ceil(at_x) + 1) / unit + xStart;
1807 mouseY = (e.clientY - top - Math.ceil(at_y)) / unit + yStart;
1808}
1809
1810function handleMouseOver() {
1811 calcXY();
1812 var num = mouseX.toFixed(3) + ", " + mouseY.toFixed(3);
1813 ctx.beginPath();
1814 ctx.rect(300,100,200,10);
1815 ctx.fillStyle="white";
1816 ctx.fill();
1817 ctx.fillStyle="black";
1818 ctx.fillText(num, 300, 108);
1819}
1820
1821function handleMouseClick() {
1822 calcXY();
1823// drawInset();
1824}
1825
1826function drawTop() {
1827 init(tests[testIndex]);
1828 redraw();
1829}
1830
1831function redraw() {
1832 ctx.beginPath();
1833 ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height);
1834 ctx.fillStyle="white";
1835 ctx.fill();
caryclark@google.com0e08a192012-07-13 21:07:52 +00001836 draw(tests[testIndex], testTitles[testIndex], at_x, at_y, scale);
caryclark@google.com752b60e2012-03-22 21:11:17 +00001837// if (insetScale != scale && mouseX != Infinity)
1838// drawInset();
1839}
1840
1841function doKeyPress(evt) {
1842 var char = String.fromCharCode(evt.charCode);
1843 switch (char) {
1844 case 'N':
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001845 testIndex += 9;
caryclark@google.com752b60e2012-03-22 21:11:17 +00001846 case 'n':
1847 if (++testIndex >= tests.length)
1848 testIndex = 0;
caryclark@google.comfa0588f2012-04-26 21:01:06 +00001849 mouseX = Infinity;
1850 drawTop();
1851 break;
1852 case 'P':
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001853 testIndex -= 9;
caryclark@google.comfa0588f2012-04-26 21:01:06 +00001854 case 'p':
1855 if (--testIndex < 0)
1856 testIndex = tests.length - 1;
caryclark@google.com752b60e2012-03-22 21:11:17 +00001857 mouseX = Infinity;
1858 drawTop();
1859 break;
1860 case 'T':
1861 case 't':
caryclark@google.com752b60e2012-03-22 21:11:17 +00001862 break;
1863 case '-':
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001864 drawTop();
caryclark@google.com752b60e2012-03-22 21:11:17 +00001865 break;
1866 case '=':
1867 case '+':
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001868 drawTop();
caryclark@google.com752b60e2012-03-22 21:11:17 +00001869 break;
1870 }
1871}
1872
1873function start() {
1874 for (i = 0; i < testDivs.length; ++i) {
caryclark@google.com0e08a192012-07-13 21:07:52 +00001875 var title = testDivs[i].id.toString();
caryclark@google.com752b60e2012-03-22 21:11:17 +00001876 var str = testDivs[i].firstChild.data;
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001877 if (str.split("addRect").length > 1) {
caryclark@google.com0e08a192012-07-13 21:07:52 +00001878 parseRect(str, title);
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001879 } else {
caryclark@google.com0e08a192012-07-13 21:07:52 +00001880 parse(str, title);
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001881 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001882 }
1883 drawTop();
1884 window.addEventListener('keypress', doKeyPress, true);
caryclark@google.com534aa5b2012-08-02 20:08:21 +00001885 window.onresize = function() {
1886 drawTop();
1887 }
caryclark@google.com752b60e2012-03-22 21:11:17 +00001888}
1889
1890</script>
1891</head>
1892
1893<body onLoad="start();">
caryclark@google.comfa4a6e92012-07-11 17:52:32 +00001894<canvas id="canvas" width="750" height="500"
caryclark@google.com752b60e2012-03-22 21:11:17 +00001895 onmousemove="handleMouseOver()"
1896 onclick="handleMouseClick()"
1897 ></canvas >
1898</body>
1899</html>