diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-15 19:13:59 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-15 19:13:59 +0000 |
commit | ad65a3e5fb1f94699f183551b828efbcc6a133ce (patch) | |
tree | 5908b619b257c5bfc45ddb40be1b9099c37d67ee /src/pathops | |
parent | 9becf0090f9c1c14f42d161b9a1fb3af142f9420 (diff) |
path ops work in progress
standardize tests
use SK_ARRAY_COUNT everywhere
debug why x87 differs from SIMD 64
various platform specific fixes
git-svn-id: http://skia.googlecode.com/svn/trunk@8689 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/pathops')
-rw-r--r-- | src/pathops/SkDCubicIntersection.cpp | 2 | ||||
-rw-r--r-- | src/pathops/SkDQuadIntersection.cpp | 5 | ||||
-rw-r--r-- | src/pathops/SkOpAngle.h | 3 | ||||
-rw-r--r-- | src/pathops/SkOpSegment.cpp | 4 | ||||
-rw-r--r-- | src/pathops/SkOpSegment.h | 5 | ||||
-rw-r--r-- | src/pathops/SkPathOpsDebug.h | 2 | ||||
-rw-r--r-- | src/pathops/SkPathOpsPoint.h | 2 |
7 files changed, 16 insertions, 7 deletions
diff --git a/src/pathops/SkDCubicIntersection.cpp b/src/pathops/SkDCubicIntersection.cpp index a31b1a4c52..f9d8cd5535 100644 --- a/src/pathops/SkDCubicIntersection.cpp +++ b/src/pathops/SkDCubicIntersection.cpp @@ -101,8 +101,6 @@ static void intersect(const SkDCubic& cubic1, double t1s, double t1e, const SkDC char tab[] = " "; if (tLimits1[0][0] >= t1Start && tLimits1[0][1] <= t1 && tLimits1[1][0] >= t2Start && tLimits1[1][1] <= t2) { - SkDCubic cSub1 = cubic1.subDivide(t1Start, t1); - SkDCubic cSub2 = cubic2.subDivide(t2Start, t2); SkDebugf("%.*s %s t1=(%1.9g,%1.9g) t2=(%1.9g,%1.9g)", i.depth()*2, tab, __FUNCTION__, t1Start, t1, t2Start, t2); SkIntersections xlocals; diff --git a/src/pathops/SkDQuadIntersection.cpp b/src/pathops/SkDQuadIntersection.cpp index d8e3f20a28..db4e2facff 100644 --- a/src/pathops/SkDQuadIntersection.cpp +++ b/src/pathops/SkDQuadIntersection.cpp @@ -96,6 +96,9 @@ static bool only_end_pts_in_common(const SkDQuad& q1, const SkDQuad& q2, SkInter } for (int n = 0; n < 3; ++n) { double test = (q2[n].fY - origY) * adj - (q2[n].fX - origX) * opp; + if (test * sign > 0 && precisely_zero(test)) { + SkDebugf("*** very teeny\n"); + } if (test * sign > 0) { goto tryNextHalfPlane; } @@ -151,7 +154,7 @@ static bool is_linear_inner(const SkDQuad& q1, double t1s, double t1e, const SkD SkDQuad hull = q1.subDivide(t1s, t1e); SkDLine line = {{hull[2], hull[0]}}; const SkDLine* testLines[] = { &line, (const SkDLine*) &hull[0], (const SkDLine*) &hull[1] }; - size_t testCount = sizeof(testLines) / sizeof(testLines[0]); + size_t testCount = SK_ARRAY_COUNT(testLines); SkTDArray<double> tsFound; for (size_t index = 0; index < testCount; ++index) { SkIntersections rootTs; diff --git a/src/pathops/SkOpAngle.h b/src/pathops/SkOpAngle.h index d599dea7c2..00520ecf43 100644 --- a/src/pathops/SkOpAngle.h +++ b/src/pathops/SkOpAngle.h @@ -18,6 +18,7 @@ class SkOpAngle { public: bool operator<(const SkOpAngle& rh) const; + double dx() const { return fTangent1.dx(); } @@ -36,10 +37,12 @@ public: bool lengthen(); bool reverseLengthen(); + void set(const SkPoint* orig, SkPath::Verb verb, const SkOpSegment* segment, int start, int end, const SkTDArray<SkOpSpan>& spans); void setSpans(); + SkOpSegment* segment() const { return const_cast<SkOpSegment*>(fSegment); } diff --git a/src/pathops/SkOpSegment.cpp b/src/pathops/SkOpSegment.cpp index 79ecc662da..30e78f5a0e 100644 --- a/src/pathops/SkOpSegment.cpp +++ b/src/pathops/SkOpSegment.cpp @@ -2663,7 +2663,7 @@ void SkOpSegment::debugShowSort(const char* fun, const SkTDArray<SkOpAngle*>& an int oppoSign = oppSign(firstAngle); int oppWindSum = oppLastSum - oppoSign; #define WIND_AS_STRING(x) char x##Str[12]; if (!valid_wind(x)) strcpy(x##Str, "?"); \ - else snprintf(x##Str, sizeof(x##Str), "%d", x) + else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x) WIND_AS_STRING(contourWinding); WIND_AS_STRING(oppContourWinding); SkDebugf("%s %s contourWinding=%s oppContourWinding=%s sign=%d\n", fun, __FUNCTION__, @@ -2747,7 +2747,7 @@ void SkOpSegment::debugShowSort(const char* fun, const SkTDArray<SkOpAngle*>& an opp ? windSumStr : oppWindSumStr); } SkDebugf(" done=%d tiny=%d opp=%d\n", mSpan.fDone, mSpan.fTiny, opp); -#if false && DEBUG_ANGLE +#if 0 && DEBUG_ANGLE angle.debugShow(segment.xyAtT(&sSpan)); #endif ++index; diff --git a/src/pathops/SkOpSegment.h b/src/pathops/SkOpSegment.h index dd51ab89e6..f4f2aa56f2 100644 --- a/src/pathops/SkOpSegment.h +++ b/src/pathops/SkOpSegment.h @@ -151,6 +151,11 @@ public: return fTs[tIndex]; } + // OPTIMIZATION: mark as debugging only if used solely by tests + const SkTDArray<SkOpSpan>& spans() const { + return fTs; + } + int spanSign(const SkOpAngle* angle) const { SkASSERT(angle->segment() == this); return spanSign(angle->start(), angle->end()); diff --git a/src/pathops/SkPathOpsDebug.h b/src/pathops/SkPathOpsDebug.h index a642af4c01..065ba4b782 100644 --- a/src/pathops/SkPathOpsDebug.h +++ b/src/pathops/SkPathOpsDebug.h @@ -12,7 +12,7 @@ #ifdef SK_RELEASE #define FORCE_RELEASE 1 #else -#define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging +#define FORCE_RELEASE 0 // set force release to 1 for multiple thread -- no debugging #endif #define ONE_OFF_DEBUG 0 diff --git a/src/pathops/SkPathOpsPoint.h b/src/pathops/SkPathOpsPoint.h index 38051005ea..713b457418 100644 --- a/src/pathops/SkPathOpsPoint.h +++ b/src/pathops/SkPathOpsPoint.h @@ -108,7 +108,7 @@ struct SkDPoint { bool approximatelyEqual(const SkPoint& a) const { double denom = SkTMax<double>(fabs(fX), SkTMax<double>(fabs(fY), - SkScalarToDouble(SkTMax<SkScalar>(fabs(a.fX), fabs(a.fY))))); + SkScalarToDouble(SkTMax<SkScalar>(fabsf(a.fX), fabsf(a.fY))))); if (denom == 0) { return true; } |