fix minor skp-found bugs
remove globals from pathops_unittest
BUG=skia:2460
TBR=mtklein
Author: caryclark@google.com
Review URL: https://codereview.chromium.org/239563004
git-svn-id: http://skia.googlecode.com/svn/trunk@14378 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pathops/SkOpContour.cpp b/src/pathops/SkOpContour.cpp
index db805a2..e3137b7 100644
--- a/src/pathops/SkOpContour.cpp
+++ b/src/pathops/SkOpContour.cpp
@@ -211,9 +211,12 @@
}
bool swapStart = startT > endT;
bool swapOther = oStartT > oEndT;
+ const SkPoint* startPt = &coincidence.fPts[0];
+ const SkPoint* endPt = &coincidence.fPts[1];
if (swapStart) {
- SkTSwap<double>(startT, endT);
- SkTSwap<double>(oStartT, oEndT);
+ SkTSwap(startT, endT);
+ SkTSwap(oStartT, oEndT);
+ SkTSwap(startPt, endPt);
}
bool cancel = swapOther != swapStart;
int step = swapStart ? -1 : 1;
@@ -222,17 +225,18 @@
if (partial ? startT != 0 || oMatchStart != 0 : (startT == 0) != (oMatchStart == 0)) {
bool added = false;
if (oMatchStart != 0) {
- added = thisOne.joinCoincidence(&other, oMatchStart, oStep, cancel);
+ const SkPoint& oMatchStartPt = cancel ? *endPt : *startPt;
+ added = thisOne.joinCoincidence(&other, oMatchStart, oMatchStartPt, oStep, cancel);
}
if (!cancel && startT != 0 && !added) {
- (void) other.joinCoincidence(&thisOne, startT, step, cancel);
+ (void) other.joinCoincidence(&thisOne, startT, *startPt, step, cancel);
}
}
double oMatchEnd = cancel ? oStartT : oEndT;
if (partial ? endT != 1 || oMatchEnd != 1 : (endT == 1) != (oMatchEnd == 1)) {
bool added = false;
if (cancel && endT != 1 && !added) {
- (void) other.joinCoincidence(&thisOne, endT, -step, cancel);
+ (void) other.joinCoincidence(&thisOne, endT, *endPt, -step, cancel);
}
}
}
@@ -329,7 +333,7 @@
continue;
}
fDone = false;
- SkPoint testXY = testSegment->activeLeftTop(true, NULL);
+ SkPoint testXY = testSegment->activeLeftTop(NULL);
if (*topStart) {
if (testXY.fY < topLeft.fY) {
continue;