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

Unified Diff: src/core/SkRTree.cpp

Issue 452233002: Make BBH::search() const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More const for tile() Created 6 years, 4 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/core/SkRTree.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRTree.cpp
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp
index fe08437da3633e4e7e0f1e585b10aac93e7fad50..3985fb12859280f187774764df704ba1d0d51e07 100644
--- a/src/core/SkRTree.cpp
+++ b/src/core/SkRTree.cpp
@@ -102,11 +102,9 @@ void SkRTree::flushDeferredInserts() {
this->validate();
}
-void SkRTree::search(const SkIRect& query, SkTDArray<void*>* results) {
+void SkRTree::search(const SkIRect& query, SkTDArray<void*>* results) const {
this->validate();
- if (0 != fDeferredInserts.count()) {
- this->flushDeferredInserts();
- }
+ SkASSERT(0 == fDeferredInserts.count()); // If this fails, you should have flushed.
if (!this->isEmpty() && SkIRect::IntersectsNoEmptyCheck(fRoot.fBounds, query)) {
this->search(fRoot.fChild.subtree, query, results);
}
@@ -399,7 +397,7 @@ SkRTree::Branch SkRTree::bulkLoad(SkTDArray<Branch>* branches, int level) {
}
}
-void SkRTree::validate() {
+void SkRTree::validate() const {
#ifdef SK_DEBUG
if (this->isEmpty()) {
return;
@@ -408,7 +406,7 @@ void SkRTree::validate() {
#endif
}
-int SkRTree::validateSubtree(Node* root, SkIRect bounds, bool isRoot) {
+int SkRTree::validateSubtree(Node* root, SkIRect bounds, bool isRoot) const {
// make sure the pointer is pointing to a valid place
SkASSERT(fNodes.contains(static_cast<void*>(root)));
« no previous file with comments | « src/core/SkRTree.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698