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

Unified Diff: src/core/SkBBoxHierarchy.h

Issue 670213002: Cut down SkBBH API more. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: virtual 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
« no previous file with comments | « bench/RTreeBench.cpp ('k') | src/core/SkRTree.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBBoxHierarchy.h
diff --git a/src/core/SkBBoxHierarchy.h b/src/core/SkBBoxHierarchy.h
index 7246787de87e2b70339273429d63275fee712b97..de8ea0b98a15174afea513037d41ab3e9bdc5804 100644
--- a/src/core/SkBBoxHierarchy.h
+++ b/src/core/SkBBoxHierarchy.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2012 Google Inc.
*
@@ -10,45 +9,31 @@
#define SkBBoxHierarchy_DEFINED
#include "SkRect.h"
-#include "SkTDArray.h"
#include "SkRefCnt.h"
+#include "SkTDArray.h"
+#include "SkTemplates.h"
/**
- * Interface for a spatial data structure that associates user data with axis-aligned
- * bounding boxes, and allows efficient retrieval of intersections with query rectangles.
+ * Interface for a spatial data structure that stores axis-aligned bounding
+ * boxes and allows efficient retrieval of intersections with query rectangles.
*/
class SkBBoxHierarchy : public SkRefCnt {
public:
- SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
-
SkBBoxHierarchy() {}
+ virtual ~SkBBoxHierarchy() {}
/**
- * Hint that <= opCount calls to insert() will be made.
- */
- virtual void reserve(unsigned opCount) {}
-
- /**
- * Insert opIndex and corresponding bounding box.
- * @param opIndex Any value, will be returned in order.
- * @param bounds The bounding box, should not be empty.
- * @param defer Whether or not it is acceptable to delay insertion of this element (building up
- * an entire spatial data structure at once is often faster and produces better
- * structures than repeated inserts) until flushDeferredInserts is called or the first
- * search.
- */
- virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer = false) = 0;
-
- /**
- * If any insertions have been deferred, force them to be inserted.
+ * Insert N bounding boxes into the hierarchy.
+ * The SkBBoxHierarchy may take ownership of boundsArray by calling detach().
*/
- virtual void flushDeferredInserts() {}
+ virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) = 0;
/**
- * Populate results with sorted opIndex corresponding to bounding boxes that intersect query.
+ * Populate results with the indices of bounding boxes interesecting that query.
*/
virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const = 0;
+ SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
private:
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « bench/RTreeBench.cpp ('k') | src/core/SkRTree.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698