| 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 | 7 |
| 8 #include "SkMutex.h" | 8 #include "SkMutex.h" |
| 9 #include "SkOpCoincidence.h" | 9 #include "SkOpCoincidence.h" |
| 10 #include "SkOpContour.h" | 10 #include "SkOpContour.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 575 |
| 576 void SkDRect::debugInit() { | 576 void SkDRect::debugInit() { |
| 577 fLeft = fTop = fRight = fBottom = SK_ScalarNaN; | 577 fLeft = fTop = fRight = fBottom = SK_ScalarNaN; |
| 578 } | 578 } |
| 579 | 579 |
| 580 #include "SkOpAngle.h" | 580 #include "SkOpAngle.h" |
| 581 #include "SkOpSegment.h" | 581 #include "SkOpSegment.h" |
| 582 | 582 |
| 583 #if DEBUG_COINCIDENCE | 583 #if DEBUG_COINCIDENCE |
| 584 // commented-out lines keep this in sync with addT() | 584 // commented-out lines keep this in sync with addT() |
| 585 const SkOpPtT* SkOpSegment::debugAddT(double t, AliasMatch allowAlias, bool* al
located) const { | 585 const SkOpPtT* SkOpSegment::debugAddT(double t, bool* allocated) const { |
| 586 debugValidate(); | 586 debugValidate(); |
| 587 SkPoint pt = this->ptAtT(t); | 587 SkPoint pt = this->ptAtT(t); |
| 588 const SkOpSpanBase* span = &fHead; | 588 const SkOpSpanBase* span = &fHead; |
| 589 do { | 589 do { |
| 590 const SkOpPtT* result = span->ptT(); | 590 const SkOpPtT* result = span->ptT(); |
| 591 const SkOpPtT* loop; | 591 const SkOpPtT* loop; |
| 592 bool duplicatePt; | 592 bool duplicatePt; |
| 593 if (t == result->fT) { | 593 if (t == result->fT) { |
| 594 goto bumpSpan; | 594 goto bumpSpan; |
| 595 } | 595 } |
| 596 if (this->match(result, this, t, pt, allowAlias)) { | 596 if (this->match(result, this, t, pt)) { |
| 597 // see if any existing alias matches segment, pt, and t | 597 // see if any existing alias matches segment, pt, and t |
| 598 loop = result->next(); | 598 loop = result->next(); |
| 599 duplicatePt = false; | 599 duplicatePt = false; |
| 600 while (loop != result) { | 600 while (loop != result) { |
| 601 bool ptMatch = loop->fPt == pt; | 601 bool ptMatch = loop->fPt == pt; |
| 602 if (loop->segment() == this && loop->fT == t && ptMatch) { | 602 if (loop->segment() == this && loop->fT == t && ptMatch) { |
| 603 goto bumpSpan; | 603 goto bumpSpan; |
| 604 } | 604 } |
| 605 duplicatePt |= ptMatch; | 605 duplicatePt |= ptMatch; |
| 606 loop = loop->next(); | 606 loop = loop->next(); |
| 607 } | 607 } |
| 608 if (kNoAliasMatch == allowAlias) { | |
| 609 bumpSpan: | 608 bumpSpan: |
| 610 // span->bumpSpanAdds(); | |
| 611 return result; | |
| 612 } | |
| 613 // SkOpPtT* alias = SkOpTAllocator<SkOpPtT>::Allocate(allocator); | |
| 614 // alias->init(result->span(), t, pt, duplicatePt); | |
| 615 // result->insert(alias); | |
| 616 // result->span()->unaligned(); | |
| 617 this->debugValidate(); | |
| 618 // #if DEBUG_ADD_T | |
| 619 // SkDebugf("%s alias t=%1.9g segID=%d spanID=%d\n", __FUNCTION__,
t, | |
| 620 // alias->segment()->debugID(), alias->span()->debugID()); | |
| 621 // #endif | |
| 622 // span->bumpSpanAdds(); | 609 // span->bumpSpanAdds(); |
| 623 if (allocated) { | 610 return result; |
| 624 *allocated = true; | |
| 625 } | |
| 626 return nullptr; | |
| 627 } | 611 } |
| 628 if (t < result->fT) { | 612 if (t < result->fT) { |
| 629 const SkOpSpan* prev = result->span()->prev(); | 613 const SkOpSpan* prev = result->span()->prev(); |
| 630 if (!prev) { | 614 if (!prev) { |
| 631 return nullptr; // FIXME: this is a fail case; nullptr return e
lsewhere means result was allocated in non-const version | 615 return nullptr; // FIXME: this is a fail case; nullptr return e
lsewhere means result was allocated in non-const version |
| 632 } | 616 } |
| 633 // SkOpSpan* span = insert(prev, allocator); | 617 // SkOpSpan* span = insert(prev, allocator); |
| 634 // span->init(this, prev, t, pt); | 618 // span->init(this, prev, t, pt); |
| 635 this->debugValidate(); | 619 this->debugValidate(); |
| 636 // #if DEBUG_ADD_T | 620 // #if DEBUG_ADD_T |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 if (osExisting && (osExisting == oe || osExisting->contains(oeExisting ? oeE
xisting : oe))) { | 1465 if (osExisting && (osExisting == oe || osExisting->contains(oeExisting ? oeE
xisting : oe))) { |
| 1482 return; | 1466 return; |
| 1483 } | 1467 } |
| 1484 if (oeExisting && (oeExisting == os || oeExisting->contains(osExisting ? osE
xisting : os))) { | 1468 if (oeExisting && (oeExisting == os || oeExisting->contains(osExisting ? osE
xisting : os))) { |
| 1485 return; | 1469 return; |
| 1486 } | 1470 } |
| 1487 bool csDeleted = false, osDeleted = false, ceDeleted = false, oeDeleted = f
alse; | 1471 bool csDeleted = false, osDeleted = false, ceDeleted = false, oeDeleted = f
alse; |
| 1488 this->debugValidate(); | 1472 this->debugValidate(); |
| 1489 if (!cs || !os) { | 1473 if (!cs || !os) { |
| 1490 if (!cs) | 1474 if (!cs) |
| 1491 cs = coinSeg->debugAddT(coinTs, SkOpSegment::kNoAliasMatch, nullptr)
; | 1475 cs = coinSeg->debugAddT(coinTs, nullptr); |
| 1492 if (!os) | 1476 if (!os) |
| 1493 os = oppSeg->debugAddT(oppTs, SkOpSegment::kNoAliasMatch, nullptr); | 1477 os = oppSeg->debugAddT(oppTs, nullptr); |
| 1494 if (cs && os) cs->span()->debugAddOppAndMerge(id, log, os->span(), &csDe
leted, &osDeleted); | 1478 if (cs && os) cs->span()->debugAddOppAndMerge(id, log, os->span(), &csDe
leted, &osDeleted); |
| 1495 // cs = csWritable; | 1479 // cs = csWritable; |
| 1496 // os = osWritable; | 1480 // os = osWritable; |
| 1497 if ((ce && ce->deleted()) || (oe && oe->deleted())) { | 1481 if ((ce && ce->deleted()) || (oe && oe->deleted())) { |
| 1498 return; | 1482 return; |
| 1499 } | 1483 } |
| 1500 } | 1484 } |
| 1501 if (!ce || !oe) { | 1485 if (!ce || !oe) { |
| 1502 if (!ce) | 1486 if (!ce) |
| 1503 ce = coinSeg->debugAddT(coinTe, SkOpSegment::kNoAliasMatch, nullptr)
; | 1487 ce = coinSeg->debugAddT(coinTe, nullptr); |
| 1504 if (!oe) | 1488 if (!oe) |
| 1505 oe = oppSeg->debugAddT(oppTe, SkOpSegment::kNoAliasMatch, nullptr); | 1489 oe = oppSeg->debugAddT(oppTe, nullptr); |
| 1506 if (ce && oe) ce->span()->debugAddOppAndMerge(id, log, oe->span(), &ceDe
leted, &oeDeleted); | 1490 if (ce && oe) ce->span()->debugAddOppAndMerge(id, log, oe->span(), &ceDe
leted, &oeDeleted); |
| 1507 // ce = ceWritable; | 1491 // ce = ceWritable; |
| 1508 // oe = oeWritable; | 1492 // oe = oeWritable; |
| 1509 } | 1493 } |
| 1510 this->debugValidate(); | 1494 this->debugValidate(); |
| 1511 if (csDeleted || osDeleted || ceDeleted || oeDeleted) { | 1495 if (csDeleted || osDeleted || ceDeleted || oeDeleted) { |
| 1512 return; | 1496 return; |
| 1513 } | 1497 } |
| 1514 if (!cs || !ce || cs->contains(ce) || !os || !oe || os->contains(oe)) { | 1498 if (!cs || !ce || cs->contains(ce) || !os || !oe || os->contains(oe)) { |
| 1515 return; | 1499 return; |
| (...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 #endif | 2451 #endif |
| 2468 SkPath::FillType fillType = path.getFillType(); | 2452 SkPath::FillType fillType = path.getFillType(); |
| 2469 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver
seEvenOdd_FillType); | 2453 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver
seEvenOdd_FillType); |
| 2470 if (includeDeclaration) { | 2454 if (includeDeclaration) { |
| 2471 SkDebugf(" SkPath %s;\n", name); | 2455 SkDebugf(" SkPath %s;\n", name); |
| 2472 } | 2456 } |
| 2473 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); | 2457 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); |
| 2474 iter.setPath(path); | 2458 iter.setPath(path); |
| 2475 showPathContours(iter, name); | 2459 showPathContours(iter, name); |
| 2476 } | 2460 } |
| OLD | NEW |