diff options
author | caryclark <caryclark@google.com> | 2014-06-17 05:15:38 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-17 05:15:38 -0700 |
commit | dac1d17027dcaa5596885a9f333979418b35001c (patch) | |
tree | 923c6ca762654144254565240de5e9ec6598c41f /src/pathops/SkOpAngle.cpp | |
parent | d6043b20b63f895d384b4794205ac914abfafa71 (diff) |
Enabling the canvas bit to turn the clip stack into a flat replace exposed around 100 failures when testing the 800K skp set generated from the top 1M web sites.
This fixes all but one of those failures.
Major changes include:
- Replace angle indices with angle pointers. This was motivated by the need to add angles later but not renumber existing angles.
- Aggressive segment chase. When the winding is known on a segment, more aggressively passing that winding to adjacent segments allows fragmented data sets to succeed.
- Line segments with ends nearly the same are treated as coincident first.
- Transfer partial coincidence by observing that if segment A is partially coincident to B and C then B and C may be partially coincident.
TBR=reed
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/272153002
Diffstat (limited to 'src/pathops/SkOpAngle.cpp')
-rw-r--r-- | src/pathops/SkOpAngle.cpp | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/src/pathops/SkOpAngle.cpp b/src/pathops/SkOpAngle.cpp index 094b22c7e5..894758cfe8 100644 --- a/src/pathops/SkOpAngle.cpp +++ b/src/pathops/SkOpAngle.cpp @@ -289,7 +289,7 @@ bool SkOpAngle::computeSector() { // FIXME: logically, this should return !fUnorderable, but doing so breaks testQuadratic51 // -- but in general, this code may not work so this may be the least of problems // adding the bang fixes testQuads46x in release, however - return fUnorderable; + return !fUnorderable; } SkASSERT(fSegment->verb() != SkPath::kLine_Verb && small()); fComputedSector = true; @@ -322,7 +322,7 @@ recomputeSector: return false; } int saveEnd = fEnd; - fEnd = checkEnd - step; + fComputedEnd = fEnd = checkEnd - step; setSpans(); setSector(); fEnd = saveEnd; @@ -414,12 +414,12 @@ bool SkOpAngle::endsIntersect(const SkOpAngle& rh) const { SkIntersections i; (*CurveIntersectRay[index ? rPts : lPts])(segment.pts(), rays[index], &i); // SkASSERT(i.used() >= 1); - if (i.used() <= 1) { - continue; - } +// if (i.used() <= 1) { +// continue; +// } double tStart = segment.t(index ? rh.fStart : fStart); - double tEnd = segment.t(index ? rh.fEnd : fEnd); - bool testAscends = index ? rh.fStart < rh.fEnd : fStart < fEnd; + double tEnd = segment.t(index ? rh.fComputedEnd : fComputedEnd); + bool testAscends = index ? rh.fStart < rh.fComputedEnd : fStart < fComputedEnd; double t = testAscends ? 0 : 1; for (int idx2 = 0; idx2 < i.used(); ++idx2) { double testT = i[0][idx2]; @@ -879,12 +879,9 @@ SkOpAngle* SkOpAngle::previous() const { } void SkOpAngle::set(const SkOpSegment* segment, int start, int end) { -#if DEBUG_ANGLE - fID = 0; -#endif fSegment = segment; fStart = start; - fEnd = end; + fComputedEnd = fEnd = end; fNext = NULL; fComputeSector = fComputedSector = false; fStop = false; @@ -1097,3 +1094,33 @@ bool SkOpAngle::tangentsDiverge(const SkOpAngle& rh, double s0xt0) const { double mFactor = fabs(useS ? distEndRatio(sDist) : rh.distEndRatio(tDist)); return mFactor < 5000; // empirically found limit } + +SkOpAngleSet::SkOpAngleSet() + : fAngles(NULL) +#if DEBUG_ANGLE + , fCount(0) +#endif +{ +} + +SkOpAngleSet::~SkOpAngleSet() { + SkDELETE(fAngles); +} + +SkOpAngle& SkOpAngleSet::push_back() { + if (!fAngles) { + fAngles = SkNEW_ARGS(SkChunkAlloc, (2)); + } + void* ptr = fAngles->allocThrow(sizeof(SkOpAngle)); + SkOpAngle* angle = (SkOpAngle*) ptr; +#if DEBUG_ANGLE + angle->setID(++fCount); +#endif + return *angle; +} + +void SkOpAngleSet::reset() { + if (fAngles) { + fAngles->reset(); + } +} |