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

Unified Diff: src/core/SkBruteBBH.cpp

Issue 653023003: Try out SkTree in nanobench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« src/core/SkBruteBBH.h ('K') | « src/core/SkBruteBBH.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBruteBBH.cpp
diff --git a/src/core/SkBruteBBH.cpp b/src/core/SkBruteBBH.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..1380aeac78985c9b52ea3170e30456e0fb426ce4
--- /dev/null
+++ b/src/core/SkBruteBBH.cpp
@@ -0,0 +1,18 @@
+#include "SkBruteBBH.h"
robertphillips 2014/10/29 20:48:11 header!
+
+SkBruteBBH::SkBruteBBH() : fBBs(NULL), fNumBBs(0) {}
+
+SkBruteBBH::~SkBruteBBH() { sk_free(fBBs); }
+
+void SkBruteBBH::insert(SkAutoTMalloc<SkRect>* bbs, int N) {
+ fBBs = bbs->detach();
+ fNumBBs = N;
+}
+
+void SkBruteBBH::search(const SkRect& query, SkTDArray<unsigned>* results) const {
+ for (int i = 0; i < fNumBBs; i++) {
+ if (SkRect::Intersects(query, fBBs[i])) {
+ results->push(i);
+ }
+ }
+}
« src/core/SkBruteBBH.h ('K') | « src/core/SkBruteBBH.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698