aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/Intersection/Intersections.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-13 20:29:41 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-13 20:29:41 +0000
commit1304bb25aa3b0baa61fc2e2900fabcef88801b59 (patch)
treeed0c2c346ba327cc82e1d8850f840adeb4270cd3 /experimental/Intersection/Intersections.cpp
parentdcf9c19d38d366a9f27ad0d8b5bda327c5edb164 (diff)
shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@8137 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/Intersections.cpp')
-rw-r--r--experimental/Intersection/Intersections.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/experimental/Intersection/Intersections.cpp b/experimental/Intersection/Intersections.cpp
index 302502afb0..c5ff0ca23b 100644
--- a/experimental/Intersection/Intersections.cpp
+++ b/experimental/Intersection/Intersections.cpp
@@ -93,10 +93,24 @@ int Intersections::insert(double one, double two, const _Point& pt) {
SkASSERT(fUsed <= 1 || fT[0][0] < fT[0][1]);
int index;
for (index = 0; index < fUsed; ++index) {
- double midT = (fT[0][index] + one) / 2;
- if (approximately_equal(midT, one) || pt.approximatelyEqual(fPt[index])) {
+ double oldOne = fT[0][index];
+ double oldTwo = fT[1][index];
+ if (roughly_equal(oldOne, one) && roughly_equal(oldTwo, two)) {
+ if ((precisely_zero(one) && !precisely_zero(oldOne))
+ || (precisely_equal(one, 1) && !precisely_equal(oldOne, 1))
+ || (precisely_zero(two) && !precisely_zero(oldTwo))
+ || (precisely_equal(two, 1) && !precisely_equal(oldTwo, 1))) {
+ fT[0][index] = one;
+ fT[1][index] = two;
+ fPt[index] = pt;
+ }
return -1;
}
+ #if ONE_OFF_DEBUG
+ if (pt.roughlyEqual(fPt[index])) {
+ SkDebugf("%s t=%1.9g pts roughly equal\n", __FUNCTION__, one);
+ }
+ #endif
if (fT[0][index] > one) {
break;
}