diff options
author | mtklein <mtklein@chromium.org> | 2014-10-27 10:27:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-27 10:27:10 -0700 |
commit | 4477c3c0e6eb064772aefe8737425cd1c2ce557f (patch) | |
tree | e841aeb0174e7ddc621f0b5dca88592e8c37d975 /src/core/SkRTree.h | |
parent | 5e44b00392e791088b693a0b462b107b0b5a91ba (diff) |
Cut down SkBBH API more.
- The expected case is now a single bulk-load insert() call instead of N;
- reserve() and flushDeferredInserts() can fold into insert() now;
- SkBBH subclasses may take ownership of the bounds
This appears to be a performance no-op on both my Mac and N5. I guess
even the simplest indirect branch predictor ("same as last time") can predict
the repeated virtual calls to SkBBH::insert() perfectly.
BUG=skia:
Review URL: https://codereview.chromium.org/670213002
Diffstat (limited to 'src/core/SkRTree.h')
-rw-r--r-- | src/core/SkRTree.h | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/core/SkRTree.h b/src/core/SkRTree.h index 0d88804c30..00c6c8941d 100644 --- a/src/core/SkRTree.h +++ b/src/core/SkRTree.h @@ -59,24 +59,7 @@ public: bool orderWhenBulkLoading = true); virtual ~SkRTree(); - /** - * Insert a node, consisting of bounds and a data value into the tree, if we don't immediately - * need to use the tree; we may allow the insert to be deferred (this can allow us to bulk-load - * a large batch of nodes at once, which tends to be faster and produce a better tree). - * @param opIndex The data value - * @param bounds The corresponding bounding box - * @param defer Can this insert be deferred? (this may be ignored) - */ - virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer = false) SK_OVERRIDE; - - /** - * If any inserts have been deferred, this will add them into the tree - */ - virtual void flushDeferredInserts() SK_OVERRIDE; - - /** - * Given a query rectangle, populates the passed-in array with the elements it intersects - */ + virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) SK_OVERRIDE; virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; void clear(); @@ -179,7 +162,6 @@ private: Branch fRoot; SkChunkAlloc fNodes; - SkTDArray<Branch> fDeferredInserts; SkScalar fAspectRatio; bool fSortWhenBulkLoading; |