OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "PathOpsTestCommon.h" | 7 #include "PathOpsTestCommon.h" |
8 #include "SkIntersections.h" | 8 #include "SkIntersections.h" |
9 #include "SkOpSegment.h" | 9 #include "SkOpSegment.h" |
10 #include "SkPathOpsTriangle.h" | 10 #include "SkPathOpsTriangle.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 PathOpsSegmentTester::ConstructLine(&segment[index], data.fShort
Pts); | 257 PathOpsSegmentTester::ConstructLine(&segment[index], data.fShort
Pts); |
258 break; | 258 break; |
259 case 3: | 259 case 3: |
260 PathOpsSegmentTester::ConstructQuad(&segment[index], data.fShort
Pts); | 260 PathOpsSegmentTester::ConstructQuad(&segment[index], data.fShort
Pts); |
261 break; | 261 break; |
262 case 4: | 262 case 4: |
263 PathOpsSegmentTester::ConstructCubic(&segment[index], data.fShor
tPts); | 263 PathOpsSegmentTester::ConstructCubic(&segment[index], data.fShor
tPts); |
264 break; | 264 break; |
265 } | 265 } |
266 } | 266 } |
267 PathOpsAngleTester::Orderable(segment[0].angle(0), segment[1].angle(0)); | 267 PathOpsAngleTester::Orderable(*segment[0].debugLastAngle(), *segment[1].debu
gLastAngle()); |
268 } | 268 } |
269 | 269 |
270 struct IntersectData { | 270 struct IntersectData { |
271 const SkDCubic fPts; | 271 const SkDCubic fPts; |
272 const int fPtCount; | 272 const int fPtCount; |
273 double fTStart; | 273 double fTStart; |
274 double fTEnd; | 274 double fTEnd; |
275 SkPoint fShortPts[4]; | 275 SkPoint fShortPts[4]; |
276 }; | 276 }; |
277 | 277 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 case 4: { | 431 case 4: { |
432 SkDCubic seg = SkDCubic::SubDivide(temp, data.fTStart, d
ata.fTEnd); | 432 SkDCubic seg = SkDCubic::SubDivide(temp, data.fTStart, d
ata.fTEnd); |
433 data.fShortPts[0] = seg[0].asSkPoint(); | 433 data.fShortPts[0] = seg[0].asSkPoint(); |
434 data.fShortPts[1] = seg[1].asSkPoint(); | 434 data.fShortPts[1] = seg[1].asSkPoint(); |
435 data.fShortPts[2] = seg[2].asSkPoint(); | 435 data.fShortPts[2] = seg[2].asSkPoint(); |
436 data.fShortPts[3] = seg[3].asSkPoint(); | 436 data.fShortPts[3] = seg[3].asSkPoint(); |
437 PathOpsSegmentTester::ConstructCubic(&segment[index3], d
ata.fShortPts); | 437 PathOpsSegmentTester::ConstructCubic(&segment[index3], d
ata.fShortPts); |
438 } break; | 438 } break; |
439 } | 439 } |
440 } | 440 } |
441 SkOpAngle& angle1 = const_cast<SkOpAngle&>(segment[0].angle(0)); | 441 SkOpAngle& angle1 = *const_cast<SkOpAngle*>(segment[0].debugLastAngl
e()); |
442 SkOpAngle& angle2 = const_cast<SkOpAngle&>(segment[1].angle(0)); | 442 SkOpAngle& angle2 = *const_cast<SkOpAngle*>(segment[1].debugLastAngl
e()); |
443 SkOpAngle& angle3 = const_cast<SkOpAngle&>(segment[2].angle(0)); | 443 SkOpAngle& angle3 = *const_cast<SkOpAngle*>(segment[2].debugLastAngl
e()); |
444 PathOpsAngleTester::SetNext(angle1, angle3); | 444 PathOpsAngleTester::SetNext(angle1, angle3); |
445 // These data sets are seeded when the set itself fails, so likely the da
taset does not | 445 // These data sets are seeded when the set itself fails, so likely the da
taset does not |
446 // match the expected result. The tests above return 1 when first added,
but | 446 // match the expected result. The tests above return 1 when first added,
but |
447 // return 0 after the bug is fixed. | 447 // return 0 after the bug is fixed. |
448 SkDEBUGCODE(int result =) PathOpsAngleTester::After(angle2, angle1); | 448 SkDEBUGCODE(int result =) PathOpsAngleTester::After(angle2, angle1); |
449 SkASSERT(result == 0 || result == 1); | 449 SkASSERT(result == 0 || result == 1); |
450 } | 450 } |
451 } | 451 } |
452 } | 452 } |
453 | 453 |
(...skipping 22 matching lines...) Expand all Loading... |
476 addT(NULL, shortQuad[1], 1); | 476 addT(NULL, shortQuad[1], 1); |
477 debugConstruct(); | 477 debugConstruct(); |
478 } | 478 } |
479 | 479 |
480 void SkOpSegment::debugConstructQuad(SkPoint shortQuad[3]) { | 480 void SkOpSegment::debugConstructQuad(SkPoint shortQuad[3]) { |
481 addQuad(shortQuad, false, false); | 481 addQuad(shortQuad, false, false); |
482 addT(NULL, shortQuad[0], 0); | 482 addT(NULL, shortQuad[0], 0); |
483 addT(NULL, shortQuad[2], 1); | 483 addT(NULL, shortQuad[2], 1); |
484 debugConstruct(); | 484 debugConstruct(); |
485 } | 485 } |
OLD | NEW |