Index: src/core/SkPathRef.cpp |
=================================================================== |
--- src/core/SkPathRef.cpp (revision 11569) |
+++ src/core/SkPathRef.cpp (working copy) |
@@ -29,7 +29,7 @@ |
} |
SkPoint* SkPathRef::Editor::growForConic(SkScalar w) { |
- fPathRef->validate(); |
+ SkDEBUGCODE(fPathRef->validate();) |
SkPoint* pts = fPathRef->growForVerb(SkPath::kConic_Verb); |
*fPathRef->fConicWeights.append() = w; |
return pts; |
@@ -39,12 +39,12 @@ |
void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, |
const SkPathRef& src, |
const SkMatrix& matrix) { |
- src.validate(); |
+ SkDEBUGCODE(src.validate();) |
if (matrix.isIdentity()) { |
if (*dst != &src) { |
src.ref(); |
dst->reset(const_cast<SkPathRef*>(&src)); |
- (*dst)->validate(); |
+ SkDEBUGCODE((*dst)->validate();) |
} |
return; |
} |
@@ -87,7 +87,7 @@ |
(*dst)->fBoundsIsDirty = true; |
} |
- (*dst)->validate(); |
+ SkDEBUGCODE((*dst)->validate();) |
} |
SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer |
@@ -127,14 +127,14 @@ |
void SkPathRef::Rewind(SkAutoTUnref<SkPathRef>* pathRef) { |
if ((*pathRef)->unique()) { |
- (*pathRef)->validate(); |
+ SkDEBUGCODE((*pathRef)->validate();) |
(*pathRef)->fBoundsIsDirty = true; // this also invalidates fIsFinite |
(*pathRef)->fVerbCnt = 0; |
(*pathRef)->fPointCnt = 0; |
(*pathRef)->fFreeSpace = (*pathRef)->currSize(); |
(*pathRef)->fGenerationID = 0; |
(*pathRef)->fConicWeights.rewind(); |
- (*pathRef)->validate(); |
+ SkDEBUGCODE((*pathRef)->validate();) |
} else { |
int oldVCnt = (*pathRef)->countVerbs(); |
int oldPCnt = (*pathRef)->countPoints(); |
@@ -144,8 +144,8 @@ |
} |
bool SkPathRef::operator== (const SkPathRef& ref) const { |
- this->validate(); |
- ref.validate(); |
+ SkDEBUGCODE(this->validate();) |
+ SkDEBUGCODE(ref.validate();) |
bool genIDMatch = fGenerationID && fGenerationID == ref.fGenerationID; |
#ifdef SK_RELEASE |
if (genIDMatch) { |
@@ -184,7 +184,7 @@ |
} |
void SkPathRef::writeToBuffer(SkWBuffer* buffer) { |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
SkDEBUGCODE(size_t beforePos = buffer->pos();) |
// Call getBounds() to ensure (as a side-effect) that fBounds |
@@ -219,7 +219,7 @@ |
void SkPathRef::copy(const SkPathRef& ref, |
int additionalReserveVerbs, |
int additionalReservePoints) { |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
this->resetToSize(ref.fVerbCnt, ref.fPointCnt, ref.fConicWeights.count(), |
additionalReserveVerbs, additionalReservePoints); |
memcpy(this->verbsMemWritable(), ref.verbsMemBegin(), ref.fVerbCnt * sizeof(uint8_t)); |
@@ -233,12 +233,12 @@ |
fBounds = ref.fBounds; |
fIsFinite = ref.fIsFinite; |
} |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
} |
void SkPathRef::resetToSize(int verbCount, int pointCount, int conicCount, |
int reserveVerbs, int reservePoints) { |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
fBoundsIsDirty = true; // this also invalidates fIsFinite |
fGenerationID = 0; |
@@ -265,11 +265,11 @@ |
fFreeSpace = this->currSize() - minSize; |
} |
fConicWeights.setCount(conicCount); |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
} |
SkPoint* SkPathRef::growForVerb(int /* SkPath::Verb*/ verb) { |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
int pCnt; |
switch (verb) { |
case SkPath::kMove_Verb: |
@@ -304,12 +304,12 @@ |
fPointCnt += pCnt; |
fFreeSpace -= space; |
fBoundsIsDirty = true; // this also invalidates fIsFinite |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
return ret; |
} |
void SkPathRef::makeSpace(size_t size) { |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
ptrdiff_t growSize = size - fFreeSpace; |
if (growSize <= 0) { |
return; |
@@ -336,7 +336,7 @@ |
memmove(newVerbsDst, oldVerbsSrc, oldVerbSize); |
fVerbs = reinterpret_cast<uint8_t*>(reinterpret_cast<intptr_t>(fPoints) + newSize); |
fFreeSpace += growSize; |
- this->validate(); |
+ SkDEBUGCODE(this->validate();) |
} |
int32_t SkPathRef::genID() const { |
@@ -356,7 +356,9 @@ |
return fGenerationID; |
} |
+#ifdef SK_DEBUG |
void SkPathRef::validate() const { |
+ this->INHERITED::validate(); |
SkASSERT(static_cast<ptrdiff_t>(fFreeSpace) >= 0); |
SkASSERT(reinterpret_cast<intptr_t>(fVerbs) - reinterpret_cast<intptr_t>(fPoints) >= 0); |
SkASSERT((NULL == fPoints) == (NULL == fVerbs)); |
@@ -381,3 +383,4 @@ |
} |
#endif |
} |
+#endif |