op.htm revision 32546db1494a6c6433a7919844133a6ff5b5c7b2
1<!-- path visualizer --> 2<html> 3<head> 4<div style="height:0"> 5 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} 16</div> 17 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} 28</div> 29 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} 40</div> 41 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} 53</div> 54 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} 68</div> 69 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} 83</div> 84 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; 132 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); 139 path.close(); 140 testSimplify(path, true, out, bitmap); 141 drawAsciiPaths(path, out, true); 142} 143</div> 144 145<div id="testSimplifyQuadratic11"> 146 SkPath path, out; 147 path.moveTo(0, 0); 148 path.quadTo(0, 0, 0, 0); 149 path.lineTo(0, 2); 150 path.close(); 151 path.moveTo(0, 0); 152 path.lineTo(2, 1); 153 path.quadTo(2, 2, 3, 3); 154 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); 164 path.lineTo(0, 0); 165 path.close(); 166 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} 173</div> 174 175<div id="testSimplifyQuadratic13"> 176 SkPath path, out; 177path.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(); 186 testSimplify(path, true, out, bitmap); 187 drawAsciiPaths(path, out, true); 188} 189</div> 190 191<div id="testSimplifyQuadratic14"> 192 SkPath path, out; 193 path.moveTo(0, 0); 194 path.quadTo(0, 0, 0, 0); 195 path.lineTo(1, 1); 196 path.close(); 197 path.moveTo(0, 0); 198 path.lineTo(0, 0); 199 path.quadTo(0, 1, 2, 1); 200 path.close(); 201 testSimplify(path, true, out, bitmap); 202 drawAsciiPaths(path, out, true); 203} 204</div> 205 206<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; 238 path.moveTo(8, 8); 239 path.quadTo(10, 10, 8, -10); 240 path.close(); 241 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); 246 path.close(); 247 testSimplify(path, true, out, bitmap); 248 drawAsciiPaths(path, out, true); 249} 250</div> 251 252<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> 263 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 316<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 329<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 339<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 352<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 374<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 381<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 388<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 393<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 398<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 430<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 436<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 448<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 454<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 543<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 567<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 579<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 591<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 636<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 699<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 712<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 718<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 752<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 866<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 1040<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 1051<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 1231<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 1303<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 1314<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 1325</div> 1326 1327<script type="text/javascript"> 1328 1329var testDivs = [ 1330 testQuadratic20, 1331 testQuadratic19, 1332 testQuadratic18, 1333 testQuadratic17x, 1334 testQuadratic16b, 1335 testQuadratic16a, 1336 testQuadratic15, 1337 testQuadratic14, 1338 testQuadratic13b, 1339 testQuadratic13a, 1340 testQuadratic12, 1341 testQuadratic11b, 1342 testQuadratic11a, 1343 testQuadratic10b, 1344 testQuadratic10a, 1345 testQuadratic9a, 1346 testQuadratic9, 1347 testQuadratic8, 1348 testQuadratic7, 1349 testQuadratic6, 1350 testQuadratic5, 1351 testQuadratic4x, 1352 testQuadratic3, 1353 testQuadratic2, 1354 testQuadratic1, 1355 testLine4x, 1356 testLine3x, 1357 testLine2x, 1358 testLine1x, 1359 testQuadralateral9, 1360 testQuadralateral8, 1361 testQuadralateral7, 1362 testFauxQuadralateral6d, 1363 testFauxQuadralateral6c, 1364 testFauxQuadralateral6b, 1365 testFauxQuadralateral6a, 1366 testFauxQuadralateral6, 1367 testQuadralateral6a, 1368 testQuadralateral6, 1369 testQuadralateral5, 1370 testNondegenerate4, 1371 testNondegenerate3, 1372 testNondegenerate2, 1373 testNondegenerate1, 1374 testDegenerate4, 1375 testDegenerate3, 1376 testDegenerate2, 1377 testDegenerate1, 1378 testLine79, 1379 testLine78, 1380 testLine77, 1381 testLine76, 1382 testLine75, 1383 testLine74, 1384 testLine73, 1385 testLine72, 1386 testLine71, 1387 testLine70, 1388 testLine69, 1389 testLine68f, 1390 testLine68e, 1391 testLine68d, 1392 testLine68c, 1393 testLine68b, 1394 testLine68a, 1395 testLine67, 1396 testLine66, 1397 testLine65, 1398 testLine64, 1399 testLine63, 1400 testLine62, 1401 testLine61, 1402 testLine60, 1403 testLine59, 1404 testLine58, 1405 testLine57, 1406 testLine56, 1407 testLine55, 1408 testLine54, 1409 testLine53, 1410 testLine52, 1411 testLine51, 1412 testLine50, 1413 testLine49, 1414 testLine48, 1415 testLine47, 1416 testLine46, 1417 testLine45, 1418 testLine44, 1419 testLine43, 1420 testLine42, 1421 testLine41, 1422 testLine40, 1423 testLine39, 1424 testLine38, 1425 testLine37, 1426 testLine36, 1427 testLine35, 1428 testLine34, 1429 testLine33, 1430 testLine32, 1431 testLine31, 1432 testLine30, 1433 testLine29, 1434 testLine28, 1435 testLine24, 1436 testLine22, 1437 testLine19, 1438 testLine17, 1439 testLine13, 1440 testLine12, 1441 testLine9, 1442 testLine7b, 1443 testLine7, 1444 testSimplifyQuadratic21, 1445 testSimplifyQuadratic20, 1446 testSimplifyQuadratic19, 1447 testSimplifyQuadratic18, 1448 testSimplifyQuadratic17, 1449 testSimplifyQuadratic16, 1450 testSimplifyQuadratic15, 1451 testSimplifyQuadratic14, 1452 testSimplifyQuadratic13, 1453 testSimplifyQuadratic12, 1454 testSimplifyQuadratic11, 1455 testSimplifyQuadratic10, 1456 testSimplifyQuadratic9, 1457 testSimplifyQuadratic8, 1458 testSimplifyQuadratic7, 1459 testSimplifyQuadratic6, 1460 testSimplifyQuadratic5, 1461 testSimplifyQuadratic4, 1462 testSimplifyQuadratic3, 1463 testSimplifyQuadratic2, 1464 testSimplifyQuadratic1, 1465]; 1466 1467var scale, columns, rows, xStart, yStart; 1468 1469var ticks = 0.1; 1470var at_x = 13 + 0.5; 1471var at_y = 13 + 0.5; 1472var decimal_places = 0; // make this 3 to show more precision 1473 1474var tests = []; 1475var testTitles = []; 1476var testIndex = 0; 1477var hasXor = false; 1478 1479var ctx; 1480 1481function parse(test, title) { 1482 var contours = []; 1483 var contourStrs = test.split("path.close();"); 1484 var pattern = /-?\d+\.*\d*/g; 1485 hasXor = test.split("kEvenOdd_FillType").length > 1; 1486 for (var c in contourStrs) { 1487 var contour = contourStrs[c]; 1488 var verbStrs = contour.split("path"); 1489 var verbs = []; 1490 for (var v in verbStrs) { 1491 var verbStr = verbStrs[v]; 1492 var points = verbStr.match(pattern); 1493 var pts = []; 1494 for (var wd in points) { 1495 var num = parseFloat(points[wd]); 1496 if (isNaN(num)) continue; 1497 pts.push(num); 1498 } 1499 if (pts.length > 0) 1500 verbs.push(pts); 1501 } 1502 if (verbs.length > 0) { 1503 var lastIndex = verbs.length - 1; 1504 var lastVerb = verbs[lastIndex]; 1505 var lastLen = lastVerb.length; 1506 if (verbs[0][0] != lastVerb[lastLen - 2] && verbs[0][1] != lastVerb[lastLen - 1]) { 1507 var lastPts = []; 1508 lastPts.push(verbs[0][0]); 1509 lastPts.push(verbs[0][1]); 1510 verbs.push(lastPts); 1511 } 1512 contours.push(verbs); 1513 } 1514 } 1515 if (contours.length > 0) { 1516 tests.push(contours); 1517 testTitles.push(title); 1518 } 1519} 1520 1521function parseRect(test, title) { 1522 var contours = []; 1523 var rectStrs = test.split("path.addRect"); 1524 var pattern = /-?\d+\.*\d*/g; 1525 hasXor = test.split("kEvenOdd_FillType").length > 1; 1526 for (var r in rectStrs) { 1527 var rect = rectStrs[r]; 1528 var sideStrs = rect.match(pattern); 1529 var sides = []; 1530 for (var wd in sideStrs) { 1531 var num = parseFloat(sideStrs[wd]); 1532 if (isNaN(num)) continue; 1533 sides.push(num); 1534 } 1535 if (sides.length == 0) 1536 continue; 1537 var verbs = []; 1538 var topLeft = []; 1539 topLeft.push(sides[0]); topLeft.push(sides[1]); 1540 var topRight = []; 1541 topRight.push(sides[2]); topRight.push(sides[1]); 1542 var botLeft = []; 1543 botLeft.push(sides[0]); botLeft.push(sides[3]); 1544 var botRight = []; 1545 botRight.push(sides[2]); botRight.push(sides[3]); 1546 verbs.push(topLeft); 1547 if (sides[4] == 0) { 1548 verbs.push(topRight); 1549 verbs.push(botRight); 1550 verbs.push(botLeft); 1551 } else { 1552 verbs.push(botLeft); 1553 verbs.push(botRight); 1554 verbs.push(topRight); 1555 } 1556 verbs.push(topLeft); 1557 contours.push(verbs); 1558 } 1559 if (contours.length > 0) { 1560 tests.push(contours); 1561 testTitles.push(title); 1562 } 1563} 1564 1565function init(test) { 1566 var canvas = document.getElementById('canvas'); 1567 if (!canvas.getContext) return; 1568 canvas.width = window.innerWidth - at_x; 1569 canvas.height = window.innerHeight - at_y; 1570 ctx = canvas.getContext('2d'); 1571 var xmin = Infinity; 1572 var xmax = -Infinity; 1573 var ymin = Infinity; 1574 var ymax = -Infinity; 1575 for (var contours in test) { 1576 var contour = test[contours]; 1577 for (var verbs in contour) { 1578 var verb = contour[verbs]; 1579 var last = verb.length; 1580 for (var idx = 0; idx < last; idx += 2) { 1581 xmin = Math.min(xmin, verb[idx]); 1582 xmax = Math.max(xmax, verb[idx]); 1583 ymin = Math.min(ymin, verb[idx + 1]); 1584 ymax = Math.max(ymax, verb[idx + 1]); 1585 } 1586 } 1587 } 1588 var subscale = 1; 1589 while ((xmax - xmin) * subscale < 0.1 && (ymax - ymin) * subscale < 0.1) { 1590 subscale *= 10; 1591 } 1592 columns = Math.ceil(xmax) - Math.floor(xmin) + 1; 1593 rows = Math.ceil(ymax) - Math.floor(ymin) + 1; 1594 xStart = Math.floor(xmin); 1595 yStart = Math.floor(ymin); 1596 var hscale = ctx.canvas.width / columns / ticks; 1597 var vscale = ctx.canvas.height / rows / ticks; 1598 scale = Math.floor(Math.min(hscale, vscale)) * subscale; 1599} 1600 1601function drawPoint(px, py, xoffset, yoffset, unit) { 1602 var label = px.toFixed(decimal_places) + ", " + py.toFixed(decimal_places); 1603 var _px = px * unit + xoffset; 1604 var _py = py * unit + yoffset; 1605 ctx.beginPath(); 1606 ctx.arc(_px, _py, 3, 0, Math.PI*2, true); 1607 ctx.closePath(); 1608 ctx.fill(); 1609 ctx.fillText(label, _px + 5, _py); 1610} 1611 1612function draw(test, title, _at_x, _at_y, scale) { 1613 ctx.fillStyle = "rgba(0,0,0, 0.1)"; 1614 ctx.font = "normal 50px Arial"; 1615 ctx.fillText(title, 50, 50); 1616 ctx.font = "normal 10px Arial"; 1617 1618 var unit = scale * ticks; 1619 ctx.lineWidth = 1; 1620 var i; 1621 for (i = 0; i <= rows * ticks; ++i) { 1622 ctx.strokeStyle = (i % ticks) != 0 ? "rgb(160,160,160)" : "black"; 1623 ctx.beginPath(); 1624 ctx.moveTo(_at_x + 0, _at_y + i * scale); 1625 ctx.lineTo(_at_x + unit * columns, _at_y + i * scale); 1626 ctx.stroke(); 1627 } 1628 for (i = 0; i <= columns * ticks; ++i) { 1629 ctx.strokeStyle = (i % ticks) != 0 ? "rgb(160,160,160)" : "black"; 1630 ctx.beginPath(); 1631 ctx.moveTo(_at_x + i * scale, _at_y + 0); 1632 ctx.lineTo(_at_x + i * scale, _at_y + unit * rows); 1633 ctx.stroke(); 1634 } 1635 1636 var xoffset = xStart * -unit + _at_x; 1637 var yoffset = yStart * -unit + _at_y; 1638 1639 ctx.fillStyle = "rgb(40,80,60)" 1640 for (i = 0; i <= columns; i += (1 / ticks)) 1641 { 1642 num = (xoffset - _at_x) / -unit + i; 1643 ctx.fillText(num.toFixed(0), i * unit + _at_y - 5, 10); 1644 } 1645 for (i = 0; i <= rows; i += (1 / ticks)) 1646 { 1647 num = (yoffset - _at_x) / -unit + i; 1648 ctx.fillText(num.toFixed(0), 0, i * unit + _at_y + 0); 1649 } 1650 1651 ctx.strokeStyle = "red"; 1652 var contours, verbs, pts; 1653 ctx.beginPath(); 1654 for (contours in test) { 1655 var contour = test[contours]; 1656 if (contours == 2) ctx.strokeStyle = "blue"; 1657 var first = true; 1658 for (verbs in contour) { 1659 var verb = contour[verbs]; 1660 switch (verb.length) { 1661 case 2: 1662 if (first) { 1663 ctx.moveTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit); 1664 first = false; 1665 } else 1666 ctx.lineTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit); 1667 break; 1668 case 4: 1669 ctx.quadraticCurveTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit, 1670 xoffset + verb[2] * unit, yoffset + verb[3] * unit); 1671 break; 1672 case 6: 1673 ctx.bezierCurveTo(xoffset + verb[0] * unit, yoffset + verb[1] * unit, 1674 xoffset + verb[2] * unit, yoffset + verb[3] * unit, 1675 xoffset + verb[4] * unit, yoffset + verb[5] * unit); 1676 break; 1677 } 1678 } 1679 ctx.closePath(); 1680 } 1681 if (hasXor) { 1682 ctx.fillType=xor; // how is this done? 1683 } 1684 ctx.stroke(); 1685 ctx.fillStyle="rgba(192,192,255, 0.3)"; 1686 ctx.fill(); 1687 1688 ctx.fillStyle="blue"; 1689 for (contours in test) { 1690 var contour = test[contours]; 1691 for (verbs in contour) { 1692 var verb = contour[verbs]; 1693 for (i = 0; i < verb.length; i += 2) { 1694 x = verb[i]; 1695 y = verb[i + 1]; 1696 drawPoint(x, y, xoffset, yoffset, unit); 1697 } 1698 } 1699 } 1700} 1701 1702var mouseX = Infinity, mouseY; 1703 1704function calcXY() { 1705 var e = window.event; 1706 var tgt = e.target || e.srcElement; 1707 var left = tgt.offsetLeft; 1708 var top = tgt.offsetTop; 1709 var unit = scale * ticks; 1710 mouseX = (e.clientX - left - Math.ceil(at_x) + 1) / unit + xStart; 1711 mouseY = (e.clientY - top - Math.ceil(at_y)) / unit + yStart; 1712} 1713 1714function handleMouseOver() { 1715 calcXY(); 1716 var num = mouseX.toFixed(3) + ", " + mouseY.toFixed(3); 1717 ctx.beginPath(); 1718 ctx.rect(300,100,200,10); 1719 ctx.fillStyle="white"; 1720 ctx.fill(); 1721 ctx.fillStyle="black"; 1722 ctx.fillText(num, 300, 108); 1723} 1724 1725function handleMouseClick() { 1726 calcXY(); 1727// drawInset(); 1728} 1729 1730function drawTop() { 1731 init(tests[testIndex]); 1732 redraw(); 1733} 1734 1735function redraw() { 1736 ctx.beginPath(); 1737 ctx.rect(0, 0, ctx.canvas.width, ctx.canvas.height); 1738 ctx.fillStyle="white"; 1739 ctx.fill(); 1740 draw(tests[testIndex], testTitles[testIndex], at_x, at_y, scale); 1741// if (insetScale != scale && mouseX != Infinity) 1742// drawInset(); 1743} 1744 1745function doKeyPress(evt) { 1746 var char = String.fromCharCode(evt.charCode); 1747 switch (char) { 1748 case 'N': 1749 testIndex += 9; 1750 case 'n': 1751 if (++testIndex >= tests.length) 1752 testIndex = 0; 1753 mouseX = Infinity; 1754 drawTop(); 1755 break; 1756 case 'P': 1757 testIndex -= 9; 1758 case 'p': 1759 if (--testIndex < 0) 1760 testIndex = tests.length - 1; 1761 mouseX = Infinity; 1762 drawTop(); 1763 break; 1764 case 'T': 1765 case 't': 1766 break; 1767 case '-': 1768 drawTop(); 1769 break; 1770 case '=': 1771 case '+': 1772 drawTop(); 1773 break; 1774 } 1775} 1776 1777function start() { 1778 for (i = 0; i < testDivs.length; ++i) { 1779 var title = testDivs[i].id.toString(); 1780 var str = testDivs[i].firstChild.data; 1781 if (str.split("addRect").length > 1) { 1782 parseRect(str, title); 1783 } else { 1784 parse(str, title); 1785 } 1786 } 1787 drawTop(); 1788 window.addEventListener('keypress', doKeyPress, true); 1789 window.onresize = function() { 1790 drawTop(); 1791 } 1792} 1793 1794</script> 1795</head> 1796 1797<body onLoad="start();"> 1798<canvas id="canvas" width="750" height="500" 1799 onmousemove="handleMouseOver()" 1800 onclick="handleMouseClick()" 1801 ></canvas > 1802</body> 1803</html> 1804