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

Unified Diff: tests/PathOpsTSectDebug.h

Issue 1029993002: Revert of pathops version two (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « tests/PathOpsSkpTest.cpp ('k') | tests/PathOpsTestCommon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsTSectDebug.h
diff --git a/tests/PathOpsTSectDebug.h b/tests/PathOpsTSectDebug.h
index b4715e63e07f07087f6988877d5956e22c2e2eff..5f8915f68123778a857c7abea9e99286ab10f33d 100644
--- a/tests/PathOpsTSectDebug.h
+++ b/tests/PathOpsTSectDebug.h
@@ -8,158 +8,77 @@
#include "SkPathOpsTSect.h"
template<typename TCurve>
-const SkTSpan<TCurve>* SkTSect<TCurve>::debugSpan(int id) const {
+void SkTSect<TCurve>::dump() const {
+ SkDebugf("id=%d", debugID());
const SkTSpan<TCurve>* test = fHead;
- do {
- if (test->debugID() == id) {
- return test;
- }
- } while ((test = test->next()));
-#ifndef SK_RELEASE
- test = fOppSect->fHead;
- do {
- if (test->debugID() == id) {
- return test;
- }
- } while ((test = test->next()));
-#endif
- return NULL;
-}
-
-template<typename TCurve>
-const SkTSpan<TCurve>* SkTSect<TCurve>::debugT(double t) const {
- const SkTSpan<TCurve>* test = fHead;
- const SkTSpan<TCurve>* closest = NULL;
- double bestDist = DBL_MAX;
- do {
- if (between(test->fStartT, t, test->fEndT)) {
- return test;
- }
- double testDist = SkTMin(fabs(test->fStartT - t), fabs(test->fEndT - t));
- if (bestDist > testDist) {
- bestDist = testDist;
- closest = test;
- }
- } while ((test = test->next()));
- SkASSERT(closest);
- return closest;
-}
-
-template<typename TCurve>
-void SkTSect<TCurve>::dump() const {
- dumpCommon(fHead);
-}
-
-extern int gDumpTSectNum;
-
-template<typename TCurve>
-void SkTSect<TCurve>::dumpBoth(SkTSect* opp) const {
-#if DEBUG_T_SECT_DUMP <= 2
-#if DEBUG_T_SECT_DUMP == 2
- SkDebugf("%d ", ++gDumpTSectNum);
-#endif
- this->dump();
- SkDebugf(" ");
- opp->dump();
- SkDebugf("\n");
-#elif DEBUG_T_SECT_DUMP == 3
- SkDebugf("<div id=\"sect%d\">\n", ++gDumpTSectNum);
- if (this->fHead) {
- this->dumpCurves();
- }
- if (opp->fHead) {
- PATH_OPS_DEBUG_CODE(opp->dumpCurves());
- }
- SkDebugf("</div>\n\n");
-#endif
-}
-
-template<typename TCurve>
-void SkTSect<TCurve>::dumpBounds(int id) const {
- const SkTSpan<TCurve>* bounded = debugSpan(id);
- if (!bounded) {
- SkDebugf("no span matches %d\n", id);
- return;
- }
- const SkTSpan<TCurve>* test = bounded->debugOpp()->fHead;
- do {
- if (test->findOppSpan(bounded)) {
- test->dump();
- }
- } while ((test = test->next()));
-}
-
-template<typename TCurve>
-void SkTSect<TCurve>::dumpCoin() const {
- dumpCommon(fCoincident);
-}
-
-template<typename TCurve>
-void SkTSect<TCurve>::dumpCoinCurves() const {
- dumpCommonCurves(fCoincident);
-}
-
-template<typename TCurve>
-void SkTSect<TCurve>::dumpCommon(const SkTSpan<TCurve>* test) const {
- SkDebugf("id=%d", debugID());
if (!test) {
SkDebugf(" (empty)");
return;
}
do {
SkDebugf(" ");
- test->dump();
+ test->dump(this);
} while ((test = test->next()));
}
template<typename TCurve>
-void SkTSect<TCurve>::dumpCommonCurves(const SkTSpan<TCurve>* test) const {
- do {
- test->fPart.dumpID(test->debugID());
- } while ((test = test->next()));
+void SkTSect<TCurve>::dumpBoth(const SkTSect& opp) const {
+ dump();
+ SkDebugf(" ");
+ opp.dump();
+ SkDebugf("\n");
+}
+
+template<typename TCurve>
+void SkTSect<TCurve>::dumpBoth(const SkTSect* opp) const {
+ dumpBoth(*opp);
}
template<typename TCurve>
void SkTSect<TCurve>::dumpCurves() const {
- dumpCommonCurves(fHead);
+ const SkTSpan<TCurve>* test = fHead;
+ do {
+ test->fPart.dump();
+ } while ((test = test->next()));
+}
+
+#if !DEBUG_T_SECT
+template<typename TCurve>
+int SkTSpan<TCurve>::debugID(const SkTSect<TCurve>* sect) const {
+ if (!sect) {
+ return -1;
+ }
+ int id = 1;
+ const SkTSpan* test = sect->fHead;
+ while (test && test != this) {
+ ++id;
+ test = test->fNext;
+ }
+ return id;
+}
+#endif
+
+template<typename TCurve>
+void SkTSpan<TCurve>::dumpID(const SkTSect<TCurve>* sect) const {
+ if (fCoinStart.isCoincident()) {
+ SkDebugf("%c", '*');
+ }
+ SkDebugf("%d", debugID(sect));
+ if (fCoinEnd.isCoincident()) {
+ SkDebugf("%c", '*');
+ }
}
template<typename TCurve>
-const SkTSpan<TCurve>* SkTSpan<TCurve>::debugSpan(int id) const {
- return PATH_OPS_DEBUG_RELEASE(fDebugSect->debugSpan(id), NULL);
-}
-
-template<typename TCurve>
-const SkTSpan<TCurve>* SkTSpan<TCurve>::debugT(double t) const {
- return PATH_OPS_DEBUG_RELEASE(fDebugSect->debugT(t), NULL);
-}
-
-template<typename TCurve>
-void SkTSpan<TCurve>::dump() const {
- dumpID();
+void SkTSpan<TCurve>::dump(const SkTSect<TCurve>* sect) const {
+ dumpID(sect);
SkDebugf("=(%g,%g) [", fStartT, fEndT);
for (int index = 0; index < fBounded.count(); ++index) {
SkTSpan* span = fBounded[index];
- span->dumpID();
+ span->dumpID(sect);
if (index < fBounded.count() - 1) {
SkDebugf(",");
}
}
SkDebugf("]");
}
-
-template<typename TCurve>
-void SkTSpan<TCurve>::dumpBounds(int id) const {
- PATH_OPS_DEBUG_CODE(fDebugSect->dumpBounds(id));
-}
-
-template<typename TCurve>
-void SkTSpan<TCurve>::dumpID() const {
- if (fCoinStart.isCoincident()) {
- SkDebugf("%c", '*');
- }
- SkDebugf("%d", debugID());
- if (fCoinEnd.isCoincident()) {
- SkDebugf("%c", '*');
- }
-}
« no previous file with comments | « tests/PathOpsSkpTest.cpp ('k') | tests/PathOpsTestCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698