Remove method calls on invalid "this" pointer.
https://codereview.appspot.com/7198050/ git-svn-id: http://skia.googlecode.com/svn/trunk@7366 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
e2bfd8b7b1
commit
b77b69f89f
@ -89,7 +89,7 @@ SkRegion::~SkRegion() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkRegion::freeRuns() {
|
void SkRegion::freeRuns() {
|
||||||
if (fRunHead->isComplex()) {
|
if (this->isComplex()) {
|
||||||
SkASSERT(fRunHead->fRefCnt >= 1);
|
SkASSERT(fRunHead->fRefCnt >= 1);
|
||||||
if (sk_atomic_dec(&fRunHead->fRefCnt) == 1) {
|
if (sk_atomic_dec(&fRunHead->fRefCnt) == 1) {
|
||||||
//SkASSERT(gRgnAllocCounter > 0);
|
//SkASSERT(gRgnAllocCounter > 0);
|
||||||
@ -152,7 +152,7 @@ bool SkRegion::setRegion(const SkRegion& src) {
|
|||||||
|
|
||||||
fBounds = src.fBounds;
|
fBounds = src.fBounds;
|
||||||
fRunHead = src.fRunHead;
|
fRunHead = src.fRunHead;
|
||||||
if (fRunHead->isComplex()) {
|
if (this->isComplex()) {
|
||||||
sk_atomic_inc(&fRunHead->fRefCnt);
|
sk_atomic_inc(&fRunHead->fRefCnt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ bool SkRegion::setRuns(RunType runs[], int count) {
|
|||||||
|
|
||||||
// if we get here, we need to become a complex region
|
// if we get here, we need to become a complex region
|
||||||
|
|
||||||
if (!fRunHead->isComplex() || fRunHead->fRunCount != count) {
|
if (!this->isComplex() || fRunHead->fRunCount != count) {
|
||||||
this->freeRuns();
|
this->freeRuns();
|
||||||
this->allocateRuns(count);
|
this->allocateRuns(count);
|
||||||
}
|
}
|
||||||
@ -518,7 +518,7 @@ bool SkRegion::operator==(const SkRegion& b) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// now we insist that both are complex (but different ptrs)
|
// now we insist that both are complex (but different ptrs)
|
||||||
if (!ah->isComplex() || !bh->isComplex()) {
|
if (!this->isComplex() || !b.isComplex()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return ah->fRunCount == bh->fRunCount &&
|
return ah->fRunCount == bh->fRunCount &&
|
||||||
|
@ -84,24 +84,16 @@ public:
|
|||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isComplex() const {
|
|
||||||
return this != SkRegion_gEmptyRunHeadPtr && this != SkRegion_gRectRunHeadPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkRegion::RunType* writable_runs() {
|
SkRegion::RunType* writable_runs() {
|
||||||
SkASSERT(this->isComplex());
|
|
||||||
SkASSERT(fRefCnt == 1);
|
SkASSERT(fRefCnt == 1);
|
||||||
return (SkRegion::RunType*)(this + 1);
|
return (SkRegion::RunType*)(this + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkRegion::RunType* readonly_runs() const {
|
const SkRegion::RunType* readonly_runs() const {
|
||||||
SkASSERT(this->isComplex());
|
|
||||||
return (const SkRegion::RunType*)(this + 1);
|
return (const SkRegion::RunType*)(this + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RunHead* ensureWritable() {
|
RunHead* ensureWritable() {
|
||||||
SkASSERT(this->isComplex());
|
|
||||||
|
|
||||||
RunHead* writable = this;
|
RunHead* writable = this;
|
||||||
if (fRefCnt > 1) {
|
if (fRefCnt > 1) {
|
||||||
// We need to alloc & copy the current region before we call
|
// We need to alloc & copy the current region before we call
|
||||||
|
Loading…
Reference in New Issue
Block a user