aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkOpContour.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathops/SkOpContour.cpp')
-rw-r--r--src/pathops/SkOpContour.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/pathops/SkOpContour.cpp b/src/pathops/SkOpContour.cpp
index 1aee4055c2..6266c65cf8 100644
--- a/src/pathops/SkOpContour.cpp
+++ b/src/pathops/SkOpContour.cpp
@@ -64,38 +64,36 @@ void SkOpContour::addCoincidentPoints() {
#endif
double startT = coincidence.fTs[0][0];
double endT = coincidence.fTs[0][1];
- bool cancelers;
- if ((cancelers = startT > endT)) {
+ bool startSwapped, oStartSwapped, cancelers;
+ if ((cancelers = startSwapped = startT > endT)) {
SkTSwap(startT, endT);
- SkTSwap(coincidence.fPts[0], coincidence.fPts[1]);
}
SkASSERT(!approximately_negative(endT - startT));
double oStartT = coincidence.fTs[1][0];
double oEndT = coincidence.fTs[1][1];
- if (oStartT > oEndT) {
- SkTSwap<double>(oStartT, oEndT);
+ if ((oStartSwapped = oStartT > oEndT)) {
+ SkTSwap(oStartT, oEndT);
cancelers ^= true;
}
SkASSERT(!approximately_negative(oEndT - oStartT));
- bool opp = fOperand ^ otherContour->fOperand;
- if (cancelers && !opp) {
+ if (cancelers) {
// make sure startT and endT have t entries
if (startT > 0 || oEndT < 1
|| thisOne.isMissing(startT) || other.isMissing(oEndT)) {
- thisOne.addTPair(startT, &other, oEndT, true, coincidence.fPts[0]);
+ thisOne.addTPair(startT, &other, oEndT, true, coincidence.fPts[startSwapped]);
}
if (oStartT > 0 || endT < 1
|| thisOne.isMissing(endT) || other.isMissing(oStartT)) {
- other.addTPair(oStartT, &thisOne, endT, true, coincidence.fPts[1]);
+ other.addTPair(oStartT, &thisOne, endT, true, coincidence.fPts[oStartSwapped]);
}
} else {
if (startT > 0 || oStartT > 0
|| thisOne.isMissing(startT) || other.isMissing(oStartT)) {
- thisOne.addTPair(startT, &other, oStartT, true, coincidence.fPts[0]);
+ thisOne.addTPair(startT, &other, oStartT, true, coincidence.fPts[startSwapped]);
}
if (endT < 1 || oEndT < 1
|| thisOne.isMissing(endT) || other.isMissing(oEndT)) {
- other.addTPair(oEndT, &thisOne, endT, true, coincidence.fPts[1]);
+ other.addTPair(oEndT, &thisOne, endT, true, coincidence.fPts[!oStartSwapped]);
}
}
#if DEBUG_CONCIDENT
@@ -135,8 +133,7 @@ void SkOpContour::calcCoincidentWinding() {
cancelers ^= true;
}
SkASSERT(!approximately_negative(oEndT - oStartT));
- bool opp = fOperand ^ otherContour->fOperand;
- if (cancelers && !opp) {
+ if (cancelers) {
// make sure startT and endT have t entries
if (!thisOne.done() && !other.done()) {
thisOne.addTCancel(startT, endT, &other, oStartT, oEndT);