Convert BBH APIs to use SkRect.
Still TODO: convert internals of SkTileGrid.cpp and SkRTree.cpp to work in floats too.
NOTREECHECKS=true
BUG=skia:1021
R=robertphillips@google.com, reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/511613002
diff --git a/src/core/SkRTree.cpp b/src/core/SkRTree.cpp
index 3985fb1..77f94e2 100644
--- a/src/core/SkRTree.cpp
+++ b/src/core/SkRTree.cpp
@@ -44,7 +44,14 @@
this->clear();
}
-void SkRTree::insert(void* data, const SkIRect& bounds, bool defer) {
+void SkRTree::insert(void* data, const SkRect& fbounds, bool defer) {
+ SkIRect bounds;
+ if (fbounds.isLargest()) {
+ bounds.setLargest();
+ } else {
+ fbounds.roundOut(&bounds);
+ }
+
this->validate();
if (bounds.isEmpty()) {
SkASSERT(false);
@@ -102,7 +109,9 @@
this->validate();
}
-void SkRTree::search(const SkIRect& query, SkTDArray<void*>* results) const {
+void SkRTree::search(const SkRect& fquery, SkTDArray<void*>* results) const {
+ SkIRect query;
+ fquery.roundOut(&query);
this->validate();
SkASSERT(0 == fDeferredInserts.count()); // If this fails, you should have flushed.
if (!this->isEmpty() && SkIRect::IntersectsNoEmptyCheck(fRoot.fBounds, query)) {