Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1510)

Unified Diff: src/pathops/SkIntersections.cpp

Issue 21359002: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove space Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pathops/SkIntersections.h ('k') | src/pathops/SkLineParameters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkIntersections.cpp
diff --git a/src/pathops/SkIntersections.cpp b/src/pathops/SkIntersections.cpp
index 242c67b926e733c918b517cd2b609dd0c73c6a41..3a5e24f0a794e577a8e82f75ad982e69fb6cf95e 100644
--- a/src/pathops/SkIntersections.cpp
+++ b/src/pathops/SkIntersections.cpp
@@ -93,8 +93,10 @@ int SkIntersections::insert(double one, double two, const SkDPoint& pt) {
memmove(&fPt[index + 1], &fPt[index], sizeof(fPt[0]) * remaining);
memmove(&fT[0][index + 1], &fT[0][index], sizeof(fT[0][0]) * remaining);
memmove(&fT[1][index + 1], &fT[1][index], sizeof(fT[1][0]) * remaining);
- fIsCoincident[0] += fIsCoincident[0] & ~((1 << index) - 1);
- fIsCoincident[1] += fIsCoincident[1] & ~((1 << index) - 1);
+ int clearMask = ~((1 << index) - 1);
+ fIsCoincident[0] += fIsCoincident[0] & clearMask;
+ fIsCoincident[1] += fIsCoincident[1] & clearMask;
+ fIsNear += fIsNear & clearMask;
}
fPt[index] = pt;
fT[0][index] = one;
@@ -103,6 +105,14 @@ int SkIntersections::insert(double one, double two, const SkDPoint& pt) {
return index;
}
+void SkIntersections::insertNear(double one, double two, const SkDPoint& pt) {
+ int index = insert(one, two, pt);
+ if (index < 0) {
+ return;
+ }
+ fIsNear |= 1 << index;
+}
+
void SkIntersections::insertCoincident(double one, double two, const SkDPoint& pt) {
int index = insertSwap(one, two, pt);
int bit = 1 << index;
@@ -158,6 +168,7 @@ void SkIntersections::removeOne(int 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;
+ fIsNear -= ((fIsNear >> 1) & ~((1 << index) - 1)) + (fIsNear & (1 << index));
}
void SkIntersections::swapPts() {
« no previous file with comments | « src/pathops/SkIntersections.h ('k') | src/pathops/SkLineParameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698