Revert of Rename SK_DEBUGBREAK to SK_ALWAYSBREAK (https://codereview.chromium.org/263553012/)

Reason for revert:
Broke windows bot

Original issue's description:
> Rename SK_DEBUGBREAK to SK_ALWAYSBREAK
>
> Committed: http://code.google.com/p/skia/source/detail?r=14473

R=caryclark@google.com, reed@google.com
TBR=caryclark@google.com, reed@google.com
NOTREECHECKS=true
NOTRY=true

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/260763003

git-svn-id: http://skia.googlecode.com/svn/trunk@14476 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2014-04-30 16:27:21 +00:00
parent 2d0c75c534
commit 62cf26f374
4 changed files with 68 additions and 68 deletions

View File

@ -154,8 +154,8 @@
# undef NOMINMAX
# endif
#
# ifndef SK_ALWAYSBREAK
# define SK_ALWAYSBREAK(p) do { if (!(p)) { SkNO_RETURN_HINT(); __debugbreak(); }} while (false)
# ifndef SK_DEBUGBREAK
# define SK_DEBUGBREAK(p) do { if (!(p)) { SkNO_RETURN_HINT(); __debugbreak(); }} while (false)
# endif
#
# ifndef SK_A32_SHIFT
@ -166,14 +166,14 @@
# endif
#
#else
# ifndef SK_ALWAYSBREAK
# ifndef SK_DEBUGBREAK
# ifdef SK_DEBUG
# include <stdio.h>
# define SK_ALWAYSBREAK(cond) do { if (cond) break; \
# define SK_DEBUGBREAK(cond) do { if (cond) break; \
SkDebugf("%s:%d: failed assertion \"%s\"\n", \
__FILE__, __LINE__, #cond); SK_CRASH(); } while (false)
# else
# define SK_ALWAYSBREAK(cond) do { if (cond) break; SK_CRASH(); } while (false)
# define SK_DEBUGBREAK(cond) do { if (cond) break; SK_CRASH(); } while (false)
# endif
# endif
#endif

View File

@ -93,7 +93,7 @@ inline void operator delete(void* p) {
#endif
#ifdef SK_DEBUG
#define SkASSERT(cond) SK_ALWAYSBREAK(cond)
#define SkASSERT(cond) SK_DEBUGBREAK(cond)
#define SkDEBUGFAIL(message) SkASSERT(false && message)
#define SkDEBUGCODE(code) code
#define SkDECLAREPARAM(type, var) , type var
@ -113,7 +113,7 @@ inline void operator delete(void* p) {
#define SkAssertResult(cond) cond
#endif
#define SkFAIL(message) SK_ALWAYSBREAK(false && message)
#define SkFAIL(message) SK_DEBUGBREAK(false && message)
#ifdef SK_DEVELOPER
#define SkDEVCODE(code) code

View File

@ -2253,7 +2253,7 @@ static void text_draw_init(const SkPaint& paint,
numGlyphGuess = byteLength / 2;
break;
default:
SK_ALWAYSASSERT(true);
SK_DEBUGBREAK(true);
}
procs.xpsGlyphs.setReserve(numGlyphGuess);
procs.glyphUse = &glyphsUsed;

View File

@ -171,15 +171,15 @@ void SkOpAngle::debugOne(bool functionHeader) const {
#if DEBUG_ANGLE
void SkOpAngle::debugSameAs(const SkOpAngle* compare) const {
SK_ALWAYSBREAK(fSegment == compare->fSegment);
SK_DEBUGBREAK(fSegment == compare->fSegment);
const SkOpSpan& startSpan = fSegment->span(fStart);
const SkOpSpan& oStartSpan = fSegment->span(compare->fStart);
SK_ALWAYSBREAK(startSpan.fToAngleIndex == oStartSpan.fToAngleIndex);
SK_ALWAYSBREAK(startSpan.fFromAngleIndex == oStartSpan.fFromAngleIndex);
SK_DEBUGBREAK(startSpan.fToAngleIndex == oStartSpan.fToAngleIndex);
SK_DEBUGBREAK(startSpan.fFromAngleIndex == oStartSpan.fFromAngleIndex);
const SkOpSpan& endSpan = fSegment->span(fEnd);
const SkOpSpan& oEndSpan = fSegment->span(compare->fEnd);
SK_ALWAYSBREAK(endSpan.fToAngleIndex == oEndSpan.fToAngleIndex);
SK_ALWAYSBREAK(endSpan.fFromAngleIndex == oEndSpan.fFromAngleIndex);
SK_DEBUGBREAK(endSpan.fToAngleIndex == oEndSpan.fToAngleIndex);
SK_DEBUGBREAK(endSpan.fFromAngleIndex == oEndSpan.fFromAngleIndex);
}
#endif
@ -189,13 +189,13 @@ void SkOpAngle::debugValidateNext() const {
const SkOpAngle* next = first;
SkTDArray<const SkOpAngle*>(angles);
do {
SK_ALWAYSBREAK(next->fSegment->debugContains(next));
SK_DEBUGBREAK(next->fSegment->debugContains(next));
angles.push(next);
next = next->next();
if (next == first) {
break;
}
SK_ALWAYSBREAK(!angles.contains(next));
SK_DEBUGBREAK(!angles.contains(next));
if (!next) {
return;
}
@ -205,7 +205,7 @@ void SkOpAngle::debugValidateNext() const {
void SkOpAngle::debugValidateLoop() const {
const SkOpAngle* first = this;
const SkOpAngle* next = first;
SK_ALWAYSBREAK(first->next() != first);
SK_DEBUGBREAK(first->next() != first);
int signSum = 0;
int oppSum = 0;
bool firstOperand = fSegment->operand();
@ -218,12 +218,12 @@ void SkOpAngle::debugValidateLoop() const {
oppSum += operandsMatch ? segment->oppSign(next) : segment->spanSign(next);
const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd));
if (segment->_xor()) {
// SK_ALWAYSBREAK(span.fWindValue == 1);
// SK_ALWAYSBREAK(span.fWindSum == SK_MinS32 || span.fWindSum == 1);
// SK_DEBUGBREAK(span.fWindValue == 1);
// SK_DEBUGBREAK(span.fWindSum == SK_MinS32 || span.fWindSum == 1);
}
if (segment->oppXor()) {
SK_ALWAYSBREAK(span.fOppValue == 0 || abs(span.fOppValue) == 1);
// SK_ALWAYSBREAK(span.fOppSum == SK_MinS32 || span.fOppSum == 0 || abs(span.fOppSum) == 1);
SK_DEBUGBREAK(span.fOppValue == 0 || abs(span.fOppValue) == 1);
// SK_DEBUGBREAK(span.fOppSum == SK_MinS32 || span.fOppSum == 0 || abs(span.fOppSum) == 1);
}
next = next->next();
if (!next) {
@ -233,8 +233,8 @@ void SkOpAngle::debugValidateLoop() const {
if (unorderable) {
return;
}
SK_ALWAYSBREAK(!signSum || fSegment->_xor());
SK_ALWAYSBREAK(!oppSum || fSegment->oppXor());
SK_DEBUGBREAK(!signSum || fSegment->_xor());
SK_DEBUGBREAK(!oppSum || fSegment->oppXor());
int lastWinding;
int lastOppWinding;
int winding;
@ -244,16 +244,16 @@ void SkOpAngle::debugValidateLoop() const {
const SkOpSpan& span = segment->span(SkMin32(next->fStart, next->fEnd));
winding = span.fWindSum;
if (winding != SK_MinS32) {
// SK_ALWAYSBREAK(winding != 0);
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
// SK_DEBUGBREAK(winding != 0);
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding));
lastWinding = winding;
int diffWinding = segment->spanSign(next);
if (!segment->_xor()) {
SK_ALWAYSBREAK(diffWinding != 0);
SK_DEBUGBREAK(diffWinding != 0);
bool sameSign = (winding > 0) == (diffWinding > 0);
winding -= sameSign ? diffWinding : -diffWinding;
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
SK_ALWAYSBREAK(abs(winding) <= abs(lastWinding));
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding));
SK_DEBUGBREAK(abs(winding) <= abs(lastWinding));
if (!sameSign) {
SkTSwap(winding, lastWinding);
}
@ -261,12 +261,12 @@ void SkOpAngle::debugValidateLoop() const {
lastOppWinding = oppWinding = span.fOppSum;
if (oppWinding != SK_MinS32 && !segment->oppXor()) {
int oppDiffWinding = segment->oppSign(next);
// SK_ALWAYSBREAK(abs(oppDiffWinding) <= abs(diffWinding) || segment->_xor());
// SK_DEBUGBREAK(abs(oppDiffWinding) <= abs(diffWinding) || segment->_xor());
if (oppDiffWinding) {
bool oppSameSign = (oppWinding > 0) == (oppDiffWinding > 0);
oppWinding -= oppSameSign ? oppDiffWinding : -oppDiffWinding;
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(oppWinding));
SK_ALWAYSBREAK(abs(oppWinding) <= abs(lastOppWinding));
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(oppWinding));
SK_DEBUGBREAK(abs(oppWinding) <= abs(lastOppWinding));
if (!oppSameSign) {
SkTSwap(oppWinding, lastOppWinding);
}
@ -275,13 +275,13 @@ void SkOpAngle::debugValidateLoop() const {
firstOperand = segment->operand();
break;
}
SK_ALWAYSBREAK(span.fOppSum == SK_MinS32);
SK_DEBUGBREAK(span.fOppSum == SK_MinS32);
next = next->next();
} while (next != first);
if (winding == SK_MinS32) {
return;
}
SK_ALWAYSBREAK(oppWinding == SK_MinS32 || SkPathOpsDebug::ValidWind(oppWinding));
SK_DEBUGBREAK(oppWinding == SK_MinS32 || SkPathOpsDebug::ValidWind(oppWinding));
first = next;
next = next->next();
do {
@ -292,27 +292,27 @@ void SkOpAngle::debugValidateLoop() const {
if (operandsMatch) {
if (!segment->_xor()) {
winding -= segment->spanSign(next);
SK_ALWAYSBREAK(winding != lastWinding);
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
SK_DEBUGBREAK(winding != lastWinding);
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding));
}
if (!segment->oppXor()) {
int oppDiffWinding = segment->oppSign(next);
if (oppWinding != SK_MinS32) {
oppWinding -= oppDiffWinding;
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(oppWinding));
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(oppWinding));
} else {
SK_ALWAYSBREAK(oppDiffWinding == 0);
SK_DEBUGBREAK(oppDiffWinding == 0);
}
}
} else {
if (!segment->oppXor()) {
winding -= segment->oppSign(next);
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(winding));
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(winding));
}
if (!segment->_xor()) {
oppWinding -= segment->spanSign(next);
SK_ALWAYSBREAK(oppWinding != lastOppWinding);
SK_ALWAYSBREAK(SkPathOpsDebug::ValidWind(oppWinding));
SK_DEBUGBREAK(oppWinding != lastOppWinding);
SK_DEBUGBREAK(SkPathOpsDebug::ValidWind(oppWinding));
}
}
bool useInner = SkOpSegment::UseInnerWinding(lastWinding, winding);
@ -333,12 +333,12 @@ void SkOpAngle::debugValidateLoop() const {
}
if (oppWinding != SK_MinS32) {
if (span.fOppSum != SK_MinS32) {
SK_ALWAYSBREAK(span.fOppSum == oppSumWinding || segment->oppXor() || segment->_xor());
SK_DEBUGBREAK(span.fOppSum == oppSumWinding || segment->oppXor() || segment->_xor());
}
} else {
SK_ALWAYSBREAK(!firstOperand);
SK_ALWAYSBREAK(!segment->operand());
SK_ALWAYSBREAK(!span.fOppValue);
SK_DEBUGBREAK(!firstOperand);
SK_DEBUGBREAK(!segment->operand());
SK_DEBUGBREAK(!span.fOppValue);
}
next = next->next();
} while (next != first);
@ -356,14 +356,14 @@ bool SkOpSegment::controlsContainedByEnds(int tStart, int tEnd) const {
#endif
#if DEBUG_CONCIDENT
// SK_ALWAYSBREAK if pair has not already been added
// SK_DEBUGBREAK if pair has not already been added
void SkOpSegment::debugAddTPair(double t, const SkOpSegment& other, double otherT) const {
for (int i = 0; i < fTs.count(); ++i) {
if (fTs[i].fT == t && fTs[i].fOther == &other && fTs[i].fOtherT == otherT) {
return;
}
}
SK_ALWAYSBREAK(0);
SK_DEBUGBREAK(0);
}
#endif
@ -372,7 +372,7 @@ void SkOpSegment::debugCheckPointsEqualish(int tStart, int tEnd) const {
const SkPoint& basePt = fTs[tStart].fPt;
while (++tStart < tEnd) {
const SkPoint& cmpPt = fTs[tStart].fPt;
SK_ALWAYSBREAK(SkDPoint::ApproximatelyEqual(basePt, cmpPt));
SK_DEBUGBREAK(SkDPoint::ApproximatelyEqual(basePt, cmpPt));
}
}
#endif
@ -461,7 +461,7 @@ void SkOpSegment::debugShowActiveSpans() const {
if (fTs[i].fDone) {
continue;
}
SK_ALWAYSBREAK(i < fTs.count() - 1);
SK_DEBUGBREAK(i < fTs.count() - 1);
#if DEBUG_ACTIVE_SPANS_SHORT_FORM
if (lastId == fID && lastT == fTs[i].fT) {
continue;
@ -502,7 +502,7 @@ void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan& span, int
for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
}
SK_ALWAYSBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther->
SK_DEBUGBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther->
fTs[span.fOther->fTs[span.fOtherIndex].fOtherIndex]);
SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=%d windSum=",
span.fT, span.fOther->fTs[span.fOtherIndex].fOtherIndex, pt.fX, pt.fY,
@ -523,7 +523,7 @@ void SkOpSegment::debugShowNewWinding(const char* fun, const SkOpSpan& span, int
for (int vIndex = 1; vIndex <= SkPathOpsVerbToPoints(fVerb); ++vIndex) {
SkDebugf(" %1.9g,%1.9g", fPts[vIndex].fX, fPts[vIndex].fY);
}
SK_ALWAYSBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther->
SK_DEBUGBREAK(&span == &span.fOther->fTs[span.fOtherIndex].fOther->
fTs[span.fOther->fTs[span.fOtherIndex].fOtherIndex]);
SkDebugf(") t=%1.9g [%d] (%1.9g,%1.9g) tEnd=%1.9g newWindSum=%d newOppSum=%d oppSum=",
span.fT, span.fOther->fTs[span.fOtherIndex].fOtherIndex, pt.fX, pt.fY,
@ -569,9 +569,9 @@ int SkOpSegment::debugShowWindingValues(int slotCount, int ofInterest) const {
void SkOpSegment::debugValidate() const {
#if DEBUG_VALIDATE
int count = fTs.count();
SK_ALWAYSBREAK(count >= 2);
SK_ALWAYSBREAK(fTs[0].fT == 0);
SK_ALWAYSBREAK(fTs[count - 1].fT == 1);
SK_DEBUGBREAK(count >= 2);
SK_DEBUGBREAK(fTs[0].fT == 0);
SK_DEBUGBREAK(fTs[count - 1].fT == 1);
int done = 0;
double t = -1;
const SkOpSpan* last = NULL;
@ -579,33 +579,33 @@ void SkOpSegment::debugValidate() const {
bool hasLoop = false;
for (int i = 0; i < count; ++i) {
const SkOpSpan& span = fTs[i];
SK_ALWAYSBREAK(t <= span.fT);
SK_DEBUGBREAK(t <= span.fT);
t = span.fT;
int otherIndex = span.fOtherIndex;
const SkOpSegment* other = span.fOther;
SK_ALWAYSBREAK(other != this || fVerb == SkPath::kCubic_Verb);
SK_DEBUGBREAK(other != this || fVerb == SkPath::kCubic_Verb);
const SkOpSpan& otherSpan = other->fTs[otherIndex];
SK_ALWAYSBREAK(otherSpan.fPt == span.fPt);
SK_ALWAYSBREAK(otherSpan.fOtherT == t);
SK_ALWAYSBREAK(&fTs[i] == &otherSpan.fOther->fTs[otherSpan.fOtherIndex]);
SK_DEBUGBREAK(otherSpan.fPt == span.fPt);
SK_DEBUGBREAK(otherSpan.fOtherT == t);
SK_DEBUGBREAK(&fTs[i] == &otherSpan.fOther->fTs[otherSpan.fOtherIndex]);
done += span.fDone;
if (last) {
bool tsEqual = last->fT == span.fT;
bool tsPreciselyEqual = precisely_equal(last->fT, span.fT);
SK_ALWAYSBREAK(!tsEqual || tsPreciselyEqual);
SK_DEBUGBREAK(!tsEqual || tsPreciselyEqual);
bool pointsEqual = last->fPt == span.fPt;
bool pointsNearlyEqual = AlmostEqualUlps(last->fPt, span.fPt);
#if 0 // bufferOverflow test triggers this
SK_ALWAYSBREAK(!tsPreciselyEqual || pointsNearlyEqual);
SK_DEBUGBREAK(!tsPreciselyEqual || pointsNearlyEqual);
#endif
// SK_ALWAYSBREAK(!last->fTiny || !tsPreciselyEqual || span.fTiny || tinyTFound);
SK_ALWAYSBREAK(last->fTiny || tsPreciselyEqual || !pointsEqual || hasLoop);
SK_ALWAYSBREAK(!last->fTiny || pointsEqual);
SK_ALWAYSBREAK(!last->fTiny || last->fDone);
SK_ALWAYSBREAK(!last->fSmall || pointsNearlyEqual);
SK_ALWAYSBREAK(!last->fSmall || last->fDone);
// SK_ALWAYSBREAK(!last->fSmall || last->fTiny);
// SK_ALWAYSBREAK(last->fTiny || !pointsEqual || last->fDone == span.fDone);
// SK_DEBUGBREAK(!last->fTiny || !tsPreciselyEqual || span.fTiny || tinyTFound);
SK_DEBUGBREAK(last->fTiny || tsPreciselyEqual || !pointsEqual || hasLoop);
SK_DEBUGBREAK(!last->fTiny || pointsEqual);
SK_DEBUGBREAK(!last->fTiny || last->fDone);
SK_DEBUGBREAK(!last->fSmall || pointsNearlyEqual);
SK_DEBUGBREAK(!last->fSmall || last->fDone);
// SK_DEBUGBREAK(!last->fSmall || last->fTiny);
// SK_DEBUGBREAK(last->fTiny || !pointsEqual || last->fDone == span.fDone);
if (last->fTiny) {
tinyTFound |= !tsPreciselyEqual;
} else {
@ -615,7 +615,7 @@ void SkOpSegment::debugValidate() const {
last = &span;
hasLoop |= last->fLoop;
}
SK_ALWAYSBREAK(done == fDoneSpans);
SK_DEBUGBREAK(done == fDoneSpans);
if (fAngles.count() ) {
fAngles.begin()->debugValidateLoop();
}