diff options
author | 2013-02-17 01:41:25 +0000 | |
---|---|---|
committer | 2013-02-17 01:41:25 +0000 | |
commit | 47d73daa7a971e7eee5822def7922f7d43b2dc47 (patch) | |
tree | bdb9a797755833b2fa5a712f397a1d6281b8677b /experimental/Intersection/Intersections.cpp | |
parent | 6d697f4b1fb2e71303c6d28c176fabf831bcaaa7 (diff) |
shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@7758 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/Intersections.cpp')
-rw-r--r-- | experimental/Intersection/Intersections.cpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/experimental/Intersection/Intersections.cpp b/experimental/Intersection/Intersections.cpp index 26fcc3f728..3de45cb4c7 100644 --- a/experimental/Intersection/Intersections.cpp +++ b/experimental/Intersection/Intersections.cpp @@ -122,16 +122,22 @@ void Intersections::remove(double one, double two, const _Point& startPt, const || startPt.approximatelyEqual(fPt[index]) || endPt.approximatelyEqual(fPt[index]))) { SkASSERT(fUsed > 0); - int remaining = --fUsed - index; - if (remaining > 0) { - memmove(&fPt[index], &fPt[index - 1], sizeof(fPt[0]) * remaining); - memmove(&fT[0][index], &fT[0][index - 1], sizeof(fT[0][0]) * remaining); - memmove(&fT[1][index], &fT[1][index - 1], sizeof(fT[1][0]) * remaining); - int coBit = fIsCoincident[0] & (1 << index); - fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit; - SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index)))); - fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit; - } + removeOne(index); } } } + +void Intersections::removeOne(int index) { + int remaining = --fUsed - index; + if (remaining <= 0) { + return; + } + memmove(&fPt[index], &fPt[index + 1], sizeof(fPt[0]) * remaining); + memmove(&fT[0][index], &fT[0][index + 1], sizeof(fT[0][0]) * remaining); + memmove(&fT[1][index], &fT[1][index + 1], sizeof(fT[1][0]) * remaining); + SkASSERT(fIsCoincident[0] == 0); + int coBit = fIsCoincident[0] & (1 << index); + fIsCoincident[0] -= ((fIsCoincident[0] >> 1) & ~((1 << index) - 1)) + coBit; + SkASSERT(!(coBit ^ (fIsCoincident[1] & (1 << index)))); + fIsCoincident[1] -= ((fIsCoincident[1] >> 1) & ~((1 << index) - 1)) + coBit; +} |