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

Unified Diff: src/pathops/SkPathOpsDebug.cpp

Issue 2426173002: fix fuzzers (Closed)
Patch Set: fix dm Created 4 years, 2 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 | « src/pathops/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsQuad.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pathops/SkPathOpsDebug.cpp
diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp
index a0fcff58e01e31e0d3f8f4c7eb200e0f9dbde27c..476fafb4258ba2279c8efd72a208bd85cd6b414d 100644
--- a/src/pathops/SkPathOpsDebug.cpp
+++ b/src/pathops/SkPathOpsDebug.cpp
@@ -691,8 +691,8 @@ void SkIntersections::debugResetLoopCount() {
}
#endif
+#include "SkPathOpsConic.h"
#include "SkPathOpsCubic.h"
-#include "SkPathOpsQuad.h"
SkDCubic SkDQuad::debugToCubic() const {
SkDCubic cubic;
@@ -706,6 +706,21 @@ SkDCubic SkDQuad::debugToCubic() const {
return cubic;
}
+void SkDQuad::debugSet(const SkDPoint* pts) {
+ memcpy(fPts, pts, sizeof(fPts));
+ SkDEBUGCODE(fDebugGlobalState = nullptr);
+}
+
+void SkDCubic::debugSet(const SkDPoint* pts) {
+ memcpy(fPts, pts, sizeof(fPts));
+ SkDEBUGCODE(fDebugGlobalState = nullptr);
+}
+
+void SkDConic::debugSet(const SkDPoint* pts, SkScalar weight) {
+ fPts.debugSet(pts);
+ fWeight = weight;
+}
+
void SkDRect::debugInit() {
fLeft = fTop = fRight = fBottom = SK_ScalarNaN;
}
@@ -1595,6 +1610,7 @@ void SkOpCoincidence::debugAddEndMovedSpans(SkPathOpsDebug::GlitchLog* log) cons
// for each coincident pair, match the spans
// if the spans don't match, add the mssing pt to the segment and loop it in the opposite span
void SkOpCoincidence::debugAddExpanded(SkPathOpsDebug::GlitchLog* log) const {
+// DEBUG_SET_PHASE();
const SkCoincidentSpans* coin = this->fHead;
if (!coin) {
return;
@@ -1639,14 +1655,15 @@ void SkOpCoincidence::debugAddExpanded(SkPathOpsDebug::GlitchLog* log) const {
walk = walk->upCast()->next();
} while (!(walkOpp = walk->ptT()->contains(oSeg))
&& walk != coin->coinPtTEnd()->span());
+ FAIL_IF(!walkOpp, coin);
nextT = walk->t();
oNextT = walkOpp->fT;
}
// use t ranges to guess which one is missing
- double startRange = coin->coinPtTEnd()->fT - startPtT->fT;
+ double startRange = nextT - priorT;
FAIL_IF(!startRange, coin);
- double startPart = (test->t() - startPtT->fT) / startRange;
- double oStartRange = coin->oppPtTEnd()->fT - oStartPtT->fT;
+ double startPart = (test->t() - priorT) / startRange;
+ double oStartRange = oNextT - oPriorT;
FAIL_IF(!oStartRange, coin);
double oStartPart = (oTest->t() - oStartPtT->fT) / oStartRange;
FAIL_IF(startPart == oStartPart, coin);
@@ -2029,7 +2046,8 @@ void SkOpCoincidence::debugMark(SkPathOpsDebug::GlitchLog* log) const {
const SkOpSegment* oSegment = oStart->segment();
const SkOpSpanBase* next = start;
const SkOpSpanBase* oNext = oStart;
- bool ordered = coin->ordered();
+ bool ordered;
+ FAIL_IF(!coin->ordered(&ordered), coin);
while ((next = next->upCast()->next()) != end) {
FAIL_IF(!next->upCastable(), coin);
if (next->upCast()->debugInsertCoincidence(log, oSegment, flipped, ordered), false) {
« no previous file with comments | « src/pathops/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsQuad.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698