QuadTree: don't leak deferred inserts past clear()
BUG=skia: R=djsollen@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/277713003 git-svn-id: http://skia.googlecode.com/svn/trunk@14670 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
95c2003740
commit
4175388afa
@ -46,8 +46,7 @@ static U8CPU child_intersect(const SkIRect& query, const SkIPoint& split) {
|
|||||||
return intersect;
|
return intersect;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkQuadTree::SkQuadTree(const SkIRect& bounds)
|
SkQuadTree::SkQuadTree(const SkIRect& bounds) : fRoot(NULL) {
|
||||||
: fRoot(NULL) {
|
|
||||||
SkASSERT((bounds.width() * bounds.height()) > 0);
|
SkASSERT((bounds.width() * bounds.height()) > 0);
|
||||||
fRootBounds = bounds;
|
fRootBounds = bounds;
|
||||||
}
|
}
|
||||||
@ -178,11 +177,14 @@ void SkQuadTree::search(const SkIRect& query, SkTDArray<void*>* results) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkQuadTree::clear() {
|
void SkQuadTree::clear() {
|
||||||
|
this->flushDeferredInserts();
|
||||||
if (NULL != fRoot) {
|
if (NULL != fRoot) {
|
||||||
this->clear(fRoot);
|
this->clear(fRoot);
|
||||||
fNodePool.release(fRoot);
|
fNodePool.release(fRoot);
|
||||||
fRoot = NULL;
|
fRoot = NULL;
|
||||||
}
|
}
|
||||||
|
SkASSERT(fEntryPool.allocated() == fEntryPool.available());
|
||||||
|
SkASSERT(fNodePool.allocated() == fNodePool.available());
|
||||||
}
|
}
|
||||||
|
|
||||||
int SkQuadTree::getDepth() const {
|
int SkQuadTree::getDepth() const {
|
||||||
|
Loading…
Reference in New Issue
Block a user