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

Unified Diff: src/pathops/SkDCubicIntersection.cpp

Issue 13934009: path ops -- use standard max, min, double-is-nan (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | « include/core/SkTypes.h ('k') | src/pathops/SkDLineIntersection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkDCubicIntersection.cpp
===================================================================
--- src/pathops/SkDCubicIntersection.cpp (revision 8808)
+++ src/pathops/SkDCubicIntersection.cpp (working copy)
@@ -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;
« no previous file with comments | « include/core/SkTypes.h ('k') | src/pathops/SkDLineIntersection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698