path ops -- use standard max, min, double-is-nan
fix a comment or two as well
Review URL: https://codereview.chromium.org/13934009
git-svn-id: http://skia.googlecode.com/svn/trunk@8822 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pathops/SkDCubicIntersection.cpp b/src/pathops/SkDCubicIntersection.cpp
index 2f1804d..10d4e71 100644
--- a/src/pathops/SkDCubicIntersection.cpp
+++ b/src/pathops/SkDCubicIntersection.cpp
@@ -141,12 +141,12 @@
#if 1
double c1Bottom = tIdx == 0 ? 0 :
(t1Start + (t1 - t1Start) * locals[0][tIdx - 1] + to1) / 2;
- double c1Min = SkTMax<double>(c1Bottom, to1 - offset);
+ double c1Min = SkTMax(c1Bottom, to1 - offset);
double c1Top = tIdx == tCount - 1 ? 1 :
(t1Start + (t1 - t1Start) * locals[0][tIdx + 1] + to1) / 2;
- double c1Max = SkTMin<double>(c1Top, to1 + offset);
- double c2Min = SkTMax<double>(0., to2 - offset);
- double c2Max = SkTMin<double>(1., to2 + offset);
+ double c1Max = SkTMin(c1Top, to1 + offset);
+ double c2Min = SkTMax(0., to2 - offset);
+ double c2Max = SkTMin(1., to2 + offset);
#if ONE_OFF_DEBUG
SkDebugf("%.*s %s 1 contains1=%d/%d contains2=%d/%d\n", i.depth()*2, tab,
__FUNCTION__,
@@ -172,8 +172,8 @@
i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1);
#endif
if (tCount > 1) {
- c1Min = SkTMax<double>(0., to1 - offset);
- c1Max = SkTMin<double>(1., to1 + offset);
+ c1Min = SkTMax(0., to1 - offset);
+ c1Max = SkTMin(1., to1 + offset);
double c2Bottom = tIdx == 0 ? to2 :
(t2Start + (t2 - t2Start) * locals[1][tIdx - 1] + to2) / 2;
double c2Top = tIdx == tCount - 1 ? to2 :
@@ -187,8 +187,8 @@
if (c2Top == to2) {
c2Top = 1;
}
- c2Min = SkTMax<double>(c2Bottom, to2 - offset);
- c2Max = SkTMin<double>(c2Top, to2 + offset);
+ c2Min = SkTMax(c2Bottom, to2 - offset);
+ c2Max = SkTMin(c2Top, to2 + offset);
#if ONE_OFF_DEBUG
SkDebugf("%.*s %s 2 contains1=%d/%d contains2=%d/%d\n", i.depth()*2, tab,
__FUNCTION__,
@@ -213,8 +213,8 @@
SkDebugf("%.*s %s 2 i.used=%d t=%1.9g\n", i.depth()*2, tab, __FUNCTION__,
i.used(), i.used() > 0 ? i[0][i.used() - 1] : -1);
#endif
- c1Min = SkTMax<double>(c1Bottom, to1 - offset);
- c1Max = SkTMin<double>(c1Top, to1 + offset);
+ c1Min = SkTMax(c1Bottom, to1 - offset);
+ c1Max = SkTMin(c1Top, to1 + offset);
#if ONE_OFF_DEBUG
SkDebugf("%.*s %s 3 contains1=%d/%d contains2=%d/%d\n", i.depth()*2, tab,
__FUNCTION__,
@@ -243,10 +243,10 @@
#else
double c1Bottom = tIdx == 0 ? 0 :
(t1Start + (t1 - t1Start) * locals.fT[0][tIdx - 1] + to1) / 2;
- double c1Min = SkTMax<double>(c1Bottom, to1 - offset);
+ double c1Min = SkTMax(c1Bottom, to1 - offset);
double c1Top = tIdx == tCount - 1 ? 1 :
(t1Start + (t1 - t1Start) * locals.fT[0][tIdx + 1] + to1) / 2;
- double c1Max = SkTMin<double>(c1Top, to1 + offset);
+ double c1Max = SkTMin(c1Top, to1 + offset);
double c2Bottom = tIdx == 0 ? to2 :
(t2Start + (t2 - t2Start) * locals.fT[1][tIdx - 1] + to2) / 2;
double c2Top = tIdx == tCount - 1 ? to2 :
@@ -260,8 +260,8 @@
if (c2Top == to2) {
c2Top = 1;
}
- double c2Min = SkTMax<double>(c2Bottom, to2 - offset);
- double c2Max = SkTMin<double>(c2Top, to2 + offset);
+ double c2Min = SkTMax(c2Bottom, to2 - offset);
+ double c2Max = SkTMin(c2Top, to2 + offset);
#if ONE_OFF_DEBUG
SkDebugf("%s contains1=%d/%d contains2=%d/%d\n", __FUNCTION__,
c1Min <= 0.210357794 && 0.210357794 <= c1Max
@@ -351,13 +351,13 @@
while (tLast + 1 < tVals.count() && roughly_equal(tVals[tLast + 1], tVals[tIdx])) {
++tLast;
}
- double tMin2 = SkTMax<double>(tVals[tIdx] - LINE_FRACTION, 0.0);
- double tMax2 = SkTMin<double>(tVals[tLast] + LINE_FRACTION, 1.0);
+ double tMin2 = SkTMax(tVals[tIdx] - LINE_FRACTION, 0.0);
+ double tMax2 = SkTMin(tVals[tLast] + LINE_FRACTION, 1.0);
int lastUsed = i.used();
intersect(cubic1, tMin1, tMax1, cubic2, tMin2, tMax2, 1, i);
if (lastUsed == i.used()) {
- tMin2 = SkTMax<double>(tVals[tIdx] - (1.0 / SkDCubic::gPrecisionUnit), 0.0);
- tMax2 = SkTMin<double>(tVals[tLast] + (1.0 / SkDCubic::gPrecisionUnit), 1.0);
+ tMin2 = SkTMax(tVals[tIdx] - (1.0 / SkDCubic::gPrecisionUnit), 0.0);
+ tMax2 = SkTMin(tVals[tLast] + (1.0 / SkDCubic::gPrecisionUnit), 1.0);
intersect(cubic1, tMin1, tMax1, cubic2, tMin2, tMax2, 1, i);
}
tIdx = tLast + 1;